zenglf
2023-09-28 f84d9e69907cb678150eaa6393fd74cf042fcca4
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java
@@ -12,7 +12,9 @@
import org.jeecg.modules.mdc.mapper.MdcShiftMapper;
import org.jeecg.modules.mdc.service.IMdcShiftService;
import org.jeecg.modules.mdc.service.IMdcShiftSubService;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -32,9 +34,6 @@
    @Resource
    private IMdcShiftSubService mdcShiftSubService;
    @Resource
    private MdcShiftMapper mdcShiftMapper;
    @Override
    public IPage<MdcShift> queryPageList(Page page, MdcShift mdcShift) {
        LambdaQueryWrapper<MdcShift> lambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -51,6 +50,7 @@
        if (StringUtils.isEmpty(mdcShift.getShiftStatus())){
            mdcShift.setShiftStatus("1");
        }
        mdcShift.setDefaultShift("false");
        List<MdcShift> mdcShifts = listMdcName(mdcShift);
        //查询有重复数据返回false
        if (null != mdcShifts && !mdcShifts.isEmpty()){
@@ -103,4 +103,22 @@
        }
        return result;
    }
    /**
     * 设置默认班制
     *
     * @param id
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean changeDefaultShift(String id) {
        MdcShift mdcShift = this.baseMapper.selectOne(new LambdaQueryWrapper<MdcShift>().eq(MdcShift::getDefaultShift, "true"));
        mdcShift.setDefaultShift("false");
        this.baseMapper.updateById(mdcShift);
        MdcShift defaultShift = this.baseMapper.selectById(id);
        defaultShift.setDefaultShift("true");
        this.baseMapper.updateById(defaultShift);
        return true;
    }
}