Quellcode durchsuchen

sop新增隔离点信息

车车 vor 4 Monaten
Ursprung
Commit
da955e075e

+ 15 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/mysql/sop/SopPointsMapper.java

@@ -5,7 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopPointsPageReqVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopPointsDO;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * SOP隔离点 Mapper
@@ -27,4 +31,15 @@ public interface SopPointsMapper extends BaseMapperX<SopPointsDO> {
                 .orderByDesc(SopPointsDO::getId));
     }
 
+    @Delete({
+            "<script>",
+            "DELETE FROM isc_sop_points",
+            "WHERE id IN",
+            "<foreach item='id' collection='ids' open='(' separator=',' close=')'>",
+            "#{id}",
+            "</foreach>",
+            "</script>"
+    })
+    Boolean physicalDeleteByIds(@Param(value = "ids") List<Long> ids);
+
 }

+ 2 - 8
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopPointsService.java

@@ -19,10 +19,10 @@ public interface SopPointsService extends IService<SopPointsDO> {
     /**
      * 创建SOP隔离点
      *
-     * @param createReqVO 创建信息
+     * @param list 创建信息
      * @return 编号
      */
-    Long createSopPoints(@Valid SopPointsSaveReqVO createReqVO);
+    Boolean createSopPoints(@Valid List<SopPointsSaveReqVO> list);
 
     /**
      * 更新SOP隔离点
@@ -31,12 +31,6 @@ public interface SopPointsService extends IService<SopPointsDO> {
      */
     void updateSopPoints(@Valid SopPointsSaveReqVO updateReqVO);
 
-    /**
-     * 删除SOP隔离点
-     *
-     * @param id 编号
-     */
-    void deleteSopPoints(Long id);
 
     /**
     * 批量删除SOP隔离点

+ 10 - 15
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopPointsServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.iocoder.yudao.module.iscs.service.sop;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopPointsPageReqVO;
@@ -30,13 +31,15 @@ public class SopPointsServiceImpl extends ServiceImpl<SopPointsMapper, SopPoints
     private SopPointsMapper sopPointsMapper;
 
     @Override
-    public Long createSopPoints(SopPointsSaveReqVO createReqVO) {
-        // 插入
-        SopPointsDO sopPoints = BeanUtils.toBean(createReqVO, SopPointsDO.class);
-        sopPointsMapper.insert(sopPoints);
-
+    public Boolean createSopPoints(List<SopPointsSaveReqVO> list) {
+        Assert.isFalse(list.isEmpty(), "请给我点位信息!");
+        for (SopPointsSaveReqVO vo : list) {
+            // 插入
+            SopPointsDO sopPoints = BeanUtils.toBean(vo, SopPointsDO.class);
+            sopPointsMapper.insert(sopPoints);
+        }
         // 返回
-        return sopPoints.getId();
+        return true;
     }
 
     @Override
@@ -48,20 +51,12 @@ public class SopPointsServiceImpl extends ServiceImpl<SopPointsMapper, SopPoints
         sopPointsMapper.updateById(updateObj);
     }
 
-    @Override
-    public void deleteSopPoints(Long id) {
-        // 校验存在
-        validateSopPointsExists(id);
-        // 删除
-        sopPointsMapper.deleteById(id);
-    }
-
     @Override
         public void deleteSopPointsListByIds(List<Long> ids) {
         // 校验存在
         validateSopPointsExists(ids);
         // 删除
-        sopPointsMapper.deleteByIds(ids);
+        sopPointsMapper.physicalDeleteByIds(ids);
         }
 
     private void validateSopPointsExists(List<Long> ids) {