Browse Source

fix 修改删除附件

Administrator 1 year ago
parent
commit
31799c2d60

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZxFjMapper.java

@@ -64,6 +64,7 @@ public interface ZxFjMapper
 
     void deleteZxFjBySourceId(Long sourceId);
 
+
     /**
      * 批量插入
      * @param zxFjList
@@ -71,5 +72,5 @@ public interface ZxFjMapper
      */
     int batchZxFj(List<ZxFj> zxFjList);
 
-    void deleteZxFj(@Param("sourceId") Long sourceId, @Param("mainId")Long mainId, @Param("type")String type, @Param("stytle")String stytle);
+    void deleteZxFj(ZxFj zxFj);
 }

+ 8 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProposalUnitReplyServiceImpl.java

@@ -19,6 +19,8 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.ServletException;
 
+import static com.ruoyi.common.constant.CommonConstants.ONE;
+
 /**
  * 提案单位答复Service业务层处理
  * 
@@ -135,8 +137,13 @@ public class ProposalUnitReplyServiceImpl implements IProposalUnitReplyService
         }
 
         if(proposalUnitReply.getZxFjList()!=null && proposalUnitReply.getZxFjList().size()>0){
+            ZxFj fj = new ZxFj();
+            fj.setSourceId(list.get(0).getId());
+            fj.setMainId(proposalUnitReply.getProposalId());
+            fj.setType(ONE);
+            fj.setStytle(list.get(0).getType());
             //删除附件
-            zxFjMapper.deleteZxFj(list.get(0).getId(),proposalUnitReply.getProposalId(),"1",list.get(0).getType());
+            zxFjMapper.deleteZxFj(fj);
             for (ZxFj zxFj : proposalUnitReply.getZxFjList()) {
                 zxFj.setMainId(proposalUnitReply.getProposalId());
                 zxFj.setSourceId(list.get(0).getId());

+ 9 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SqmyUnitReplyServiceImpl.java

@@ -17,6 +17,9 @@ import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.SqmyUnitReplyMapper;
 import com.ruoyi.system.service.ISqmyUnitReplyService;
 
+import static com.ruoyi.common.constant.CommonConstants.ONE;
+import static com.ruoyi.common.constant.CommonConstants.TWO;
+
 /**
  * 社情民意单位答复Service业务层处理
  * 
@@ -131,8 +134,13 @@ public class SqmyUnitReplyServiceImpl implements ISqmyUnitReplyService
         }
 
         if(sqmyUnitReply.getZxFjList()!=null && sqmyUnitReply.getZxFjList().size()>0){
+            ZxFj fj = new ZxFj();
+            fj.setSourceId(list.get(0).getId());
+            fj.setMainId(sqmyUnitReply.getSqmyId());
+            fj.setType(TWO);
+            fj.setStytle(list.get(0).getType());
             //删除附件
-            zxFjMapper.deleteZxFj(list.get(0).getId(),sqmyUnitReply.getSqmyId(),"2",list.get(0).getType());
+            zxFjMapper.deleteZxFj(fj);
             for (ZxFj zxFj : sqmyUnitReply.getZxFjList()) {
                 zxFj.setMainId(sqmyUnitReply.getSqmyId());
                 zxFj.setSourceId(list.get(0).getId());

+ 5 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZxActivityServiceImpl.java

@@ -26,8 +26,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
-import static com.ruoyi.common.constant.CommonConstants.FIV;
-import static com.ruoyi.common.constant.CommonConstants.THR;
+import static com.ruoyi.common.constant.CommonConstants.*;
 
 /**
  * 政协活动Service业务层处理
@@ -171,7 +170,10 @@ public class ZxActivityServiceImpl implements IZxActivityService {
     public int updateZxActivity(ZxActivity zxActivity) {
         zxActivity.setUpdateTime(DateUtils.getNowDate());
         zxActivityMapper.deleteZxActivityUserByActivityId(zxActivity.getActivityId());
-        zxFjMapper.deleteZxFjBySourceId(zxActivity.getActivityId());
+        ZxFj fj = new ZxFj();
+        fj.setSourceId(zxActivity.getActivityId());
+        fj.setType(FIV);
+        zxFjMapper.deleteZxFj(fj);
         insertZxActivityUser(zxActivity);
         insertZxFj(zxActivity);
         return zxActivityMapper.updateZxActivity(zxActivity);

+ 6 - 3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZxBonusServiceImpl.java

@@ -16,8 +16,7 @@ import com.ruoyi.system.service.IZxBonusService;
 import java.util.ArrayList;
 import java.util.List;
 
-import static com.ruoyi.common.constant.CommonConstants.FIV;
-import static com.ruoyi.common.constant.CommonConstants.SEV;
+import static com.ruoyi.common.constant.CommonConstants.*;
 
 /**
  * 政协履职加分Service业务层处理
@@ -86,7 +85,11 @@ public class ZxBonusServiceImpl implements IZxBonusService
     public int updateZxBonus(ZxBonus zxBonus)
     {
         zxBonus.setUpdateTime(DateUtils.getNowDate());
-        zxFjMapper.deleteZxFjBySourceId(zxBonus.getBonusId());
+        ZxFj fj = new ZxFj();
+        fj.setSourceId(zxBonus.getBonusId());
+        fj.setType(SEV);
+        //删除附件
+        zxFjMapper.deleteZxFj(fj);
         insertZxFj(zxBonus);
         return zxBonusMapper.updateZxBonus(zxBonus);
     }

+ 5 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZxConferenceServiceImpl.java

@@ -140,7 +140,11 @@ public class ZxConferenceServiceImpl implements IZxConferenceService {
     public int updateZxConference(ZxConference zxConference) {
         zxConference.setUpdateTime(DateUtils.getNowDate());
         zxConferenceMapper.deleteZxConferenceUserByConferenceId(zxConference.getConferenceId());
-        zxFjMapper.deleteZxFjBySourceId(zxConference.getConferenceId());
+        ZxFj fj = new ZxFj();
+        fj.setSourceId(zxConference.getConferenceId());
+        fj.setType(FOR);
+        //删除附件
+        zxFjMapper.deleteZxFj(fj);
         insertZxConferenceUser(zxConference);
         insertZxFj(zxConference);
         return zxConferenceMapper.updateZxConference(zxConference);

+ 4 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZxNoticeServiceImpl.java

@@ -117,7 +117,10 @@ public class ZxNoticeServiceImpl implements IZxNoticeService
     {
         zxNotice.setUpdateTime(DateUtils.getNowDate());
         zxNoticeMapper.deleteZxUserNoticeByZxNoticeId(zxNotice.getZxNoticeId());
-        zxFjMapper.deleteZxFjBySourceId(zxNotice.getZxNoticeId());
+        ZxFj zxFj = new ZxFj();
+        zxFj.setSourceId(zxNotice.getZxNoticeId());
+        zxFj.setType(THR);
+        zxFjMapper.deleteZxFj(zxFj);
         insertZxUserNotice(zxNotice);
         insertZxFj(zxNotice);
         return zxNoticeMapper.updateZxNotice(zxNotice);

+ 4 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ZxSpeakServiceImpl.java

@@ -90,7 +90,10 @@ public class ZxSpeakServiceImpl implements IZxSpeakService
     public int updateZxSpeak(ZxSpeak zxSpeak)
     {
         zxSpeak.setUpdateTime(DateUtils.getNowDate());
-        zxFjMapper.deleteZxFjBySourceId(zxSpeak.getSpeakId());
+        ZxFj fj = new ZxFj();
+        fj.setSourceId(zxSpeak.getSpeakId());
+        fj.setType(SIX);
+        zxFjMapper.deleteZxFj(fj);
         insertZxFj(zxSpeak);
         return zxSpeakMapper.updateZxSpeak(zxSpeak);
     }

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/ZxBonusMapper.xml

@@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="score != null  and score != ''"> and score = #{score}</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
         </where>
-        order by bonus_time desc
+        order by create_time desc
     </select>
     
     <select id="selectZxBonusByBonusId" parameterType="Long" resultMap="ZxBonusResult">

+ 8 - 2
ruoyi-system/src/main/resources/mapper/system/ZxFjMapper.xml

@@ -91,7 +91,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteZxFjBySourceId" parameterType="Long">
         delete from zx_fj where source_id = #{sourceId}
     </delete>
-    <delete id="deleteZxFj">
-        delete from zx_fj where source_id = #{sourceId} and main_id = #{mainId} and type = #{type} and stytle = #{stytle}
+    <delete id="deleteZxFj" parameterType="zxFj">
+        delete from zx_fj
+        <where>
+            <if test="mainId != null "> and main_id = #{mainId}</if>
+            <if test="sourceId != null "> and source_id = #{sourceId}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="stytle != null  and stytle != ''"> and stytle = #{stytle}</if>
+        </where>
     </delete>
 </mapper>