Bladeren bron

Merge remote-tracking branch 'origin/main'

韩帛霖 1 jaar geleden
bovenliggende
commit
698b675a20

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableFormMapper.java

@@ -2,6 +2,8 @@ package com.ruoyi.system.mapper;
 
 import com.ruoyi.system.entity.DragTableForm;
 
+import java.util.List;
+
 public interface DragTableFormMapper {
 
     /**
@@ -14,4 +16,14 @@ public interface DragTableFormMapper {
      */
     int selectDtIdCount(Long dtId);
 
+    /**
+     * 根据表单id查询
+     */
+    DragTableForm selectDragTableForm(Long dfId);
+
+    /**
+     * 根据表单id删除
+     */
+    int deleteDragTableFormByDfId(Long dfId);
+
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragFormServiceImpl.java

@@ -4,6 +4,7 @@ import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.entity.DragForm;
 import com.ruoyi.system.entity.DragTableForm;
 import com.ruoyi.system.mapper.DragFormMapper;
@@ -114,10 +115,15 @@ public class DragFormServiceImpl implements IDragFormService {
      * @return 结果
      */
     @Override
+    @Transactional
     public int deleteDragFormByFIds(Long[] fIds) {
         // 删除表单源文件
         for (Long fId : fIds) {
             delFileForm(fId);
+            //删除表单表格关联表
+            if(StringUtils.isNotNull(dragTableFormMapper.selectDragTableForm(fId))){
+                dragTableFormMapper.deleteDragTableFormByDfId(fId);
+            }
         }
         return dragFormMapper.deleteDragFormByFIds(fIds);
     }

+ 9 - 0
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableFormMapper.xml

@@ -20,5 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select count(1) from drag_table_form where dt_id = #{dtId}
     </select>
 
+    <select id="selectDragTableForm" resultMap="DragTableFormResult">
+        select id,dt_id,df_id from drag_table_form where df_id = #{dfId}
+    </select>
+
+    <delete id="deleteDragTableFormByDfId">
+        delete from drag_table_form where df_id = #{dfId}
+    </delete>
+
+
 
 </mapper>