| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.engineering.entity.Engineering; |
| | |
| | | |
| | | @Override |
| | | public boolean pauseTask(String engineerId, Integer state) { |
| | | Engineering engineering = this.getBaseMapper().selectOne( |
| | | Wrappers.lambdaQuery(Engineering.class) |
| | | .eq(Engineering::getEngineerId, engineerId) |
| | | ); |
| | | |
| | | if (engineering == null) { |
| | | // 工程不存在,返回失败 |
| | | return false; |
| | | } |
| | | |
| | | // 2. 根据当前状态决定目标状态(1→5,5→1) |
| | | Integer targetState = engineering.getState() == 1 ? 5 : 1; |
| | | |
| | | //暂停正在进行工程 |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState, 5); |
| | | pauseWrapper.set(Engineering::getState, targetState); |
| | | pauseWrapper.eq(Engineering::getEngineerId, engineerId); |
| | | return pauseWrapper.update(); |
| | | } |