package cn.ey.biz.module.system.service.engagement.scope;

import cn.ey.biz.module.system.api.engagement.scope.dto.OpprScopeConfigReqDTO;
import cn.ey.biz.module.system.controller.engagement.scope.vo.OpprScopeConfigReqVO;
import cn.ey.biz.module.system.controller.engagement.scope.vo.OpprScopeConfigUpdateReqVO;
import cn.ey.biz.module.system.convert.engagement.scope.OpprScopeConfigConvert;
import cn.ey.biz.module.system.dal.dataobject.engagement.scope.SystemOpprScopeConfigDO;
import cn.ey.biz.module.system.dal.mapper.engagement.scope.OpprScopeConfigMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 *  商机公开范围
 */
@Service
public class OpprScopeConfigServiceImpl implements OpprScopeConfigService {

    @Resource
    private OpprScopeConfigMapper  opprScopeConfigMapper;

    @Override
    public List<SystemOpprScopeConfigDO> getOpprScopeConfigList(OpprScopeConfigReqVO OpprScopeConfigReqVO) {
        List<SystemOpprScopeConfigDO> list=opprScopeConfigMapper.selectList(OpprScopeConfigReqVO);
        return list;
    }

    @Override
    public void updateOpprScopeList(List<OpprScopeConfigUpdateReqVO> opprScopeConfigUpdateReqVO) {
        for(OpprScopeConfigUpdateReqVO so:opprScopeConfigUpdateReqVO){
            if(so.getId()!=null){
                SystemOpprScopeConfigDO opprScopeConfigDO=OpprScopeConfigConvert.INSTANCE.convert(so);
                opprScopeConfigMapper.updateById(opprScopeConfigDO);
            }
        }
    }

    @Override
    public List<SystemOpprScopeConfigDO> getOpprScopeConfigList(OpprScopeConfigReqDTO opprScopeConfigReqDTO) {
        List<SystemOpprScopeConfigDO> list=opprScopeConfigMapper.selectList(opprScopeConfigReqDTO);
        return  list;
    }

}
