diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java index 323ebe76f..f65759037 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java @@ -9,6 +9,7 @@ import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxMerchant; import com.iformall.enums.EnumCouponStatus; +import com.iformall.enums.EnumCouponType; import com.iformall.enums.EnumCouponValidType; import com.iformall.enums.EnumMerchantStatus; import com.iformall.service.WxCouponChannelService; @@ -41,20 +42,14 @@ public class WxCouponController extends BaseController { @Autowired private WxCouponChannelService wxCouponChannelService; - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxCouponController::list"); + private ResultData listType(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize, Integer type) { if (null == wxCoupon) wxCoupon = new WxCoupon(); wxCoupon.setTenantId(getTenantId()); wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC); PageInfo page = null; if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) wxCoupon.setStatus(null); - page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); + page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize, type); List wxCouponList = page.getList(); @@ -93,10 +88,40 @@ public class WxCouponController extends BaseController { } } - return new ResultData(page); } + + @ApiOperation("分页列表接口") + @GetMapping("listCoupon") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData listCoupon(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxCouponController::listCoupon"); + return listType(wxCoupon, pageNum, pageSize, 0); //券列表 + } + + @ApiOperation("分页列表接口") + @GetMapping("listCard") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData listCard(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxCouponController::listCard"); + return listType(wxCoupon, pageNum, pageSize, EnumCouponType.CARD_MULTIMCH.getCode()); //卡列表 + } + + @ApiOperation("分页列表接口") + @GetMapping("list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxCouponController::list"); + return listType(wxCoupon, pageNum, pageSize, null); //全列表 + } + @ApiOperation("新增接口") @PostMapping("add") public ResultData add(@RequestBody WxCoupon wxCoupon) { @@ -131,21 +156,4 @@ public class WxCouponController extends BaseController { logger.debug("[" + getIpAddr() + "] WxCouponController::findById");; return new ResultData(wxCouponService.getVoById(id)); } - - - @ApiOperation("分页列表接口") - @GetMapping("send/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) - public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxCouponController::sendList"); - if (null == wxCoupon) wxCoupon = new WxCoupon(); - wxCoupon.setTenantId(getTenantId()); - wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); - - return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); - } - - } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java index b95ea15cb..cfe6d6784 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxUserCouponController.java @@ -37,4 +37,7 @@ public class WxUserCouponController extends BaseController { return new ResultData(Result.SUCCESS,"查询成功",wxUserCouponService.findList(wxUserCoupon.getcUserId(),wxUserCoupon.getCouponStatus())); } + + + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java index 02dc208ac..49064d20d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java @@ -10,6 +10,8 @@ import com.iformall.domain.po.WxCoupon; public interface WxCouponMapper extends CommonMapper { List findList(WxCoupon wxCoupon); + List findCardList(WxCoupon wxCoupon); + List findCouponList(WxCoupon wxCoupon); WxCouponCVo findVoDetail(@Param("id")Long id); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index c7ef52ed8..b6379dc55 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -17,15 +17,7 @@ public interface WxCouponService { * @param pageSize * @return */ - PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); - - - /** - * 不分页 - * @param record - * @return - */ - List findList(WxCoupon record); + PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type); /** * 根据Id获得实体 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 6e0c61e6f..20156a79b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -48,13 +48,16 @@ public class WxCouponServiceImpl implements WxCouponService { @Override - public PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); - } - - @Override - public List findList(WxCoupon record) { - return wxCouponMapper.findList(record); + public PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize, Integer type) { + if (type == null) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); + } + else if (type.equals(EnumCouponType.COUPON_MULTIMCH)) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCardList(record)); + } + else { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCouponList(record)); + } } @Override diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index e3869d40a..55f08d629 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -152,6 +152,244 @@ + + where `type` = 7 + + + and `id` = #{id} + + + + and `tenant_id` = #{tenantId} + + + + and `type` = #{type} + + + + and `cover_img` like concat('%', #{coverImg},'%') + + + + and `title` like concat('%', #{title},'%') + + + + and `sub_title` like concat('%', #{subTitle},'%') + + + + and `sale_price` = #{salePrice} + + + + and `use_price` = #{usePrice} + + + + and `use_limit_quantity` = #{useLimitQuantity} + + + + and `send_type` = #{sendType} + + + + and `valid_type` = #{validType} + + + + and `valid_start_date` = #{validStartDate} + + + + and `valid_end_date` = #{validEndDate} + + + + and `valid_days` = #{validDays} + + + + and `detail` like concat('%', #{detail},'%') + + + + and `price` = #{price} + + + + and `unit` = #{unit} + + + + and `remain_inventory` = #{remainInventory} + + + + and `inventory` = #{inventory} + + + + and `remark` like concat('%', #{remark},'%') + + + + and `status` = #{status} + + + + and `create_date` between #{startdate} and #{enddate} + + + + and `update_date` = #{updateDate} + + + + and `business` = #{business} + + + + and `support_transfer` = #{supportTransfer} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + where `type` < 7 + + + and `id` = #{id} + + + + and `tenant_id` = #{tenantId} + + + + and `type` = #{type} + + + + and `cover_img` like concat('%', #{coverImg},'%') + + + + and `title` like concat('%', #{title},'%') + + + + and `sub_title` like concat('%', #{subTitle},'%') + + + + and `sale_price` = #{salePrice} + + + + and `use_price` = #{usePrice} + + + + and `use_limit_quantity` = #{useLimitQuantity} + + + + and `send_type` = #{sendType} + + + + and `valid_type` = #{validType} + + + + and `valid_start_date` = #{validStartDate} + + + + and `valid_end_date` = #{validEndDate} + + + + and `valid_days` = #{validDays} + + + + and `detail` like concat('%', #{detail},'%') + + + + and `price` = #{price} + + + + and `unit` = #{unit} + + + + and `remain_inventory` = #{remainInventory} + + + + and `inventory` = #{inventory} + + + + and `remark` like concat('%', #{remark},'%') + + + + and `status` = #{status} + + + + and `create_date` between #{startdate} and #{enddate} + + + + and `update_date` = #{updateDate} + + + + and `business` = #{business} + + + + and `support_transfer` = #{supportTransfer} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + +