Browse Source

成果需求删除

wanghui 7 years ago
parent
commit
b117899793

+ 3 - 2
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -138,7 +138,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	private void disposeAchievementPublish(Achievement a,List<String> webPages,List<String> appPages,boolean delete){
 		if(delete){
 			if(null != webPages && webPages.size()>0){
-				achievementPublishMapper.batchDeleteByAchievementId(a.getId());
+				achievementPublishMapper.deleteByAchievementId(a.getId());
 			}
 		}
 		AchievementPublish ap = null;
@@ -200,6 +200,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	public int deleteByPrimaryKey(List<String> id) {
 		achievementKeywordMapper.batchDeleteByAchievementIds(id);
 		achievementDemandMapper.batchDeleteByAchievementIds(id);
+		achievementPublishMapper.batchDeleteByAchievementIds(id);
 		for (String s : id) {
 			Achievement a = achievementMapper.selectByPrimaryKey(s);
 			if (null != a && AchievementAuditStatus.AUDITED.getCode().equals(a.getAuditStatus())
@@ -408,7 +409,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 //		}
 		achievementDemandMapper.deleteByAchievementId(a.getId());
 		achievementKeywordMapper.batchDeleteByAchievementId(a.getId());
-		achievementPublishMapper.batchDeleteByAchievementId(a.getId());
+		achievementPublishMapper.deleteByAchievementId(a.getId());
 		int i=0;
 		i=achievementMapper.updateByPrimaryKeySelective(a);
 		if (StringUtils.isNotBlank(a.getOwnerId())) {

+ 3 - 1
src/main/java/com/goafanti/common/dao/AchievementPublishMapper.java

@@ -96,7 +96,9 @@ public interface AchievementPublishMapper {
 
 	int checkExisting(AchievementPublish a);
 	
-	int batchDeleteByAchievementId(String id) ;
+	int batchDeleteByAchievementIds(List<String> id) ;
 	
 	List<String>getPublishPagesById(String id);
+
+	int deleteByAchievementId(String id);
 }

+ 3 - 1
src/main/java/com/goafanti/common/dao/DemandPublishMapper.java

@@ -78,5 +78,7 @@ public interface DemandPublishMapper {
 	
 	List<DemandPublish> selectPublishPages(String demandId);
 
-	int batchDeleteByDemandId(String id);
+	int batchDeleteByDemandIds(List<String> id);
+
+	int deleteByDemandId(String id);
 }

+ 8 - 1
src/main/java/com/goafanti/common/mapper/AchievementPublishMapper.xml

@@ -436,10 +436,17 @@ where 1=1
 	 	and publish_page= #{publishPage,jdbcType=VARCHAR}
 	 </select>
 	 
-	  <delete id="batchDeleteByAchievementId" parameterType="java.lang.String">
+	  <delete id="deleteByAchievementId" parameterType="java.lang.String">
 	 	delete from achievement_publish where achievement_id = #{id,jdbcType=VARCHAR}
 	 </delete>
 	 
+	 <delete id="batchDeleteByAchievementIds" parameterType="java.util.List">
+	 	 delete from achievement_publish where achievement_id in
+        <foreach item="item" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+	 </delete>
+	 
 	 <select id="getPublishPagesById" resultType="java.lang.String">
 	 select publish_page from achievement_publish ap
 	 where ap.achievement_id = #{id}

+ 8 - 1
src/main/java/com/goafanti/common/mapper/DemandPublishMapper.xml

@@ -442,7 +442,14 @@ where 1=1
 	 	select id,publish_client,publish_page from demand_publish where demand_id = #{demandId,jdbcType=VARCHAR}
 	 </select>
 	 
-	 <delete id="batchDeleteByDemandId" parameterType="java.lang.String">
+	 <delete id="batchDeleteByDemandIds" parameterType="java.lang.String">
+	 	 delete from demand_publish where demand_id in
+        <foreach item="item" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+	 </delete>
+	 
+	  <delete id="deleteByDemandId" parameterType="java.lang.String">
 	 	delete from demand_publish where demand_id = #{demandId,jdbcType=VARCHAR}
 	 </delete>
 </mapper>

+ 2 - 1
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -135,6 +135,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	public int deleteByPrimaryKey(List<String> id) {
 		demandKeywordMapper.batchDeleteByDemandIds(id);
 		achievementDemandMapper.batchDeleteByDemandIds(id);
+		demandPublishMapper.batchDeleteByDemandIds(id);
 		for (String s : id) {
 			Demand d = demandMapper.selectByPrimaryKey(s);
 			if (null != d && DemandAuditStatus.AUDITED.getCode().equals(d.getAuditStatus())
@@ -498,7 +499,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	private void disposeDemandPublish(Demand d,List<String> webPages,List<String> appPages,boolean delete){
 		if(delete){
 			if(null != webPages && webPages.size()>0){
-				demandPublishMapper.batchDeleteByDemandId(d.getId());
+				demandPublishMapper.deleteByDemandId(d.getId());
 			}
 		}
 		DemandPublish dp = null;