唐耀东
2022-05-23 dd296baf6463522b0a534b2eb2bc920a3928cd54
ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SgConstructionBatchServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.oa.domain.SgConstructionBatch;
import com.ruoyi.oa.mapper.SgConstructionBatchMapper;
import com.ruoyi.oa.service.ISgConstructionBatchService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -50,16 +51,16 @@
        Map<String, Object> params = bo.getParams();
        LambdaQueryWrapper<SgConstructionBatch> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getBatch()), SgConstructionBatch::getBatch, bo.getBatch());
        lqw.eq(bo.getStartDate() != null, SgConstructionBatch::getStartDate, bo.getStartDate());
        lqw.eq(bo.getEndDate() != null, SgConstructionBatch::getEndDate, bo.getEndDate());
        lqw.eq(bo.getUserId() != null, SgConstructionBatch::getUserId, bo.getUserId());
        lqw.eq(SgConstructionBatch::getSchoolId, bo.getSchoolId());
        lqw.orderByDesc(SgConstructionBatch::getUpdateTime);
        return lqw;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean insertByBo(SgConstructionBatchBo bo) {
        List<SgConstructionBatch> list = baseMapper.selectList(new LambdaQueryWrapper<SgConstructionBatch>()
            .eq(SgConstructionBatch::getBatch, bo.getBatch()));
            .eq(SgConstructionBatch::getBatch, bo.getBatch()).eq(SgConstructionBatch::getSchoolId, bo.getSchoolId()));
        if (list.size() > 0) {
            throw new ServiceException("施工批次重复", HttpStatus.HTTP_PARTIAL);
        }
@@ -73,9 +74,12 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean updateByBo(SgConstructionBatchBo bo) {
        List<SgConstructionBatch> list = baseMapper.selectList(new LambdaQueryWrapper<SgConstructionBatch>()
            .eq(SgConstructionBatch::getBatch, bo.getBatch()).ne(SgConstructionBatch::getId, bo.getId()));
            .eq(SgConstructionBatch::getBatch, bo.getBatch())
            .ne(SgConstructionBatch::getId, bo.getId())
            .eq(SgConstructionBatch::getSchoolId, bo.getSchoolId()));
        if (list.size() > 0) {
            throw new ServiceException("施工批次重复", HttpStatus.HTTP_PARTIAL);
        }