| | |
| | | @Data |
| | | @ApiModel(value = "StoreCouponSingle查询参数", description = "店铺优惠卷单品查询参数") |
| | | public class StoreCouponSingleQuery extends AbsQuery { |
| | | private String refId; |
| | | } |
| | | |
| | |
| | | */ |
| | | IPage getPage(IPage page, @Param("query") StoreCouponSingleQuery query); |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | IPage getPageByRefId(IPage page, @Param("query") StoreCouponSingleQuery query); |
| | | |
| | | } |
| | |
| | | package cn.lili.modules.lmk.service; |
| | | |
| | | import cn.lili.modules.lmk.domain.entity.StoreCoupon; |
| | | import cn.lili.modules.lmk.domain.query.StoreCouponSingleQuery; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.lili.base.Result; |
| | | import cn.lili.modules.lmk.domain.form.StoreCouponForm; |
| | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @return |
| | | */ |
| | | Result all(); |
| | |
| | | |
| | | Result addStoreCoupon(StoreCouponForm storeCoupon); |
| | | |
| | | Result generateStoreCoupon( String id); |
| | | Result changeStatus(String id); |
| | | |
| | | Result generateStoreCoupon(String id); |
| | | |
| | | Result getPageByStoreCoupon(StoreCouponSingleQuery query); |
| | | } |
| | |
| | | */ |
| | | Result page(StoreCouponSingleQuery query); |
| | | |
| | | Result pageByRefId(StoreCouponSingleQuery query); |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | |
| | | import cn.lili.common.exception.ServiceException; |
| | | import cn.lili.modules.lmk.domain.entity.CouponVirtual; |
| | | import cn.lili.modules.lmk.domain.entity.StoreCouponSingle; |
| | | import cn.lili.modules.lmk.domain.query.StoreCouponSingleQuery; |
| | | import cn.lili.modules.lmk.enums.general.GenerateCouponStausEnum; |
| | | import cn.lili.modules.lmk.enums.general.StoreCouponStausEnum; |
| | | import cn.lili.modules.lmk.service.StoreCouponSingleService; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Result getPageByStoreCoupon(StoreCouponSingleQuery query){ |
| | | return storeCouponSingleService.pageByRefId(query); |
| | | } |
| | | |
| | | private static StoreCouponSingle getStoreCouponSingle(StoreCoupon storeCoupon, int i) { |
| | | StoreCouponSingle storeCouponSingle = new StoreCouponSingle(); |
| | | storeCouponSingle.setStoreCoupRef(storeCoupon.getId()); |
| | |
| | | storeCouponSingle.setCouponNo(String.format("%08d", i)); |
| | | return storeCouponSingle; |
| | | } |
| | | |
| | | @Override |
| | | public Result changeStatus(String id) { |
| | | StoreCoupon storeCoupon = this.getById(id); |
| | | if (storeCoupon == null) { |
| | | throw new ServiceException("当前店铺优惠卷不存在"); |
| | | } |
| | | String status = storeCoupon.getStatus(); |
| | | if (StoreCouponStausEnum.ENABLE.name().equals(status)) { |
| | | storeCoupon.setStatus(StoreCouponStausEnum.DISABLE.name()); |
| | | }else if (StoreCouponStausEnum.DISABLE.name().equals(status)) { |
| | | storeCoupon.setStatus(StoreCouponStausEnum.ENABLE.name()); |
| | | }else { |
| | | throw new ServiceException("当前店铺优惠卷状态异常无法修改"); |
| | | } |
| | | this.updateById(storeCoupon); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result pageByRefId(StoreCouponSingleQuery query) { |
| | | IPage<StoreCouponSingleVO> page = PageUtil.getPage(query, StoreCouponSingleVO.class); |
| | | baseMapper.getPageByRefId(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | |
| | | LSCS.delete_flag = 0 |
| | | </select> |
| | | |
| | | <select id="getPageByRefId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | LSCS.store_coup_ref, |
| | | LSCS.store_id, |
| | | LSCS.coupon_id, |
| | | LSCS.coupon_name, |
| | | LSCS.coupon_no, |
| | | LSCS.claim_status, |
| | | LSCS.id |
| | | FROM |
| | | lmk_store_coupon_single LSCS |
| | | WHERE |
| | | LSCS.delete_flag = 0 |
| | | AND LSCS.store_coup_ref = #{query.refId} |
| | | </select> |
| | | </mapper> |
| | |
| | | import cn.lili.base.Result; |
| | | import cn.lili.modules.lmk.domain.form.StoreCouponForm; |
| | | import cn.lili.modules.lmk.domain.query.StoreCouponQuery; |
| | | import cn.lili.modules.lmk.domain.query.StoreCouponSingleQuery; |
| | | import cn.lili.modules.lmk.service.StoreCouponService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | public Result addStoreCoupon(@RequestBody StoreCouponForm storeCoupon){ |
| | | return storeCouponService.addStoreCoupon(storeCoupon); |
| | | } |
| | | /** |
| | | * 修改订单店铺优惠卷状态 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/changeStatus/{id}") |
| | | public Result changeStatus(@PathVariable String id){ |
| | | return storeCouponService.changeStatus(id); |
| | | } |
| | | |
| | | /** |
| | | * 根据店铺关联关系生成单品 |
| | |
| | | public Result getPage(StoreCouponQuery query){ |
| | | return storeCouponService.page(query); |
| | | } |
| | | |
| | | @GetMapping("/getPageByStoreCoupon") |
| | | public Result getPageByStoreCoupon(StoreCouponSingleQuery query){ |
| | | return storeCouponService.getPageByStoreCoupon(query); |
| | | } |
| | | } |