diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java index b5c8376..dbd8fcf 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java @@ -22,7 +22,7 @@ import java.util.List; * 优惠券控制器 * * @author 科技小王子 - * @since 2025-08-09 15:26:02 + * @since 2025-08-09 15:29:58 */ @Tag(name = "优惠券管理") @RestController diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCouponController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCouponController.java deleted file mode 100644 index 793db31..0000000 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCouponController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsCouponService; -import com.gxwebsoft.shop.entity.ShopGoodsCoupon; -import com.gxwebsoft.shop.param.ShopGoodsCouponParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品优惠券表控制器 - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -@Tag(name = "商品优惠券表管理") -@RestController -@RequestMapping("/api/shop/shop-goods-coupon") -public class ShopGoodsCouponController extends BaseController { - @Resource - private ShopGoodsCouponService shopGoodsCouponService; - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:list')") - @Operation(summary = "分页查询商品优惠券表") - @GetMapping("/page") - public ApiResult> page(ShopGoodsCouponParam param) { - // 使用关联查询 - return success(shopGoodsCouponService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:list')") - @Operation(summary = "查询全部商品优惠券表") - @GetMapping() - public ApiResult> list(ShopGoodsCouponParam param) { - // 使用关联查询 - return success(shopGoodsCouponService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:list')") - @Operation(summary = "根据id查询商品优惠券表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsCouponService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:save')") - @OperationLog - @Operation(summary = "添加商品优惠券表") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsCoupon shopGoodsCoupon) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsCoupon.setUserId(loginUser.getUserId()); - } - if (shopGoodsCouponService.save(shopGoodsCoupon)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:update')") - @OperationLog - @Operation(summary = "修改商品优惠券表") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsCoupon shopGoodsCoupon) { - if (shopGoodsCouponService.updateById(shopGoodsCoupon)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:remove')") - @OperationLog - @Operation(summary = "删除商品优惠券表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsCouponService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:save')") - @OperationLog - @Operation(summary = "批量添加商品优惠券表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsCouponService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:update')") - @OperationLog - @Operation(summary = "批量修改商品优惠券表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsCouponService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCoupon:remove')") - @OperationLog - @Operation(summary = "批量删除商品优惠券表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsCouponService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java index 30f35d7..36f8d12 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java @@ -1,225 +1,129 @@ package com.gxwebsoft.shop.controller; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.ShopUserCouponService; import com.gxwebsoft.shop.entity.ShopUserCoupon; import com.gxwebsoft.shop.param.ShopUserCouponParam; -import com.gxwebsoft.shop.service.ShopUserCouponService; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.math.BigDecimal; import java.util.List; -import java.util.Map; /** * 用户优惠券控制器 * * @author 科技小王子 - * @since 2025-08-08 21:30:00 + * @since 2025-08-09 15:29:58 */ @Tag(name = "用户优惠券管理") @RestController -@RequestMapping("/api/shop/user-coupon") +@RequestMapping("/api/shop/shop-user-coupon") public class ShopUserCouponController extends BaseController { - @Resource private ShopUserCouponService shopUserCouponService; - @PreAuthorize("hasAuthority('shop:userCoupon:list')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") @Operation(summary = "分页查询用户优惠券") @GetMapping("/page") public ApiResult> page(ShopUserCouponParam param) { + // 使用关联查询 return success(shopUserCouponService.pageRel(param)); } - @PreAuthorize("hasAuthority('shop:userCoupon:list')") - @Operation(summary = "查询用户优惠券列表") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") + @Operation(summary = "查询全部用户优惠券") @GetMapping() public ApiResult> list(ShopUserCouponParam param) { + // 使用关联查询 return success(shopUserCouponService.listRel(param)); } - @PreAuthorize("hasAuthority('shop:userCoupon:list')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") @Operation(summary = "根据id查询用户优惠券") @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Long id) { + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 return success(shopUserCouponService.getByIdRel(id)); } - @Operation(summary = "获取当前用户的优惠券列表") - @GetMapping("/my") - public ApiResult> getMyCoupons(ShopUserCouponParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - param.setUserId(loginUser.getUserId()); - return success(shopUserCouponService.listRel(param)); - } - - @Operation(summary = "获取当前用户可用的优惠券") - @GetMapping("/my/available") - public ApiResult> getMyAvailableCoupons( - @RequestParam(required = false) Integer goodsId, - @RequestParam(required = false) Integer categoryId, - @RequestParam(required = false) BigDecimal orderAmount) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - - List coupons = shopUserCouponService.getAvailableCoupons( - loginUser.getUserId(), goodsId, categoryId, orderAmount); - return success(coupons); - } - - @Operation(summary = "统计当前用户优惠券数量") - @GetMapping("/my/count") - public ApiResult> getMyCount() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - - Map count = shopUserCouponService.countUserCoupons(loginUser.getUserId()); - return success(count); - } - + @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") @OperationLog - @Operation(summary = "领取优惠券") - @PostMapping("/receive/{couponId}") - public ApiResult receiveCoupon(@PathVariable("couponId") Integer couponId) { + @Operation(summary = "添加用户优惠券") + @PostMapping() + public ApiResult save(@RequestBody ShopUserCoupon shopUserCoupon) { + // 记录当前登录用户id User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); + if (loginUser != null) { + shopUserCoupon.setUserId(loginUser.getUserId()); } - - // 检查是否可以领取 - Map checkResult = shopUserCouponService.checkCanReceiveCoupon( - loginUser.getUserId(), couponId); - - if (!(Boolean) checkResult.get("canReceive")) { - return fail(checkResult.get("reason").toString()); - } - - boolean success = shopUserCouponService.receiveCoupon(loginUser.getUserId(), couponId); - if (success) { - return success("领取成功"); + if (shopUserCouponService.save(shopUserCoupon)) { + return success("添加成功"); } - return fail("领取失败"); + return fail("添加失败"); } - @PreAuthorize("hasAuthority('shop:userCoupon:save')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") @OperationLog - @Operation(summary = "系统发放优惠券给用户") - @PostMapping("/issue") - public ApiResult issueCoupon(@RequestParam Integer userId, - @RequestParam Integer couponId, - @RequestParam(required = false) String source) { - boolean success = shopUserCouponService.issueCouponToUser(userId, couponId, source); - if (success) { - return success("发放成功"); + @Operation(summary = "修改用户优惠券") + @PutMapping() + public ApiResult update(@RequestBody ShopUserCoupon shopUserCoupon) { + if (shopUserCouponService.updateById(shopUserCoupon)) { + return success("修改成功"); } - return fail("发放失败"); + return fail("修改失败"); } - @PreAuthorize("hasAuthority('shop:userCoupon:save')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") @OperationLog - @Operation(summary = "批量发放优惠券") - @PostMapping("/batch-issue") - public ApiResult batchIssueCoupons(@RequestParam List userIds, - @RequestParam Integer couponId, - @RequestParam(required = false) String source) { - int successCount = shopUserCouponService.batchIssueCoupons(userIds, couponId, source); - return success("成功发放" + successCount + "张优惠券"); - } - - @PreAuthorize("hasAuthority('shop:userCoupon:update')") - @OperationLog - @Operation(summary = "使用优惠券") - @PutMapping("/use") - public ApiResult useCoupon(@RequestParam Long userCouponId, - @RequestParam Long orderId, - @RequestParam String orderNo) { - boolean success = shopUserCouponService.useCoupon(userCouponId, orderId, orderNo); - if (success) { - return success("使用成功"); + @Operation(summary = "删除用户优惠券") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserCouponService.removeById(id)) { + return success("删除成功"); } - return fail("使用失败"); + return fail("删除失败"); } - @PreAuthorize("hasAuthority('shop:userCoupon:update')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") @OperationLog - @Operation(summary = "退还优惠券") - @PutMapping("/return/{orderId}") - public ApiResult returnCoupon(@PathVariable("orderId") Long orderId) { - boolean success = shopUserCouponService.returnCoupon(orderId); - if (success) { - return success("退还成功"); - } - return fail("退还失败"); - } - - @Operation(summary = "计算优惠券优惠金额") - @PostMapping("/calculate-discount") - public ApiResult calculateDiscount(@RequestParam Long userCouponId, - @RequestParam BigDecimal orderAmount) { - ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); - if (userCoupon == null) { - return fail("优惠券不存在",null); + @Operation(summary = "批量添加用户优惠券") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserCouponService.saveBatch(list)) { + return success("添加成功"); } - - BigDecimal discountAmount = shopUserCouponService.calculateDiscountAmount(userCoupon, orderAmount); - return success(discountAmount); + return fail("添加失败"); } - @Operation(summary = "验证优惠券是否可用于指定商品") - @GetMapping("/validate") - public ApiResult validateCoupon(@RequestParam Long userCouponId, - @RequestParam(required = false) Integer goodsId, - @RequestParam(required = false) Integer categoryId) { - ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); - if (userCoupon == null) { - return fail("优惠券不存在",null); - } - - boolean valid = shopUserCouponService.validateCouponForGoods(userCoupon, goodsId, categoryId); - return success(valid); - } - - @PreAuthorize("hasAuthority('shop:userCoupon:update')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") @OperationLog - @Operation(summary = "更新过期优惠券状态") - @PutMapping("/update-expired") - public ApiResult updateExpiredCoupons() { - int count = shopUserCouponService.updateExpiredCoupons(); - return success("更新了" + count + "张过期优惠券"); - } - - @PreAuthorize("hasAuthority('shop:userCoupon:list')") - @Operation(summary = "获取即将过期的优惠券") - @GetMapping("/expiring-soon") - public ApiResult> getExpiringSoonCoupons( - @RequestParam(defaultValue = "3") Integer days) { - List coupons = shopUserCouponService.getExpiringSoonCoupons(days); - return success(coupons); + @Operation(summary = "批量修改用户优惠券") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserCouponService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); } - @PreAuthorize("hasAuthority('shop:userCoupon:remove')") + @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") @OperationLog - @Operation(summary = "删除用户优惠券") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Long id) { - if (shopUserCouponService.removeById(id)) { + @Operation(summary = "批量删除用户优惠券") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserCouponService.removeByIds(ids)) { return success("删除成功"); } return fail("删除失败"); } + } diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java index 3a1e44e..df245f7 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java @@ -15,7 +15,7 @@ import lombok.EqualsAndHashCode; * 优惠券 * * @author 科技小王子 - * @since 2025-08-09 15:26:02 + * @since 2025-08-09 15:29:58 */ @Data @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCoupon.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCoupon.java deleted file mode 100644 index d078e39..0000000 --- a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCoupon.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品优惠券表 - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsCoupon对象", description = "商品优惠券表") -public class ShopGoodsCoupon implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "商品id") - private Integer goodsId; - - @Schema(description = "优惠劵id") - private Integer issueCouponId; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - private LocalDateTime updateTime; - -} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java index c4478de..6be885d 100644 --- a/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java @@ -1,31 +1,59 @@ package com.gxwebsoft.shop.entity; +import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Date; - /** * 用户优惠券 * * @author 科技小王子 - * @since 2025-08-08 21:30:00 + * @since 2025-08-09 15:29:58 */ @Data @EqualsAndHashCode(callSuper = false) -@TableName("shop_user_coupon") @Schema(name = "ShopUserCoupon对象", description = "用户优惠券") public class ShopUserCoupon implements Serializable { private static final long serialVersionUID = 1L; + // 优惠券类型常量 + /** 满减券 */ + public static final Integer TYPE_REDUCE = 10; + /** 折扣券 */ + public static final Integer TYPE_DISCOUNT = 20; + /** 免费券 */ + public static final Integer TYPE_FREE = 30; + + // 适用范围常量 + /** 全部商品 */ + public static final Integer APPLY_ALL = 10; + /** 指定商品 */ + public static final Integer APPLY_GOODS = 20; + /** 指定分类 */ + public static final Integer APPLY_CATEGORY = 30; + + // 使用状态常量 + /** 未使用 */ + public static final Integer STATUS_UNUSED = 0; + /** 已使用 */ + public static final Integer STATUS_USED = 1; + /** 已过期 */ + public static final Integer STATUS_EXPIRED = 2; + + // 获取方式常量 + /** 主动领取 */ + public static final Integer OBTAIN_ACTIVE = 10; + /** 系统发放 */ + public static final Integer OBTAIN_SYSTEM = 20; + /** 活动赠送 */ + public static final Integer OBTAIN_ACTIVITY = 30; + @Schema(description = "id") @TableId(value = "id", type = IdType.AUTO) private Long id; @@ -86,57 +114,15 @@ public class ShopUserCoupon implements Serializable { @Schema(description = "是否删除, 0否, 1是") @TableLogic - private Integer deleted; + private Boolean deleted; @Schema(description = "租户id") private Integer tenantId; @Schema(description = "创建时间") - private Date createTime; + private LocalDateTime createTime; @Schema(description = "修改时间") - private Date updateTime; + private LocalDateTime updateTime; - // 优惠券状态常量 - public static final int STATUS_UNUSED = 0; // 未使用 - public static final int STATUS_USED = 1; // 已使用 - public static final int STATUS_EXPIRED = 2; // 已过期 - - // 优惠券类型常量 - public static final int TYPE_REDUCE = 10; // 满减券 - public static final int TYPE_DISCOUNT = 20; // 折扣券 - public static final int TYPE_FREE = 30; // 免费券 - - // 适用范围常量 - public static final int APPLY_ALL = 10; // 全部商品 - public static final int APPLY_GOODS = 20; // 指定商品 - public static final int APPLY_CATEGORY = 30; // 指定分类 - - // 获取方式常量 - public static final int OBTAIN_RECEIVE = 10; // 主动领取 - public static final int OBTAIN_SYSTEM = 20; // 系统发放 - public static final int OBTAIN_ACTIVITY = 30; // 活动赠送 - - /** - * 检查优惠券是否已过期 - */ - public boolean isExpired() { - return this.endTime != null && this.endTime.isBefore(LocalDateTime.now()); - } - - /** - * 检查优惠券是否可用 - */ - public boolean isAvailable() { - return this.status == STATUS_UNUSED && !isExpired(); - } - - /** - * 检查优惠券是否在有效期内 - */ - public boolean isInValidPeriod() { - LocalDateTime now = LocalDateTime.now(); - return (this.startTime == null || !this.startTime.isAfter(now)) && - (this.endTime == null || !this.endTime.isBefore(now)); - } } diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java index eca36bd..dab59b7 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java @@ -12,7 +12,7 @@ import java.util.List; * 优惠券Mapper * * @author 科技小王子 - * @since 2025-08-09 15:26:02 + * @since 2025-08-09 15:29:58 */ public interface ShopCouponMapper extends BaseMapper { diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCouponMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCouponMapper.java deleted file mode 100644 index ad649d0..0000000 --- a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCouponMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsCoupon; -import com.gxwebsoft.shop.param.ShopGoodsCouponParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品优惠券表Mapper - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -public interface ShopGoodsCouponMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsCouponParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsCouponParam param); - -} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java index ec6a23d..8602ae5 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java @@ -12,65 +12,26 @@ import java.util.List; * 用户优惠券Mapper * * @author 科技小王子 - * @since 2025-08-08 21:30:00 + * @since 2025-08-09 15:29:58 */ public interface ShopUserCouponMapper extends BaseMapper { /** - * 分页查询用户优惠券 + * 分页查询 * * @param page 分页对象 * @param param 查询参数 * @return List */ List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserCouponParam param); + @Param("param") ShopUserCouponParam param); /** - * 查询用户优惠券列表 + * 查询全部 * * @param param 查询参数 - * @return List + * @return List */ List selectListRel(@Param("param") ShopUserCouponParam param); - /** - * 查询用户可用的优惠券 - * - * @param param 查询参数 - * @return List - */ - List selectAvailableCoupons(@Param("param") ShopUserCouponParam param); - - /** - * 统计用户优惠券数量 - * - * @param userId 用户ID - * @return 统计结果 - */ - java.util.Map countUserCoupons(@Param("userId") Integer userId); - - /** - * 查询即将过期的优惠券 - * - * @param days 天数 - * @return List - */ - List selectExpiringSoon(@Param("days") Integer days); - - /** - * 批量更新过期状态 - * - * @return 更新数量 - */ - int updateExpiredStatus(); - - /** - * 检查用户是否已领取指定优惠券 - * - * @param userId 用户ID - * @param couponId 优惠券模板ID - * @return 已领取数量 - */ - int countUserReceivedCoupon(@Param("userId") Integer userId, @Param("couponId") Integer couponId); } diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml index d517f23..48eaee5 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml @@ -2,41 +2,11 @@ - + - SELECT - a.id, - a.coupon_id, - a.user_id, - a.name, - a.description, - a.type, - a.reduce_price, - a.discount, - a.min_price, - a.apply_range, - a.apply_range_config, - a.start_time, - a.end_time, - a.status, - a.use_time, - a.order_id, - a.order_no, - a.obtain_type, - a.obtain_source, - a.deleted, - a.tenant_id, - a.create_time, - a.update_time, - u.nickname as user_nickname, - u.phone as user_phone + SELECT a.* FROM shop_user_coupon a - LEFT JOIN user u ON a.user_id = u.user_id - a.deleted = 0 - - AND a.tenant_id = #{param.tenantId} - AND a.id = #{param.id} @@ -46,44 +16,59 @@ AND a.user_id = #{param.userId} - + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + AND a.type = #{param.type} - - AND a.status = #{param.status} + + AND a.reduce_price = #{param.reducePrice} + + + AND a.discount = #{param.discount} + + + AND a.min_price = #{param.minPrice} AND a.apply_range = #{param.applyRange} - - AND a.obtain_type = #{param.obtainType} + + AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%') - - AND a.order_id = #{param.orderId} + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - AND a.order_no = #{param.orderNo} + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - AND a.start_time >= #{param.startTimeBegin} + + AND a.status = #{param.status} - - AND a.start_time <= #{param.startTimeEnd} + + AND a.use_time LIKE CONCAT('%', #{param.useTime}, '%') - - AND a.end_time >= #{param.endTimeBegin} + + AND a.order_id LIKE CONCAT('%', #{param.orderId}, '%') + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.obtain_type = #{param.obtainType} - - AND a.end_time <= #{param.endTimeEnd} + + AND a.obtain_source LIKE CONCAT('%', #{param.obtainSource}, '%') - - AND a.use_time >= #{param.useTimeBegin} + + AND a.deleted = #{param.deleted} - - AND a.use_time <= #{param.useTimeEnd} + + AND a.deleted = 0 AND a.create_time >= #{param.createTimeStart} @@ -91,150 +76,21 @@ AND a.create_time <= #{param.createTimeEnd} - - AND (a.end_time IS NULL OR a.end_time > NOW()) - - - AND a.status = 0 - AND (a.start_time IS NULL OR a.start_time <= NOW()) - AND (a.end_time IS NULL OR a.end_time > NOW()) - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.description LIKE CONCAT('%', #{param.keywords}, '%') - OR u.nickname LIKE CONCAT('%', #{param.keywords}, '%') - OR u.phone LIKE CONCAT('%', #{param.keywords}, '%')) - + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + - - - - - - - - - - - - - UPDATE shop_user_coupon - SET status = 2, update_time = NOW() - WHERE deleted = 0 - AND status = 0 - AND end_time IS NOT NULL - AND end_time <= NOW() - - - - diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java index 7214809..d5bb69b 100644 --- a/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java @@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode; * 优惠券查询参数 * * @author 科技小王子 - * @since 2025-08-09 15:26:01 + * @since 2025-08-09 15:29:57 */ @Data @EqualsAndHashCode(callSuper = false) diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCouponParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCouponParam.java deleted file mode 100644 index 1a9f8f8..0000000 --- a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCouponParam.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品优惠券表查询参数 - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsCouponParam对象", description = "商品优惠券表查询参数") -public class ShopGoodsCouponParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "商品id") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "优惠劵id") - @QueryField(type = QueryType.EQ) - private Integer issueCouponId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java index 3f42bde..c49a876 100644 --- a/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java @@ -1,84 +1,96 @@ package com.gxwebsoft.shop.param; +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; -import java.time.LocalDateTime; - /** * 用户优惠券查询参数 * * @author 科技小王子 - * @since 2025-08-08 21:30:00 + * @since 2025-08-09 15:29:58 */ @Data @EqualsAndHashCode(callSuper = false) -@Schema(description = "用户优惠券查询参数") +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserCouponParam对象", description = "用户优惠券查询参数") public class ShopUserCouponParam extends BaseParam { private static final long serialVersionUID = 1L; @Schema(description = "id") + @QueryField(type = QueryType.EQ) private Long id; @Schema(description = "优惠券模板ID") + @QueryField(type = QueryType.EQ) private Integer couponId; @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) private Integer userId; @Schema(description = "优惠券名称") private String name; + @Schema(description = "优惠券描述") + private String description; + @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") + @QueryField(type = QueryType.EQ) private Integer type; - @Schema(description = "使用状态(0未使用 1已使用 2已过期)") - private Integer status; - - @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") - private Integer applyRange; + @Schema(description = "满减券-减免金额") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; - @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") - private Integer obtainType; + @Schema(description = "折扣券-折扣率(0-100)") + @QueryField(type = QueryType.EQ) + private Integer discount; - @Schema(description = "使用订单ID") - private Long orderId; + @Schema(description = "最低消费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal minPrice; - @Schema(description = "使用订单号") - private String orderNo; + @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") + @QueryField(type = QueryType.EQ) + private Integer applyRange; - @Schema(description = "有效期开始时间-查询开始") - private LocalDateTime startTimeBegin; + @Schema(description = "适用范围配置(json格式)") + private String applyRangeConfig; - @Schema(description = "有效期开始时间-查询结束") - private LocalDateTime startTimeEnd; + @Schema(description = "有效期开始时间") + private String startTime; - @Schema(description = "有效期结束时间-查询开始") - private LocalDateTime endTimeBegin; + @Schema(description = "有效期结束时间") + private String endTime; - @Schema(description = "有效期结束时间-查询结束") - private LocalDateTime endTimeEnd; + @Schema(description = "使用状态(0未使用 1已使用 2已过期)") + @QueryField(type = QueryType.EQ) + private Integer status; - @Schema(description = "使用时间-查询开始") - private LocalDateTime useTimeBegin; + @Schema(description = "使用时间") + private String useTime; - @Schema(description = "使用时间-查询结束") - private LocalDateTime useTimeEnd; + @Schema(description = "使用订单ID") + private Long orderId; - @Schema(description = "是否包含已过期的券(默认false)") - private Boolean includeExpired = false; + @Schema(description = "使用订单号") + private String orderNo; - @Schema(description = "是否只查询可用的券(默认false)") - private Boolean onlyAvailable = false; + @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") + @QueryField(type = QueryType.EQ) + private Integer obtainType; - @Schema(description = "商品ID(用于筛选可用优惠券)") - private Integer goodsId; + @Schema(description = "获取来源描述") + private String obtainSource; - @Schema(description = "商品分类ID(用于筛选可用优惠券)") - private Integer categoryId; + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Boolean deleted; - @Schema(description = "订单金额(用于筛选可用优惠券)") - private java.math.BigDecimal orderAmount; } diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java index c828b62..f3df79e 100644 --- a/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java @@ -11,7 +11,7 @@ import java.util.List; * 优惠券Service * * @author 科技小王子 - * @since 2025-08-09 15:26:02 + * @since 2025-08-09 15:29:58 */ public interface ShopCouponService extends IService { diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCouponService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCouponService.java deleted file mode 100644 index d93c8a8..0000000 --- a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCouponService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsCoupon; -import com.gxwebsoft.shop.param.ShopGoodsCouponParam; - -import java.util.List; - -/** - * 商品优惠券表Service - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -public interface ShopGoodsCouponService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsCouponParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsCouponParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopGoodsCoupon - */ - ShopGoodsCoupon getByIdRel(Integer id); - -} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java index ae41775..4ff308c 100644 --- a/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java @@ -5,20 +5,18 @@ import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.shop.entity.ShopUserCoupon; import com.gxwebsoft.shop.param.ShopUserCouponParam; -import java.math.BigDecimal; import java.util.List; -import java.util.Map; /** * 用户优惠券Service * * @author 科技小王子 - * @since 2025-08-08 21:30:00 + * @since 2025-08-09 15:29:58 */ public interface ShopUserCouponService extends IService { /** - * 分页关联查询用户优惠券 + * 分页关联查询 * * @param param 查询参数 * @return PageResult @@ -26,7 +24,7 @@ public interface ShopUserCouponService extends IService { PageResult pageRel(ShopUserCouponParam param); /** - * 关联查询用户优惠券列表 + * 关联查询全部 * * @param param 查询参数 * @return List @@ -34,120 +32,11 @@ public interface ShopUserCouponService extends IService { List listRel(ShopUserCouponParam param); /** - * 根据id查询用户优惠券 + * 根据id查询 * * @param id id * @return ShopUserCoupon */ - ShopUserCoupon getByIdRel(Long id); + ShopUserCoupon getByIdRel(Integer id); - /** - * 用户领取优惠券 - * - * @param userId 用户ID - * @param couponId 优惠券模板ID - * @return 是否成功 - */ - boolean receiveCoupon(Integer userId, Integer couponId); - - /** - * 系统发放优惠券给用户 - * - * @param userId 用户ID - * @param couponId 优惠券模板ID - * @param source 发放来源描述 - * @return 是否成功 - */ - boolean issueCouponToUser(Integer userId, Integer couponId, String source); - - /** - * 批量发放优惠券给多个用户 - * - * @param userIds 用户ID列表 - * @param couponId 优惠券模板ID - * @param source 发放来源描述 - * @return 成功发放的数量 - */ - int batchIssueCoupons(List userIds, Integer couponId, String source); - - /** - * 使用优惠券 - * - * @param userCouponId 用户优惠券ID - * @param orderId 订单ID - * @param orderNo 订单号 - * @return 是否成功 - */ - boolean useCoupon(Long userCouponId, Long orderId, String orderNo); - - /** - * 退还优惠券(订单取消时) - * - * @param orderId 订单ID - * @return 是否成功 - */ - boolean returnCoupon(Long orderId); - - /** - * 获取用户可用的优惠券列表 - * - * @param userId 用户ID - * @param goodsId 商品ID(可选) - * @param categoryId 商品分类ID(可选) - * @param orderAmount 订单金额(可选) - * @return List - */ - List getAvailableCoupons(Integer userId, Integer goodsId, - Integer categoryId, BigDecimal orderAmount); - - /** - * 计算优惠券优惠金额 - * - * @param userCoupon 用户优惠券 - * @param orderAmount 订单金额 - * @return 优惠金额 - */ - BigDecimal calculateDiscountAmount(ShopUserCoupon userCoupon, BigDecimal orderAmount); - - /** - * 验证优惠券是否可用于指定商品 - * - * @param userCoupon 用户优惠券 - * @param goodsId 商品ID - * @param categoryId 商品分类ID - * @return 是否可用 - */ - boolean validateCouponForGoods(ShopUserCoupon userCoupon, Integer goodsId, Integer categoryId); - - /** - * 统计用户优惠券数量 - * - * @param userId 用户ID - * @return 统计结果 {total: 总数, unused: 未使用, used: 已使用, expired: 已过期} - */ - Map countUserCoupons(Integer userId); - - /** - * 更新过期优惠券状态 - * - * @return 更新数量 - */ - int updateExpiredCoupons(); - - /** - * 获取即将过期的优惠券 - * - * @param days 天数 - * @return List - */ - List getExpiringSoonCoupons(Integer days); - - /** - * 检查用户是否可以领取指定优惠券 - * - * @param userId 用户ID - * @param couponId 优惠券模板ID - * @return 检查结果 {canReceive: boolean, reason: String} - */ - Map checkCanReceiveCoupon(Integer userId, Integer couponId); } diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java index a90cbd0..e6741c1 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java @@ -15,7 +15,7 @@ import java.util.List; * 优惠券Service实现 * * @author 科技小王子 - * @since 2025-08-09 15:26:02 + * @since 2025-08-09 15:29:58 */ @Service public class ShopCouponServiceImpl extends ServiceImpl implements ShopCouponService { diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCouponServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCouponServiceImpl.java deleted file mode 100644 index 0c97704..0000000 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCouponServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsCouponMapper; -import com.gxwebsoft.shop.service.ShopGoodsCouponService; -import com.gxwebsoft.shop.entity.ShopGoodsCoupon; -import com.gxwebsoft.shop.param.ShopGoodsCouponParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品优惠券表Service实现 - * - * @author 科技小王子 - * @since 2025-08-09 15:26:02 - */ -@Service -public class ShopGoodsCouponServiceImpl extends ServiceImpl implements ShopGoodsCouponService { - - @Override - public PageResult pageRel(ShopGoodsCouponParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsCouponParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsCoupon getByIdRel(Integer id) { - ShopGoodsCouponParam param = new ShopGoodsCouponParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java new file mode 100644 index 0000000..175ca43 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserCouponMapper; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.param.ShopUserCouponParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户优惠券Service实现 + * + * @author 科技小王子 + * @since 2025-08-09 15:29:58 + */ +@Service +public class ShopUserCouponServiceImpl extends ServiceImpl implements ShopUserCouponService { + + @Override + public PageResult pageRel(ShopUserCouponParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserCouponParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserCoupon getByIdRel(Integer id) { + ShopUserCouponParam param = new ShopUserCouponParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/test/java/com/gxwebsoft/generator/ShopGenerator.java b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java index 7874901..7bb13d1 100644 --- a/src/test/java/com/gxwebsoft/generator/ShopGenerator.java +++ b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java @@ -55,7 +55,6 @@ public class ShopGenerator { // "shop_goods_sku", // "shop_goods_category", "shop_coupon", - "shop_goods_coupon", // "shop_goods_description", // "shop_goods_log", // "shop_goods_relation", @@ -89,6 +88,7 @@ public class ShopGenerator { // "shop_dealer_user", // "shop_user_referee", // "shop_dealer_withdraw", + "shop_user_coupon", // "shop_cart", // "shop_count", // "shop_express", diff --git a/src/test/java/com/gxwebsoft/generator/templates/index.vue.btl b/src/test/java/com/gxwebsoft/generator/templates/index.vue.btl index 3a52886..4c3ae5b 100644 --- a/src/test/java/com/gxwebsoft/generator/templates/index.vue.btl +++ b/src/test/java/com/gxwebsoft/generator/templates/index.vue.btl @@ -1,6 +1,5 @@