From 9c4d6326b352a6ed9ee0cf9bcb721df2d982952c Mon Sep 17 00:00:00 2001 From: 陈杰 <504987307@qq.com> Date: Tue, 16 Jun 2020 10:37:14 +0800 Subject: [PATCH] 渠道商品 编辑 --- src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java | 15 +++++++++++++++ src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java | 2 ++ src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java | 2 ++ src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java | 5 +++++ src/main/resources/mapper/ChannelProductMapper.xml | 11 +++++++++-- 6 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java index 9c02dfc..c5f97a7 100644 --- a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java +++ b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java @@ -191,6 +191,14 @@ public class ChannelController { if(channel.getChannelProductList()!=null&&channel.getChannelProductList().size()>0) { for(ChannelProduct channelProduct:channel.getChannelProductList()){ channelProduct.setChannelId(channel.getId()); + String r=Get(domain+"/University/getPackageById","id="+channelProduct.getProductId()); + JSONObject jsonObject= JSONObject.parseObject(r); + String data = jsonObject.getString("data"); + DiscountPackage model=JSON.parseObject(data,new TypeReference(){}); + channelProduct.setChannelTitle(model.getPackage_name()); + channelProduct.setChannelImg(model.getPhoto()); + channelProduct.setChannelRequire(model.getDescribe()); + channelProduct.setChannelExplain(model.getRequire()); channelProductService.insert(channelProduct); } } @@ -244,6 +252,13 @@ public class ChannelController { return new BaseDto(); } + @RequestMapping(value = "UpdateChannelProductMsg",method = RequestMethod.POST) + @ApiOperation(value = "编辑代理商品详情") + public BaseDto UpdateChannelProductMsg(@RequestBody ChannelProduct channelProduct){ + channelProductService.updateChannelProductMsg(channelProduct); + return new BaseDto(); + } + @RequestMapping(value = "GetBannerList",method = RequestMethod.GET) @ApiOperation(value = "获取Banner轮播图列表") public BaseDto> GetBannerList(int id){ diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java index 2abb2eb..f72ccbb 100644 --- a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java +++ b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelProductMapper.java @@ -14,4 +14,6 @@ public interface ChannelProductMapper { int deleteChannelProduct(int id); ChannelProduct getDetail(int id); + + int updateChannelProductMsg(ChannelProduct channelProduct); } diff --git a/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java b/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java index fcf60d2..0b93dc3 100644 --- a/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java +++ b/src/main/java/com/sincere/wechatbusiness/model/ChannelProduct.java @@ -27,6 +27,43 @@ public class ChannelProduct { private Date endTime ; private String title ; + private String channelTitle ; + private String channelImg ; + private String channelRequire ; + private String channelExplain ; + + public String getChannelTitle() { + return channelTitle; + } + + public void setChannelTitle(String channelTitle) { + this.channelTitle = channelTitle; + } + + public String getChannelImg() { + return channelImg; + } + + public void setChannelImg(String channelImg) { + this.channelImg = channelImg; + } + + public String getChannelRequire() { + return channelRequire; + } + + public void setChannelRequire(String channelRequire) { + this.channelRequire = channelRequire; + } + + public String getChannelExplain() { + return channelExplain; + } + + public void setChannelExplain(String channelExplain) { + this.channelExplain = channelExplain; + } + public String getPromotionPrice() { return promotionPrice; } diff --git a/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java b/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java index 2a81b61..df53161 100644 --- a/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java +++ b/src/main/java/com/sincere/wechatbusiness/service/ChannelProductService.java @@ -14,4 +14,6 @@ public interface ChannelProductService { int deleteChannelProduct(int id); ChannelProduct getDetail(int id); + + int updateChannelProductMsg(ChannelProduct channelProduct); } diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java index dfcfb9e..6961407 100644 --- a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelProductServiceImpl.java @@ -27,4 +27,9 @@ public class ChannelProductServiceImpl implements ChannelProductService { @Override public ChannelProduct getDetail(int id){return channelProductMapper.getDetail(id);} + + @Override + public int updateChannelProductMsg(ChannelProduct channelProduct) { + return channelProductMapper.updateChannelProductMsg(channelProduct); + } } diff --git a/src/main/resources/mapper/ChannelProductMapper.xml b/src/main/resources/mapper/ChannelProductMapper.xml index e10df80..1ce51f7 100644 --- a/src/main/resources/mapper/ChannelProductMapper.xml +++ b/src/main/resources/mapper/ChannelProductMapper.xml @@ -22,11 +22,18 @@ - insert into channel_product (channelId,productId,product_name,price,img_url) - values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR} + insert into channel_product (channelId,productId,product_name,price,img_url,channel_title,channel_img,channel_require,channel_explain) + values (#{channelId,jdbcType=INTEGER},#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, + #{price,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{channelTitle},#{channelImg},#{channelRequire},#{channelExplain} ) + + update channel_product set channel_title = #{channelTitle} , channel_img =#{channelImg} , + channel_require =#{channelRequire} , channel_explain=#{channelExplain} + where id =#{id} + + update channel_product -- libgit2 0.21.0