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