Lius
2024-12-02 2dcd7f3634f2e636e10ea758441ded77e1d2c845
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcShiftServiceImpl.java
@@ -5,19 +5,16 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.xml.bind.v2.TODO;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.mdc.entity.MdcShift;
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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -114,8 +111,10 @@
    @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);
        if (mdcShift != null) {
            mdcShift.setDefaultShift("false");
            this.baseMapper.updateById(mdcShift);
        }
        MdcShift defaultShift = this.baseMapper.selectById(id);
        defaultShift.setDefaultShift("true");
        this.baseMapper.updateById(defaultShift);