| @@ -66,17 +66,21 @@ public class WxCouponController extends BaseController | |||||
| List<Long> ids = wxCouponList.stream().map(p->p.getId()).collect(Collectors.toList()); | List<Long> ids = wxCouponList.stream().map(p->p.getId()).collect(Collectors.toList()); | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setTenantId(getTenantId()); | wxCouponChannel.setTenantId(getTenantId()); | ||||
| wxCouponChannel.setIds(ids); | |||||
| wxCouponChannel.setCouponIds(ids); | |||||
| //上架状态 | //上架状态 | ||||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel,1,5).getList(); | List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel,1,5).getList(); | ||||
| if(!list.isEmpty()){ | if(!list.isEmpty()){ | ||||
| Map<Long, List<WxCouponChannel>> groupBy = list.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); | Map<Long, List<WxCouponChannel>> groupBy = list.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); | ||||
| for (WxCoupon temp:wxCouponList) { | for (WxCoupon temp:wxCouponList) { | ||||
| List<String> channels=new ArrayList<>(); | |||||
| List<Integer> channels=new ArrayList<>(); | |||||
| if(groupBy.get(temp.getId())!=null){ | if(groupBy.get(temp.getId())!=null){ | ||||
| String sss = JSON.toJSONString(groupBy.get(temp.getId())); | |||||
| temp.setChannels(sss); | |||||
| for (WxCouponChannel tempchannel:groupBy.get(temp.getId())) { | |||||
| channels.add(tempchannel.getTargetAd()); | |||||
| } | |||||
| } | } | ||||
| String sss = JSON.toJSONString(channels); | |||||
| temp.setChannels(sss); | |||||
| } | } | ||||
| } | } | ||||
| @@ -17,6 +17,9 @@ public class WxCouponChannel implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @Transient | |||||
| protected List<Long> couponIds; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -151,6 +154,13 @@ public class WxCouponChannel implements Serializable { | |||||
| public void setUpdateDate(Date _updateDate) { | public void setUpdateDate(Date _updateDate) { | ||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public List<Long> getCouponIds() { | |||||
| return couponIds; | |||||
| } | |||||
| public void setCouponIds(List<Long> couponIds) { | |||||
| this.couponIds = couponIds; | |||||
| } | |||||
| @@ -82,6 +82,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponService.saveOrUpdate(wxCoupon); | wxCouponService.saveOrUpdate(wxCoupon); | ||||
| } | } | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setStatus(0); | |||||
| wxCouponChannel.setBeginTime(beginTime); | wxCouponChannel.setBeginTime(beginTime); | ||||
| wxCouponChannel.setEndTime(endTime); | wxCouponChannel.setEndTime(endTime); | ||||
| wxCouponChannel.setCouponId(couponid); | wxCouponChannel.setCouponId(couponid); | ||||
| @@ -95,6 +95,12 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != couponIds "> | |||||
| and coupon_id in | |||||
| <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")"> | |||||
| #{couponIdsItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| @@ -102,6 +108,12 @@ | |||||
| select <include refid="allColumns" /> from wx_coupon_channel | select <include refid="allColumns" /> from wx_coupon_channel | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findListByCouponIds" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon_channel | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="findVoList" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | <select id="findVoList" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | ||||