diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java index 9ab4ea7a..980d8c6b 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/mapper/RepairWorkerMapper.java @@ -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 { **/ IPage queryListPage(@Param("entity") RepairWorkerPageReqVO entity, Page page); -} \ No newline at end of file + /** + * 获取所有维修工人的id + * @return List 维修工人id列表 + * @author lzt + * @date 2024年10月10日 + **/ + List getAllWorkerIds(); +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java index 5eeee7e5..3f308cbe 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java @@ -57,4 +57,6 @@ public interface RepairRecordsService extends IService { */ List queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO); + + } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java index 967b0b36..99a13819 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairRecordsServiceImpl.java @@ -62,7 +62,7 @@ public class RepairRecordsServiceImpl extends ServiceImpl queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) { diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java index 595a1b3f..26ae84be 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/impl/RepairWorkerServiceImpl.java @@ -36,20 +36,28 @@ public class RepairWorkerServiceImpl extends ServiceImpl userList) { if (CollectionUtil.isNotEmpty(userList)){ + //获取已有的维修工人ID列表 + List existingWorkerIds = workerMapper.getAllWorkerIds(); + List saveList = new ArrayList<>(); userList.forEach(item -> { - RepairWorker worker = new RepairWorker(); - worker.setUserId(item.getId()); - worker.setUserName(item.getNickname()); - saveList.add(worker); + if (!existingWorkerIds.contains(item.getId())) { + RepairWorker worker = new RepairWorker(); + worker.setUserId(item.getId()); + worker.setUserName(item.getNickname()); + saveList.add(worker); + } }); - saveBatch(saveList); + + if (!saveList.isEmpty()) { + saveBatch(saveList); + } } } @@ -84,4 +92,4 @@ public class RepairWorkerServiceImpl extends ServiceImpl - \ No newline at end of file + + + + + diff --git a/数据库设计/蓝安集团一体化平台.pdma.json b/数据库设计/蓝安集团一体化平台.pdma.json index 11c9a81c..6a65d220 100644 --- a/数据库设计/蓝安集团一体化平台.pdma.json +++ b/数据库设计/蓝安集团一体化平台.pdma.json @@ -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": [ {