From e99a6e4ec8b2f0dfb8e0f322c040aae7b17eefaa Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 22 Sep 2024 16:18:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E=EF=BC=9A=E7=A7=AF=E5=88=86=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E7=9A=84=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/product/PointProductPageReqVO.java | 48 ------------------- .../dal/mysql/point/PointProductMapper.java | 15 ------ .../point/PointActivityServiceImpl.java | 12 ++--- 3 files changed, 5 insertions(+), 70 deletions(-) delete mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/product/PointProductPageReqVO.java diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/product/PointProductPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/product/PointProductPageReqVO.java deleted file mode 100644 index d94654e0e..000000000 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/product/PointProductPageReqVO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product; - -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@Schema(description = "管理后台 - 积分商城商品分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PointProductPageReqVO extends PageParam { - - @Schema(description = "积分商城活动 id", example = "29388") - private Long activityId; - - @Schema(description = "商品 SPU 编号", example = "8112") - private Long spuId; - - @Schema(description = "商品 SKU 编号", example = "2736") - private Long skuId; - - @Schema(description = "可兑换数量", example = "3926") - private Integer maxCount; - - @Schema(description = "兑换积分") - private Integer point; - - @Schema(description = "兑换金额,单位:分", example = "15860") - private Integer price; - - @Schema(description = "兑换类型", example = "2") - private Integer type; - - @Schema(description = "积分商城商品状态", example = "2") - private Integer activityStatus; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - -} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointProductMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointProductMapper.java index a0869b6da..cfa10a515 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointProductMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointProductMapper.java @@ -1,9 +1,6 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.point; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.product.PointProductPageReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointProductDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; @@ -19,18 +16,6 @@ import java.util.List; @Mapper public interface PointProductMapper extends BaseMapperX { - default PageResult selectPage(PointProductPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PointProductDO::getActivityId, reqVO.getActivityId()) - .eqIfPresent(PointProductDO::getSpuId, reqVO.getSpuId()) - .eqIfPresent(PointProductDO::getSkuId, reqVO.getSkuId()) - .eqIfPresent(PointProductDO::getPoint, reqVO.getPoint()) - .eqIfPresent(PointProductDO::getPrice, reqVO.getPrice()) - .eqIfPresent(PointProductDO::getActivityStatus, reqVO.getActivityStatus()) - .betweenIfPresent(PointProductDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(PointProductDO::getId)); - } - default List selectListByActivityId(Collection activityIds) { return selectList(PointProductDO::getActivityId, activityIds); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java index 54b017de6..bb7e88afb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java @@ -51,12 +51,6 @@ public class PointActivityServiceImpl implements PointActivityService { @Resource private ProductSkuApi productSkuApi; - private static List buildPointProductDO(PointActivityDO pointActivity, List products) { - return BeanUtils.toBean(products, PointProductDO.class, product -> { - product.setActivityId(pointActivity.getId()).setActivityStatus(pointActivity.getStatus()); - }); - } - @Override public Long createPointActivity(PointActivitySaveReqVO createReqVO) { // 1.1 校验商品是否存在 @@ -72,10 +66,14 @@ public class PointActivityServiceImpl implements PointActivityService { pointActivityMapper.insert(pointActivity); // 2.2 插入积分商城活动商品 pointProductMapper.insertBatch(buildPointProductDO(pointActivity, createReqVO.getProducts())); - // 返回 return pointActivity.getId(); } + private static List buildPointProductDO(PointActivityDO pointActivity, List products) { + return BeanUtils.toBean(products, PointProductDO.class, product -> + product.setActivityId(pointActivity.getId()).setActivityStatus(pointActivity.getStatus())); + } + @Override public void updatePointActivity(PointActivitySaveReqVO updateReqVO) { // 1.1 校验存在