| @@ -39,14 +39,5 @@ public class WxTopicController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @GetMapping("show") | |||||
| public ResultData show() { | |||||
| logger.debug("[" + getIpAddr() + "] WxTopicController::show"); | |||||
| WxTopic wxTopic = new WxTopic(); | |||||
| String tenantId = getTenantId(); | |||||
| wxTopic.setTenantId(tenantId); | |||||
| return new ResultData(wxTopicService.show(wxTopic)); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,32 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import com.iformall.service.WxTopicService; | |||||
| import io.swagger.annotations.Api; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("topic") | |||||
| @Api(description = "专题相关接口") | |||||
| public class WxTopicController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxTopicService wxTopicService; | |||||
| @GetMapping("show") | |||||
| public ResultData show() { | |||||
| logger.debug("[" + getIpAddr() + "] WxTopicController::show"); | |||||
| WxTopic wxTopic = new WxTopic(); | |||||
| String tenantId = getTenantId(); | |||||
| wxTopic.setTenantId(tenantId); | |||||
| return new ResultData(wxTopicService.show(wxTopic)); | |||||
| } | |||||
| } | |||||
| @@ -49,7 +49,6 @@ public class WxCoupon implements Serializable { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @Transient | @Transient | ||||
| private String salePriceStr; | private String salePriceStr; | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @Table(name = "wx_coupon_topic") | @Table(name = "wx_coupon_topic") | ||||
| @@ -19,6 +20,40 @@ public class WxCouponTopic implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="busId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="busId") | ||||
| private String busId; | private String busId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卷名称",name="couponName") | |||||
| @Transient | |||||
| private String couponName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷封面图片",name="couponPic") | |||||
| @Transient | |||||
| private String couponPic; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷id",name="couponId") | |||||
| @Transient | |||||
| private String couponId; | |||||
| public String getCouponName() { | |||||
| return couponName; | |||||
| } | |||||
| public void setCouponName(String couponName) { | |||||
| this.couponName = couponName; | |||||
| } | |||||
| public String getCouponPic() { | |||||
| return couponPic; | |||||
| } | |||||
| public void setCouponPic(String couponPic) { | |||||
| this.couponPic = couponPic; | |||||
| } | |||||
| public String getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(String couponId) { | |||||
| this.couponId = couponId; | |||||
| } | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -47,49 +47,22 @@ public class WxTopic implements Serializable { | |||||
| /*优惠券ids**/ | /*优惠券ids**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="优惠券ids",name="couponIds") | @io.swagger.annotations.ApiModelProperty(value="优惠券ids",name="couponIds") | ||||
| private String couponIds; | |||||
| @Transient | @Transient | ||||
| private String couponName; | |||||
| @Transient | |||||
| private String couponPic; | |||||
| private String couponIds; | |||||
| /*商品列表**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商品列表",name="couponList") | |||||
| @Transient | @Transient | ||||
| private String couponId; | |||||
| public String getCouponName() { | |||||
| return couponName; | |||||
| } | |||||
| public void setCouponName(String couponName) { | |||||
| this.couponName = couponName; | |||||
| } | |||||
| private List<WxCouponTopic> couponList; | |||||
| public String getCouponPic() { | |||||
| return couponPic; | |||||
| } | |||||
| public void setCouponPic(String couponPic) { | |||||
| this.couponPic = couponPic; | |||||
| } | |||||
| public String getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(String couponId) { | |||||
| this.couponId = couponId; | |||||
| } | |||||
| public List<WxCoupon> getCouponList() { | |||||
| public List<WxCouponTopic> getCouponList() { | |||||
| return couponList; | return couponList; | ||||
| } | } | ||||
| public void setCouponList(List<WxCoupon> couponList) { | |||||
| public void setCouponList(List<WxCouponTopic> couponList) { | |||||
| this.couponList = couponList; | this.couponList = couponList; | ||||
| } | } | ||||
| private List<WxCoupon> couponList; | |||||
| public String getCouponIds() { | public String getCouponIds() { | ||||
| return couponIds; | return couponIds; | ||||
| } | } | ||||
| @@ -2,9 +2,13 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCouponTopic; | import com.iformall.domain.po.WxCouponTopic; | ||||
| import com.iformall.domain.po.WxTopic; | |||||
| import java.util.List; | |||||
| public interface WxCouponTopicMapper extends CommonMapper<WxCouponTopic, String> { | public interface WxCouponTopicMapper extends CommonMapper<WxCouponTopic, String> { | ||||
| void del(WxCouponTopic couponTopic); | void del(WxCouponTopic couponTopic); | ||||
| List<WxCouponTopic> findList(WxTopic wxTopic); | |||||
| } | } | ||||
| @@ -36,7 +36,11 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| @Override | @Override | ||||
| public WxTopic show(WxTopic record) { | public WxTopic show(WxTopic record) { | ||||
| return wxTopicMapper.show(record); | |||||
| WxTopic wxTopic = wxTopicMapper.show(record); | |||||
| if(wxTopic != null) { | |||||
| wxTopic.setCouponList(wxCouponTopicMapper.findList(record)); | |||||
| } | |||||
| return wxTopic; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -14,6 +14,9 @@ | |||||
| <result column="status" property="status" /> | <result column="status" property="status" /> | ||||
| <result column="createtime" property="createtime" /> | <result column="createtime" property="createtime" /> | ||||
| <result column="updatetime" property="updatetime" /> | <result column="updatetime" property="updatetime" /> | ||||
| <result column="couponName" property="couponName" /> | |||||
| <result column="couponPic" property="couponPic" /> | |||||
| <result column="couponId" property="couponId" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -42,14 +45,16 @@ | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | ||||
| select * from wx_topic | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| select ct.*,wc.title as couponName,wc.`cover_img` as couponPic,wc.id as couponId from wx_coupon_topic ct left join | |||||
| wx_coupon wc on wc.id = ct.bus_id | |||||
| where ct.`topic_id` = #{id} | |||||
| </select> | </select> | ||||
| <delete id="del" parameterType="com.iformall.domain.po.WxCouponTopic"> | <delete id="del" parameterType="com.iformall.domain.po.WxCouponTopic"> | ||||
| delete from wx_coupon_topic where topic_id = #{topicId} | delete from wx_coupon_topic where topic_id = #{topicId} | ||||
| </delete> | </delete> | ||||
| </mapper> | </mapper> | ||||
| @@ -14,9 +14,7 @@ | |||||
| <result column="status" property="status" /> | <result column="status" property="status" /> | ||||
| <result column="createtime" property="createtime" /> | <result column="createtime" property="createtime" /> | ||||
| <result column="updatetime" property="updatetime" /> | <result column="updatetime" property="updatetime" /> | ||||
| <result column="couponName" property="couponName" /> | |||||
| <result column="couponPic" property="couponPic" /> | |||||
| <result column="couponId" property="couponId" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||