ZhuDeKang 4 ヶ月 前
コミット
a1e3ad03d9

+ 4 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/MdModelInfoController.java

@@ -123,5 +123,9 @@ public class MdModelInfoController extends BaseController {
         modelSet.setCreateBy(getUsername());
         return toAjax(mdModelInfoService.modelSetRela(modelSet));
     }
+    @DeleteMapping("/modelSetRela")
+    public  AjaxResult deleteModelSetRela(MdModelSetRelaVo modelSet) {
+        return toAjax(mdModelInfoService.deleteModelSetRela(modelSet));
+    }
 
 }

+ 2 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/mapper/MdModelInfoMapper.java

@@ -72,4 +72,6 @@ public interface MdModelInfoMapper
     int insertModelSetRela(MdModelSetRelaVo modelSet);
 
     List<MdModelSetRelaVo> selectModelSetRela(MdModelSetRelaVo modelSet);
+
+    int deleteModelSetRela(MdModelSetRelaVo modelSet);
 }

+ 2 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/IMdModelInfoService.java

@@ -66,4 +66,6 @@ public interface IMdModelInfoService
     int publish(MdModelInfo mdModelInfo);
 
     int modelSetRela(MdModelSetRelaVo modelSet);
+
+    int deleteModelSetRela(MdModelSetRelaVo modelSet);
 }

+ 10 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/MdModelInfoServiceImpl.java

@@ -111,7 +111,6 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
 
     @Override
     public int modelSetRela(MdModelSetRelaVo modelSet) {
-        String mdId = modelSet.getMdid();
         modelSet.setCreateTime(DateUtils.getNowDate());
         int i = 0;
         for (String dcCode : modelSet.getDcCodes()) {
@@ -122,4 +121,14 @@ public class MdModelInfoServiceImpl implements IMdModelInfoService {
         }
         return i;
     }
+
+    @Override
+    public int deleteModelSetRela(MdModelSetRelaVo modelSet) {
+        int i = 0;
+        for (String dcCode : modelSet.getDcCodes()) {
+            modelSet.setDcCode(dcCode);
+            i += mdModelInfoMapper.deleteModelSetRela(modelSet);
+        }
+        return i;
+    }
 }

+ 6 - 0
ruoyi-api-patform/src/main/resources/mapper/interfaces/MdModelInfoMapper.xml

@@ -469,4 +469,10 @@
             #{mdid}
         </foreach>
     </delete>
+    <delete id="deleteModelSetRela">
+        delete
+        from md_model_set_rela
+        where MDID = #{mdid}
+          and DC_CODE = #{dcCode}
+    </delete>
 </mapper>