diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java index b0a4af04..fe605623 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.ruoyi.common.core.domain.AjaxResult; import com.zc.business.domain.DcEventImportantFile; +import org.apache.ibatis.annotations.Param; /** * 重要事件文件内容Mapper接口 @@ -61,6 +62,16 @@ public interface DcEventImportantFileMapper */ int deleteDcEventImportantFileByEventIds(String[] ids); + + /** + * 删除重要事件文件内容 + * + * @param eventId 事件id + * @param type 类型 + * @return 结果 + */ + int deleteDcEventImportantFile(@Param("eventId") String eventId, @Param("type") String type); + /** * 获取重要事件状态 * diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java index dffd4471..e19764b3 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java @@ -86,6 +86,10 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer if (StringUtils.isEmpty(dcEventImportantFile.getEventId())){ return AjaxResult.error("事件id不能为空!"); } + if ("1".equals(dcEventImportantFile.getType()) || "3".equals(dcEventImportantFile.getType())){ + dcEventImportantFileMapper.deleteDcEventImportantFile(dcEventImportantFile.getEventId(),dcEventImportantFile.getType()); + } + dcEventImportantFileMapper.selectDcEventImportantFileList(dcEventImportantFile); int i = dcEventImportantFileMapper.insertDcEventImportantFile(dcEventImportantFile); if (i > 0){ if (StringUtils.isNotEmpty(dcEventImportantFile.getStatus()) && "1".equals(dcEventImportantFile.getStatus())) { diff --git a/zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml index f292981c..5e80d5f0 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml @@ -111,4 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + delete from dc_event_important_file where event_id = #{eventId} and type = #{type} + \ No newline at end of file