| @@ -39,5 +39,4 @@ public class WxTopicController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import javax.persistence.Id; | |||||
| import javax.persistence.Table; | import javax.persistence.Table; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.util.Date; | |||||
| @Table(name = "wx_coupon_topic") | @Table(name = "wx_coupon_topic") | ||||
| public class WxCouponTopic implements Serializable { | public class WxCouponTopic implements Serializable { | ||||
| @@ -19,6 +20,10 @@ public class WxCouponTopic implements Serializable { | |||||
| private String busType; | private String busType; | ||||
| @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="createtime") | |||||
| private Date createtime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||||
| private Date updatetime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷名称",name="couponName") | @io.swagger.annotations.ApiModelProperty(value="卷名称",name="couponName") | ||||
| @Transient | @Transient | ||||
| @@ -30,6 +35,23 @@ public class WxCouponTopic implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String couponId; | private String couponId; | ||||
| public Date getCreatetime() { | |||||
| return createtime; | |||||
| } | |||||
| public void setCreatetime(Date createtime) { | |||||
| this.createtime = createtime; | |||||
| } | |||||
| public Date getUpdatetime() { | |||||
| return updatetime; | |||||
| } | |||||
| public void setUpdatetime(Date updatetime) { | |||||
| this.updatetime = updatetime; | |||||
| } | |||||
| public String getCouponName() { | public String getCouponName() { | ||||
| return couponName; | return couponName; | ||||
| } | } | ||||
| @@ -52,14 +52,14 @@ public class WxTopic implements Serializable { | |||||
| /*商品列表**/ | /*商品列表**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="商品列表",name="couponList") | @io.swagger.annotations.ApiModelProperty(value="商品列表",name="couponList") | ||||
| @Transient | @Transient | ||||
| private List<WxCouponTopic> couponList; | |||||
| private List<WxCoupon> couponList; | |||||
| public List<WxCouponTopic> getCouponList() { | |||||
| public List<WxCoupon> getCouponList() { | |||||
| return couponList; | return couponList; | ||||
| } | } | ||||
| public void setCouponList(List<WxCouponTopic> couponList) { | |||||
| public void setCouponList(List<WxCoupon> couponList) { | |||||
| this.couponList = couponList; | this.couponList = couponList; | ||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponTopic; | import com.iformall.domain.po.WxCouponTopic; | ||||
| import com.iformall.domain.po.WxTopic; | import com.iformall.domain.po.WxTopic; | ||||
| @@ -10,5 +11,5 @@ public interface WxCouponTopicMapper extends CommonMapper<WxCouponTopic, String> | |||||
| void del(WxCouponTopic couponTopic); | void del(WxCouponTopic couponTopic); | ||||
| List<WxCouponTopic> findList(WxTopic wxTopic); | |||||
| List<WxCoupon> findList(WxTopic wxTopic); | |||||
| } | } | ||||
| @@ -38,7 +38,7 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| public WxTopic show(WxTopic record) { | public WxTopic show(WxTopic record) { | ||||
| WxTopic wxTopic = wxTopicMapper.show(record); | WxTopic wxTopic = wxTopicMapper.show(record); | ||||
| if(wxTopic != null) { | if(wxTopic != null) { | ||||
| wxTopic.setCouponList(wxCouponTopicMapper.findList(record)); | |||||
| wxTopic.setCouponList(wxCouponTopicMapper.findList(wxTopic)); | |||||
| } | } | ||||
| return wxTopic; | return wxTopic; | ||||
| } | } | ||||
| @@ -18,7 +18,41 @@ | |||||
| <result column="couponPic" property="couponPic" /> | <result column="couponPic" property="couponPic" /> | ||||
| <result column="couponId" property="couponId" /> | <result column="couponId" property="couponId" /> | ||||
| </resultMap> | </resultMap> | ||||
| <resultMap id="couponResultMap" type="com.iformall.domain.po.WxCoupon"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||||
| <result column="valid_type" jdbcType="INTEGER" property="validType"/> | |||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate"/> | |||||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||||
| <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | |||||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||||
| </resultMap> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| @@ -44,8 +78,8 @@ | |||||
| order by createtime desc | order by createtime desc | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | |||||
| select ct.*,wc.title as couponName,wc.`cover_img` as couponPic,wc.id as couponId from wx_coupon_topic ct left join | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="couponResultMap"> | |||||
| select wc.*,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 | wx_coupon wc on wc.id = ct.bus_id | ||||
| where ct.`topic_id` = #{id} | where ct.`topic_id` = #{id} | ||||
| </select> | </select> | ||||
| @@ -48,10 +48,9 @@ | |||||
| </select> | </select> | ||||
| <select id="show" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | <select id="show" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | ||||
| select t.*,wc.title as couponName,wc.`cover_img` as couponPic,wc.id as couponId | |||||
| from wx_topic t left join wx_coupon_topic ct on t.id = ct.`topic_id` | |||||
| left join wx_coupon wc on ct.bus_id = wc.id | |||||
| where t.status = 1 order by t.createtime desc limit 1 | |||||
| select * from wx_topic t where t.status = 1 | |||||
| and now() >= t.begin_time and now() <= t.end_time | |||||
| order by t.createtime desc limit 1 | |||||
| </select> | </select> | ||||