| @@ -1,6 +1,7 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponCVo; | import com.simple.domain.vo.WxCouponCVo; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| @@ -29,12 +30,10 @@ public class WxCouponController extends BaseController { | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParam(name = "couponId", value = "id", dataType = "String", paramType = "query", required = true) | |||||
| public ResultData detail(String couponId) { | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setId(Long.valueOf(couponId)); | |||||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCoupon); | |||||
| public ResultData detail(@ModelAttribute WxCouponChannel wxCouponChannel) { | |||||
| if(wxCouponChannel == null) wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | |||||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCouponChannel); | |||||
| if (wxCouponCVo == null) | if (wxCouponCVo == null) | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| @@ -2,6 +2,7 @@ package com.simple.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponCVo; | import com.simple.domain.vo.WxCouponCVo; | ||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| @@ -15,6 +16,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findCanSendList(WxCoupon wxCoupon); | List<WxCoupon> findCanSendList(WxCoupon wxCoupon); | ||||
| WxCouponCVo selectDetailForCUser(WxCoupon wxCoupon); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | |||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.simple.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponCVo; | import com.simple.domain.vo.WxCouponCVo; | ||||
| public interface WxCouponService { | public interface WxCouponService { | ||||
| @@ -61,6 +62,6 @@ public interface WxCouponService { | |||||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | ||||
| WxCouponCVo selectDetailForCUser(WxCoupon record); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel record); | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponCVo; | import com.simple.domain.vo.WxCouponCVo; | ||||
| import com.simple.mapper.WxCouponMapper; | import com.simple.mapper.WxCouponMapper; | ||||
| import com.simple.service.WxCouponService; | import com.simple.service.WxCouponService; | ||||
| @@ -62,7 +63,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCouponCVo selectDetailForCUser(WxCoupon record) { | |||||
| public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | |||||
| return wxCouponMapper.selectDetailForCUser(record); | return wxCouponMapper.selectDetailForCUser(record); | ||||
| } | } | ||||
| @@ -510,30 +510,24 @@ | |||||
| mb.building_name,mf.floor_name | mb.building_name,mf.floor_name | ||||
| </sql> | </sql> | ||||
| <sql id="listCUserColumns"> | |||||
| c.id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.remain_inventory,c.inventory,c.business, | |||||
| m.name | |||||
| </sql> | |||||
| <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||||
| <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCouponChannel" resultMap="CUserResultMap"> | |||||
| select <include refid="allCUserColumns" /> | select <include refid="allCUserColumns" /> | ||||
| from wx_coupon c,wx_merchant m, | |||||
| from wx_coupon_channel cc, | |||||
| wx_coupon c,wx_merchant m, | |||||
| wx_shop s,wx_merchant_shop ms, | wx_shop s,wx_merchant_shop ms, | ||||
| wx_mall_building mb, | wx_mall_building mb, | ||||
| wx_mall_floor mf | wx_mall_floor mf | ||||
| where c.merchant_id = m.id | where c.merchant_id = m.id | ||||
| <if test=" null != id "> | |||||
| and c.id = #{id} | |||||
| <if test=" null != couponId "> | |||||
| and c.id = #{couponId} | |||||
| and cc.coupon_id = #{couponId} | |||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and c.tenant_id = #{tenantId} | and c.tenant_id = #{tenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != business "> | |||||
| and c.business like concat('%', #{business},'%') | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and c.type = #{type} | |||||
| <if test=" null != targetAd "> | |||||
| and cc.target_ad = #{targetAd} | |||||
| </if> | </if> | ||||
| and ms.merchant_id = m.id | and ms.merchant_id = m.id | ||||
| and ms.shop_id = s.id | and ms.shop_id = s.id | ||||