| @@ -16,6 +16,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCouponSpread") | @RequestMapping("wxCouponSpread") | ||||
| @Api(description="推广接口") | @Api(description="推广接口") | ||||
| @@ -70,6 +72,22 @@ public class WxCouponSpreadController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponSpreadService.getById(id)); | return new ResultData(Result.SUCCESS,"查询成功",wxCouponSpreadService.getById(id)); | ||||
| } | } | ||||
| @ApiOperation("根据卡券id查询接口") | |||||
| @GetMapping("/findByCouponId") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData findByCouponId(Long id) { | |||||
| WxCouponSpread result = null; | |||||
| if(id!=null){ | |||||
| WxCouponSpread wxCouponSpread = new WxCouponSpread(); | |||||
| wxCouponSpread.setCouponId(id); | |||||
| List<WxCouponSpread> list = wxCouponSpreadService.findList(wxCouponSpread); | |||||
| if(!list.isEmpty()){ | |||||
| result = list.get(0); | |||||
| } | |||||
| } | |||||
| return new ResultData(Result.SUCCESS,"查询成功",result); | |||||
| } | |||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.domain.po.MallUserInfo; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
| @@ -65,6 +66,16 @@ public class WxCouponVerifyController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponVerifyService.getById(id)); | return new ResultData(Result.SUCCESS,"查询成功",wxCouponVerifyService.getById(id)); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("verify") | |||||
| public ResultData verify(@RequestBody WxCouponVerify wxCouponVerify) { | |||||
| MallUserInfo user =getUser(); | |||||
| wxCouponVerify.setBUserId(user.getId()); | |||||
| wxCouponVerify.setTenantId(user.getTenantId()); | |||||
| wxCouponVerifyService.saveOrUpdate(wxCouponVerify); | |||||
| return new ResultData(); | |||||
| } | |||||
| @@ -10,6 +10,9 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, String> { | |||||
| List<WxCoupon> findList(WxCoupon wxCoupon); | List<WxCoupon> findList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findEnableList(WxCoupon wxCoupon); | |||||
| @@ -16,6 +16,16 @@ public interface WxCouponService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -37,12 +37,20 @@ public interface WxCouponSpreadService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 根据实体查询不分页 | |||||
| * | |||||
| * @param | |||||
| */ | |||||
| List<WxCouponSpread> findList(WxCouponSpread record); | |||||
| } | } | ||||
| @@ -23,6 +23,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCoupon getById(Long id) { | public WxCoupon getById(Long id) { | ||||
| return wxCouponMapper.selectByPrimaryKey(id); | return wxCouponMapper.selectByPrimaryKey(id); | ||||
| @@ -43,12 +43,12 @@ public class WxCouponSpreadServiceImpl implements WxCouponSpreadService { | |||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCouponSpreadMapper.deleteByPrimaryKey(id); | wxCouponSpreadMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponSpread> findList(WxCouponSpread record) { | |||||
| return wxCouponSpreadMapper.findList(record); | |||||
| } | |||||
| } | } | ||||
| @@ -180,12 +180,164 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <sql id="findEnableConditions"> | |||||
| 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 != sendStartDate "> | |||||
| and `send_start_date` = #{sendStartDate} | |||||
| </if> | |||||
| <if test=" null != sendEndDate "> | |||||
| and `send_end_date` = #{sendEndDate} | |||||
| </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` in (0,1,2) | |||||
| </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 | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findEnableList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon | |||||
| <include refid="findEnableConditions" /> | |||||
| </select> | |||||