Commit e903131000e09b0484068e10947c5dbbc9c92707

Authored by 陈杰
1 parent e4bf0169
Exists in master

内容下发

src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
... ... @@ -80,14 +80,17 @@ public class ChannelController {
80 80 Attention attention = attentionService.getDetail(copyDto.getSourceId());
81 81 List<Catalog> catalogs = catalogService.getList(copyDto.getSourceId());
82 82 for(Integer channelId : copyDto.getTargetIdList()){
  83 + bannerService.deleteChannelBanner(channelId);
83 84 for(Banner banner : banners){
84 85 banner.setChannelId(channelId);
85 86 bannerService.copy(banner);
86 87 }
  88 + attentionService.deleteAttention(channelId);
87 89 if(attention != null){
88 90 attention.setChannelId(channelId);
89 91 attentionService.insert(attention);
90 92 }
  93 + catalogService.deleteCatalog(channelId);
91 94 for(Catalog catalog : catalogs){
92 95 catalog.setChannelId(channelId);
93 96 catalogService.insert(catalog);
... ... @@ -102,6 +105,8 @@ public class ChannelController {
102 105 List<Banner> banners = bannerService.getList(copyDto.getSourceId());
103 106 List<BannerNext> bannerNexts = bannerService.getBannerNextList(copyDto.getSourceId());
104 107 for(Integer channelId : copyDto.getTargetIdList()){
  108 + bannerService.deleteChannelBanner(channelId);
  109 + bannerService.deleteChannelBannerNext(channelId);
105 110 for(Banner banner : banners){
106 111 banner.setChannelId(channelId);
107 112 bannerService.copy(banner);
... ...
src/main/java/com/sincere/wechatbusiness/mapper/AttentionMapper.java
... ... @@ -8,4 +8,6 @@ public interface AttentionMapper {
8 8 int insert(Attention attention);
9 9  
10 10 int update(Attention attention);
  11 +
  12 + int deleteAttention(int channelId);
11 13 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/BannerMapper.java
... ... @@ -14,4 +14,6 @@ public interface BannerMapper {
14 14 int deleteBanner(int id);
15 15  
16 16 int copy(Banner banner);
  17 +
  18 + int deleteChannelBanner(int channelId);
17 19 }
... ...
src/main/java/com/sincere/wechatbusiness/mapper/BannerNextMapper.java
... ... @@ -16,6 +16,8 @@ public interface BannerNextMapper {
16 16  
17 17 int copy(BannerNext record);
18 18  
  19 + int deleteChannelBanner(int channelId);
  20 +
19 21 int insertSelective(BannerNext record);
20 22  
21 23 BannerNext selectByPrimaryKey(Integer id);
... ...
src/main/java/com/sincere/wechatbusiness/mapper/CatalogMapper.java
... ... @@ -12,4 +12,6 @@ public interface CatalogMapper {
12 12 int update(Catalog catalog);
13 13  
14 14 List<Catalog> getList(int id);
  15 +
  16 + int deleteCatalog(int channelId);
15 17 }
... ...
src/main/java/com/sincere/wechatbusiness/service/AttentionService.java
... ... @@ -8,4 +8,6 @@ public interface AttentionService {
8 8 int insert(Attention attention);
9 9  
10 10 int update(Attention attention);
  11 +
  12 + int deleteAttention(int channelId);
11 13 }
... ...
src/main/java/com/sincere/wechatbusiness/service/BannerService.java
... ... @@ -16,6 +16,8 @@ public interface BannerService {
16 16  
17 17 int deleteBanner(int id);
18 18  
  19 + int deleteChannelBanner(int channelId);
  20 +
19 21  
20 22 List<BannerNext> getBannerNextList(int channelId);
21 23  
... ... @@ -27,4 +29,5 @@ public interface BannerService {
27 29  
28 30 int copyBannerNext(BannerNext bannerNext);
29 31  
  32 + int deleteChannelBannerNext(int channelId);
30 33 }
... ...
src/main/java/com/sincere/wechatbusiness/service/CatalogService.java
... ... @@ -12,4 +12,6 @@ public interface CatalogService {
12 12 int update(Catalog catalog);
13 13  
14 14 List<Catalog> getList(int id);
  15 +
  16 + int deleteCatalog(int channelId);
15 17 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/AttentionServiceImpl.java
... ... @@ -19,4 +19,9 @@ public class AttentionServiceImpl implements AttentionService {
19 19  
20 20 @Override
21 21 public int update(Attention attention){return attentionMapper.update(attention);}
  22 +
  23 + @Override
  24 + public int deleteAttention(int channelId) {
  25 + return attentionMapper.deleteAttention(channelId);
  26 + }
22 27 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/BannerServiceImpl.java
... ... @@ -32,6 +32,11 @@ public class BannerServiceImpl implements BannerService {
32 32 public int deleteBanner(int id){return bannerMapper.deleteBanner(id);}
33 33  
34 34 @Override
  35 + public int deleteChannelBanner(int channelId) {
  36 + return bannerMapper.deleteChannelBanner(channelId);
  37 + }
  38 +
  39 + @Override
35 40 public List<BannerNext> getBannerNextList(int channelId) {
36 41 return bannerNextMapper.getByChannel(channelId);
37 42 }
... ... @@ -60,4 +65,9 @@ public class BannerServiceImpl implements BannerService {
60 65 public int copyBannerNext(BannerNext bannerNext) {
61 66 return bannerNextMapper.copy(bannerNext);
62 67 }
  68 +
  69 + @Override
  70 + public int deleteChannelBannerNext(int channelId) {
  71 + return bannerNextMapper.deleteChannelBanner(channelId);
  72 + }
63 73 }
... ...
src/main/java/com/sincere/wechatbusiness/service/impl/CatalogServiceImpl.java
... ... @@ -24,4 +24,9 @@ public class CatalogServiceImpl implements CatalogService {
24 24  
25 25 @Override
26 26 public List<Catalog> getList(int id){return catalogMapper.getList(id);}
  27 +
  28 + @Override
  29 + public int deleteCatalog(int channelId) {
  30 + return catalogMapper.deleteCatalog(channelId);
  31 + }
27 32 }
... ...
src/main/resources/mapper/AttentionMapper.xml
... ... @@ -16,6 +16,10 @@
16 16 select * from attention where channelId=#{id} and state=1
17 17 </select>
18 18  
  19 + <update id="deleteAttention" parameterType="java.lang.Integer">
  20 + update attention set state=0 where channelId=#{channelId}
  21 + </update>
  22 +
19 23 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.Attention">
20 24 insert into attention (channelId, logo,name,content,img_url)
21 25 values (#{channelId,jdbcType=INTEGER}, #{logo,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR})
... ...
src/main/resources/mapper/BannerMapper.xml
... ... @@ -42,4 +42,8 @@
42 42 <update id="deleteBanner" parameterType="java.lang.Integer">
43 43 update banner set state=0 where id = #{id}
44 44 </update>
  45 +
  46 + <update id="deleteChannelBanner" parameterType="java.lang.Integer">
  47 + update banner set state=0 where channelId = #{channelId}
  48 + </update>
45 49 </mapper>
46 50 \ No newline at end of file
... ...
src/main/resources/mapper/BannerNextMapper.xml
... ... @@ -16,6 +16,10 @@
16 16 select * from banner_next where channel_id = #{channelId} order by create_time
17 17 </select>
18 18  
  19 + <update id="deleteChannelBanner" parameterType="java.lang.Integer">
  20 + update banner_next set state=0 where channel_id = #{channelId}
  21 + </update>
  22 +
19 23 <update id="update" parameterType="com.sincere.wechatbusiness.model.BannerNext">
20 24 update banner_next
21 25 <trim prefix="set" suffixOverrides=",">
... ...
src/main/resources/mapper/CatalogMapper.xml
... ... @@ -14,6 +14,10 @@
14 14 select * from catalog where channelId=#{channelId} and state=1 and sort!=6 order by sort
15 15 </select>
16 16  
  17 + <update id="deleteCatalog" parameterType="java.lang.Integer">
  18 + update catalog set state = 0 where channelId=#{channelId}
  19 + </update>
  20 +
17 21 <select id="getDetail" parameterType="com.sincere.wechatbusiness.model.Catalog" resultMap="CatalogMap">
18 22 select * from catalog where channelId=#{channelId} and sort=#{sort} and state=1
19 23 </select>
... ...
src/main/resources/mapper/ChannelProductMapper.xml
... ... @@ -14,7 +14,12 @@
14 14 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
15 15 <result column="promotion_price" jdbcType="VARCHAR" property="promotionPrice" />
16 16 <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  17 + <result column="channel_title" jdbcType="VARCHAR" property="channelTitle" />
  18 + <result column="channel_img" jdbcType="VARCHAR" property="channelImg" />
  19 + <result column="channel_require" jdbcType="VARCHAR" property="channelRequire" />
  20 + <result column="channel_explain" jdbcType="VARCHAR" property="channelExplain" />
17 21 <result column="title" jdbcType="VARCHAR" property="title" />
  22 +
18 23 </resultMap>
19 24  
20 25 <select id="getList" parameterType="java.lang.Integer" resultMap="ChannelProductMap">
... ...