This commit is contained in:
xiaofajia 2024-10-10 11:48:31 +08:00
commit 4d3d3aa971
6 changed files with 43 additions and 13 deletions

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 维修工人 Mapper
*
@ -26,4 +28,11 @@ public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
**/
IPage<RepairWorkerRespVO> queryListPage(@Param("entity") RepairWorkerPageReqVO entity, Page<RepairWorkerRespVO> page);
/**
* 获取所有维修工人的id
* @return List<Long> 维修工人id列表
* @author lzt
* @date 2024年10月10日
**/
List<Long> getAllWorkerIds();
}

View File

@ -57,4 +57,6 @@ public interface RepairRecordsService extends IService<RepairRecords> {
*/
List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO);
}

View File

@ -62,7 +62,7 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
* @apiNote lzt
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
* @date
* @date 2024年10月9日
*/
@Override
public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) {

View File

@ -36,22 +36,30 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
* 批量创建维修工人
*
* @param userList 选中用户集合
* @author PQZ
* @date 18:33 2024/10/9
* @author lzt
* @date 2024年10月10日
**/
@Override
public void saveWorkers(List<UserDTO> userList) {
if (CollectionUtil.isNotEmpty(userList)){
//获取已有的维修工人ID列表
List<Long> existingWorkerIds = workerMapper.getAllWorkerIds();
List<RepairWorker> saveList = new ArrayList<>();
userList.forEach(item -> {
if (!existingWorkerIds.contains(item.getId())) {
RepairWorker worker = new RepairWorker();
worker.setUserId(item.getId());
worker.setUserName(item.getNickname());
saveList.add(worker);
}
});
if (!saveList.isEmpty()) {
saveBatch(saveList);
}
}
}
@Override
public void updateWorker(RepairWorkerSaveReqVO updateReqVO) {

View File

@ -28,4 +28,15 @@
order by main.create_time desc
</select>
<select id="getAllWorkerIds" resultType="java.lang.Long">
SELECT
main.user_id
FROM
dl_repair_worker main
WHERE
main.deleted = 0
</select>
</mapper>

View File

@ -4,7 +4,7 @@
"avatar": "",
"version": "4.9.2",
"createdTime": "2024-10-9 10:34:15",
"updatedTime": "2024-10-9 17:32:50",
"updatedTime": "2024-10-10 10:48:48",
"dbConns": [],
"profile": {
"default": {
@ -683,7 +683,7 @@
"optionsFetcher": ""
}
},
"menuWidth": "266px"
"menuWidth": "298px"
},
"entities": [
{