Blame view

ProjectReviewPeriodServiceImpl.java 2.66 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
package com.zhongzhi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhongzhi.common.utils.DateFormatUtil;
import com.zhongzhi.dto.period.ProjectReviewPeriodDTO;
import com.zhongzhi.model.ProjectReviewPeriodDO;
import com.zhongzhi.dao.ProjectReviewPeriodMapper;
import com.zhongzhi.service.ProjectReviewPeriodService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongzhi.vo.projectReviewPeriod.ProjectReviewPeriodVO;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 评审时段 服务实现类
 * </p>
 *
 * @author DengMin
 * @since 2021-06-10
 */
@Service
public class ProjectReviewPeriodServiceImpl extends ServiceImpl<ProjectReviewPeriodMapper, ProjectReviewPeriodDO> implements ProjectReviewPeriodService {

    @Override
    public ProjectReviewPeriodVO getProjectReviewPeriod(ProjectReviewPeriodDTO projectReviewPeriodDTO) {
        ProjectReviewPeriodVO projectReviewPeriodVO = new ProjectReviewPeriodVO();
        ProjectReviewPeriodDO projectReviewPeriodDO = this.baseMapper.selectOne(new QueryWrapper<ProjectReviewPeriodDO>()
                .lambda()
                .eq(ProjectReviewPeriodDO::getMatchId, projectReviewPeriodDTO.getMatchId())
                .eq(ProjectReviewPeriodDO::getProjectGroup, projectReviewPeriodDTO.getProjectGroup())
                .eq(ProjectReviewPeriodDO::getProjectSchedule, projectReviewPeriodDTO.getProjectSchedule()));
        if (projectReviewPeriodDO != null) {
            projectReviewPeriodVO.setId(projectReviewPeriodDO.getId());
            projectReviewPeriodVO.setStartTime(DateFormatUtil.format(projectReviewPeriodDO.getStartTime(), DateFormatUtil.FMT_sdf14_L));
            projectReviewPeriodVO.setEndTime(DateFormatUtil.format(projectReviewPeriodDO.getEndTime(), DateFormatUtil.FMT_sdf14_L));
        }

        return projectReviewPeriodVO;
    }

    @Override
    public void updateProjectReviewPeriod(ProjectReviewPeriodDO projectReviewPeriodDO) {
        ProjectReviewPeriodDO projectReviewPeriod = this.baseMapper.selectOne(new QueryWrapper<ProjectReviewPeriodDO>()
                .lambda()
                .eq(ProjectReviewPeriodDO::getMatchId, projectReviewPeriodDO.getMatchId())
                .eq(ProjectReviewPeriodDO::getProjectSchedule, projectReviewPeriodDO.getProjectSchedule())
                .eq(ProjectReviewPeriodDO::getProjectGroup, projectReviewPeriodDO.getProjectGroup()));
        if (projectReviewPeriod != null) {
            projectReviewPeriodDO.setId(projectReviewPeriod.getId());
            this.baseMapper.updateById(projectReviewPeriodDO);
        } else {
            this.baseMapper.insert(projectReviewPeriodDO);
        }
    }
}