| @@ -169,10 +169,8 @@ public class WxCouponController extends BaseController | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setStatus(0); | wxCoupon.setStatus(0); | ||||
| PageInfo<WxCoupon> page = null; | |||||
| page = wxCouponService.findCanSendList(wxCoupon, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | |||||
| } | } | ||||
| @@ -63,7 +63,7 @@ public class WxCampaignController extends BaseController | |||||
| WxCoupon wxCoupon = new WxCoupon(); | WxCoupon wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setIds(list); | wxCoupon.setIds(list); | ||||
| wxCoupon.setStatus(1); | |||||
| wxCoupon.setStatus(0); | |||||
| List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | ||||
| wxCampaign.setCoupons(couponlist); | wxCampaign.setCoupons(couponlist); | ||||
| } | } | ||||
| @@ -29,11 +29,38 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("根据id(coupon)查询接口") | |||||
| @GetMapping("/detailC") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "couponId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData detail(String couponId) { | |||||
| if (StringUtils.isBlank(couponId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||||
| } | |||||
| Long couponIdL = 0L; | |||||
| try { | |||||
| couponIdL = Long.valueOf(couponId); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("id转换失败" + couponId); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponId); | |||||
| } | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setId(couponIdL); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCoupon); | |||||
| if (wxCouponCVo == null) | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| return new ResultData(wxCouponCVo); | |||||
| } | |||||
| @ApiOperation("根据id(couponChannel)查询接口") | @ApiOperation("根据id(couponChannel)查询接口") | ||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | ||||
| public ResultData detail(String couponChannelId) { | |||||
| public ResultData detailC(String couponChannelId) { | |||||
| if (StringUtils.isBlank(couponChannelId)) { | if (StringUtils.isBlank(couponChannelId)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | ||||
| } | } | ||||
| @@ -11,10 +11,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findList(WxCoupon wxCoupon); | List<WxCoupon> findList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findCanSendList(WxCoupon wxCoupon); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | ||||
| WxCouponCVo selectDetailForCUserC(WxCoupon wxCoupon); | |||||
| } | } | ||||
| @@ -48,14 +48,9 @@ public interface WxCouponService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * | |||||
| */ | |||||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel record); | WxCouponCVo selectDetailForCUser(WxCouponChannel record); | ||||
| WxCouponCVo selectDetailForCUser(WxCoupon record); | |||||
| ResultData updateCoupon(WxCoupon wxCoupon); | ResultData updateCoupon(WxCoupon wxCoupon); | ||||
| } | } | ||||
| @@ -65,15 +65,15 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| wxCouponMapper.deleteByPrimaryKey(id); | wxCouponMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCanSendList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | ||||
| return wxCouponMapper.selectDetailForCUser(record); | return wxCouponMapper.selectDetailForCUser(record); | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponCVo selectDetailForCUser(WxCoupon record) { | |||||
| return wxCouponMapper.selectDetailForCUserC(record); | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional | @Transactional | ||||
| @@ -171,142 +171,7 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <sql id="findCanSendConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != coverImg "> | |||||
| and `cover_img` like concat('%', #{coverImg},'%') | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != salePrice "> | |||||
| and `sale_price` = #{salePrice} | |||||
| </if> | |||||
| <if test=" null != usePrice "> | |||||
| and `use_price` = #{usePrice} | |||||
| </if> | |||||
| <if test=" null != useLimitQuantity "> | |||||
| and `use_limit_quantity` = #{useLimitQuantity} | |||||
| </if> | |||||
| <if test=" null != targetAd "> | |||||
| and `target_ad` = #{targetAd} | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| <if test=" null != validType "> | |||||
| and `valid_type` = #{validType} | |||||
| </if> | |||||
| <if test=" null != validStartDate "> | |||||
| and `valid_start_date` = #{validStartDate} | |||||
| </if> | |||||
| <if test=" null != validEndDate "> | |||||
| and `valid_end_date` = #{validEndDate} | |||||
| </if> | |||||
| <if test=" null != validDays "> | |||||
| and `valid_days` = #{validDays} | |||||
| </if> | |||||
| <if test=" null != detail "> | |||||
| and `detail` like concat('%', #{detail},'%') | |||||
| </if> | |||||
| <if test=" null != price "> | |||||
| and `price` = #{price} | |||||
| </if> | |||||
| <if test=" null != remainInventory "> | |||||
| and `remain_inventory` = #{remainInventory} | |||||
| </if> | |||||
| <if test=" null != inventory "> | |||||
| and `inventory` = #{inventory} | |||||
| </if> | |||||
| <if test=" null != remark "> | |||||
| and `remark` like concat('%', #{remark},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` =0 | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != business "> | |||||
| and `business` like concat('%', #{business},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon | select <include refid="allColumns" /> from wx_coupon | ||||
| @@ -314,12 +179,6 @@ | |||||
| </select> | </select> | ||||
| <select id="findCanSendList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon | |||||
| <include refid="findCanSendConditions" /> | |||||
| </select> | |||||
| <resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo"> | <resultMap id="CUserResultMap" type="com.simple.domain.vo.WxCouponCVo"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| @@ -398,6 +257,31 @@ | |||||
| and cc.target_ad = #{targetAd} | and cc.target_ad = #{targetAd} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <sql id="allCUserColumns2"> | |||||
| c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||||
| m.img_url,m.name,m.link_phone,m.status, | |||||
| s.addr,s.shop_number,s.baidu_poi, | |||||
| mb.building_name,mf.floor_name | |||||
| </sql> | |||||
| <select id="selectDetailForCUserC" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||||
| select <include refid="allCUserColumns2" /> | |||||
| from | |||||
| wx_coupon c,wx_merchant m | |||||
| left join wx_merchant_shop ms on ms.merchant_id = m.id | |||||
| left join wx_shop s on ms.shop_id = s.id | |||||
| left join wx_mall_building mb on s.building = mb.id | |||||
| left join wx_mall_floor mf on s.floor = mf.id | |||||
| where c.merchant_id = m.id | |||||
| <if test=" null != id "> | |||||
| and c.id = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and c.tenant_id = #{tenantId} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||