From 96e12a154913aeb42d77cf6c447a6346da8b6489 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Mon, 10 Nov 2025 14:22:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=A4=BC=E7=89=A9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/recent/member_recent.sql | 25 ++++- .../product/enums/ErrorCodeConstants.java | 5 +- .../controller/admin/gift/GiftController.java | 99 +++++++++++++++++++ .../admin/gift/vo/GiftPageReqVO.java | 34 +++++++ .../controller/admin/gift/vo/GiftRespVO.java | 39 ++++++++ .../admin/gift/vo/GiftSaveReqVO.java | 31 ++++++ .../product/dal/dataobject/gift/GiftDO.java | 47 +++++++++ .../product/dal/mysql/gift/GiftMapper.java | 28 ++++++ .../product/service/gift/GiftService.java | 40 ++++++++ .../product/service/gift/GiftServiceImpl.java | 91 +++++++++++++++++ .../service/recent/RecentServiceImpl.java | 2 - 11 files changed, 436 insertions(+), 5 deletions(-) create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/GiftController.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftPageReqVO.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftRespVO.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftSaveReqVO.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/gift/GiftDO.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/gift/GiftMapper.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftService.java create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftServiceImpl.java diff --git a/sql/mysql/recent/member_recent.sql b/sql/mysql/recent/member_recent.sql index d5ff112..9b46790 100644 --- a/sql/mysql/recent/member_recent.sql +++ b/sql/mysql/recent/member_recent.sql @@ -179,7 +179,7 @@ CREATE TABLE `member_open_type` `original_price` int NOT NULL COMMENT '价格(原价)', `duration` int NOT NULL COMMENT '时长(天)', `status` char(32) NOT NULL COMMENT '状态', - `is_hot` bit(1) NOT NULL COMMENT '是否热门', + `is_hot` bit(1) NOT NULL COMMENT '是否热门', `sort` int DEFAULT 0 NOT NULL COMMENT '排序', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', @@ -210,4 +210,25 @@ CREATE TABLE `member_open_type_user` `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '会员开通类型与用户关联表'; \ No newline at end of file +) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '会员开通类型与用户关联表'; + + +-- ---------------------------- +-- Table structure for trade_gift +-- ---------------------------- +DROP TABLE IF EXISTS `trade_gift`; +CREATE TABLE `trade_gift` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '礼物商品id', + `title` bigint NOT NULL COMMENT '礼物标题', + `price` int NOT NULL COMMENT '礼物价格(分)', + `image` varchar(256) NOT NULL COMMENT '礼物图片', + `status` char(32) NOT NULL COMMENT '礼物状态', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '礼物商品'; \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java index 3531b14..765a406 100644 --- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/ErrorCodeConstants.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; /** * Product 错误码枚举类 - * + *

* product 系统,使用 1-008-000-000 段 */ public interface ErrorCodeConstants { @@ -53,4 +53,7 @@ public interface ErrorCodeConstants { ErrorCode FAVORITE_EXISTS = new ErrorCode(1_008_008_000, "该商品已经被收藏"); ErrorCode FAVORITE_NOT_EXISTS = new ErrorCode(1_008_008_001, "商品收藏不存在"); + // ========== 礼物 商品 1-008-009-000 ========== + ErrorCode GIFT_NOT_EXISTS = new ErrorCode(1_008_009_001, "礼物不存在"); + } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/GiftController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/GiftController.java new file mode 100644 index 0000000..771d803 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/GiftController.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.product.controller.admin.gift; + +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftPageReqVO; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftRespVO; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftSaveReqVO; +import cn.iocoder.yudao.module.product.dal.dataobject.gift.GiftDO; +import cn.iocoder.yudao.module.product.service.gift.GiftService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; + +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; + + +@Tag(name = "管理后台 - 礼物商品") +@RestController +@RequestMapping("/trade/gift") +@Validated +public class GiftController { + + @Resource + private GiftService giftService; + + @PostMapping("/create") + @Operation(summary = "创建礼物商品") + @PreAuthorize("@ss.hasPermission('trade:gift:create')") + public CommonResult createGift(@Valid @RequestBody GiftSaveReqVO createReqVO) { + return success(giftService.createGift(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新礼物商品") + @PreAuthorize("@ss.hasPermission('trade:gift:update')") + public CommonResult updateGift(@Valid @RequestBody GiftSaveReqVO updateReqVO) { + giftService.updateGift(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除礼物商品") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('trade:gift:delete')") + public CommonResult deleteGift(@RequestParam("id") Long id) { + giftService.deleteGift(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得礼物商品") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('trade:gift:query')") + public CommonResult getGift(@RequestParam("id") Long id) { + GiftDO gift = giftService.getGift(id); + return success(BeanUtils.toBean(gift, GiftRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得礼物商品分页") + @PreAuthorize("@ss.hasPermission('trade:gift:query')") + public CommonResult> getGiftPage(@Valid GiftPageReqVO pageReqVO) { + PageResult pageResult = giftService.getGiftPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, GiftRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出礼物商品 Excel") + @PreAuthorize("@ss.hasPermission('trade:gift:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportGiftExcel(@Valid GiftPageReqVO pageReqVO, HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = giftService.getGiftPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "礼物商品.xls", "数据", GiftRespVO.class, BeanUtils.toBean(list, GiftRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftPageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftPageReqVO.java new file mode 100644 index 0000000..8bc991c --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftPageReqVO.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.controller.admin.gift.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +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 GiftPageReqVO extends PageParam { + + @Schema(description = "礼物标题") + private Long title; + + @Schema(description = "礼物价格(分)", example = "31512") + private Integer price; + + @Schema(description = "礼物图片") + private String image; + + @Schema(description = "礼物状态", example = "2") + private String status; + + @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-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftRespVO.java new file mode 100644 index 0000000..5a5dfbe --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftRespVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.product.controller.admin.gift.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 礼物商品 Response VO") +@Data +@ExcelIgnoreUnannotated +public class GiftRespVO { + + @Schema(description = "礼物商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15694") + @ExcelProperty("礼物商品id") + private Long id; + + @Schema(description = "礼物标题", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("礼物标题") + private Long title; + + @Schema(description = "礼物价格(分)", requiredMode = Schema.RequiredMode.REQUIRED, example = "31512") + @ExcelProperty("礼物价格(分)") + private Integer price; + + @Schema(description = "礼物图片", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("礼物图片") + private String image; + + @Schema(description = "礼物状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("礼物状态") + private String status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftSaveReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftSaveReqVO.java new file mode 100644 index 0000000..e383596 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/gift/vo/GiftSaveReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.product.controller.admin.gift.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 礼物商品新增/修改 Request VO") +@Data +public class GiftSaveReqVO { + + @Schema(description = "礼物商品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15694") + private Long id; + + @Schema(description = "礼物标题", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "礼物标题不能为空") + private Long title; + + @Schema(description = "礼物价格(分)", requiredMode = Schema.RequiredMode.REQUIRED, example = "31512") + @NotNull(message = "礼物价格(分)不能为空") + private Integer price; + + @Schema(description = "礼物图片", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "礼物图片不能为空") + private String image; + + @Schema(description = "礼物状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotEmpty(message = "礼物状态不能为空") + private String status; + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/gift/GiftDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/gift/GiftDO.java new file mode 100644 index 0000000..4822f59 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/gift/GiftDO.java @@ -0,0 +1,47 @@ +package cn.iocoder.yudao.module.product.dal.dataobject.gift; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 礼物商品 DO + * + * @author 聊天交友 + */ +@TableName("trade_gift") +@KeySequence("trade_gift_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class GiftDO extends BaseDO { + + /** + * 礼物商品id + */ + @TableId + private Long id; + /** + * 礼物标题 + */ + private Long title; + /** + * 礼物价格(分) + */ + private Integer price; + /** + * 礼物图片 + */ + private String image; + /** + * 礼物状态 + */ + private String status; + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/gift/GiftMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/gift/GiftMapper.java new file mode 100644 index 0000000..f6baac8 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/gift/GiftMapper.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.product.dal.mysql.gift; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftPageReqVO; +import cn.iocoder.yudao.module.product.dal.dataobject.gift.GiftDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 礼物商品 Mapper + */ +@Mapper +public interface GiftMapper extends BaseMapperX { + + default PageResult selectPage(GiftPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(GiftDO::getTitle, reqVO.getTitle()) + .eqIfPresent(GiftDO::getPrice, reqVO.getPrice()) + .eqIfPresent(GiftDO::getImage, reqVO.getImage()) + .eqIfPresent(GiftDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(GiftDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(GiftDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftService.java new file mode 100644 index 0000000..7970c81 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftService.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.product.service.gift; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftPageReqVO; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftSaveReqVO; +import cn.iocoder.yudao.module.product.dal.dataobject.gift.GiftDO; + +/** + * 礼物商品 Service 接口 + */ +public interface GiftService { + + /** + * 创建礼物商品 + */ + Long createGift(@Valid GiftSaveReqVO createReqVO); + + /** + * 更新礼物商品 + */ + void updateGift(@Valid GiftSaveReqVO updateReqVO); + + /** + * 删除礼物商品 + */ + void deleteGift(Long id); + + /** + * 获得礼物商品 + */ + GiftDO getGift(Long id); + + /** + * 获得礼物商品分页 + */ + PageResult getGiftPage(GiftPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftServiceImpl.java new file mode 100644 index 0000000..4e357e0 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/gift/GiftServiceImpl.java @@ -0,0 +1,91 @@ +package cn.iocoder.yudao.module.product.service.gift; + +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftPageReqVO; +import cn.iocoder.yudao.module.product.controller.admin.gift.vo.GiftSaveReqVO; +import cn.iocoder.yudao.module.product.dal.dataobject.gift.GiftDO; +import cn.iocoder.yudao.module.product.dal.mysql.gift.GiftMapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.GIFT_NOT_EXISTS; + +/** + * 礼物商品 Service 实现类 + * + * @author 聊天交友 + */ +@Service +@Validated +public class GiftServiceImpl implements GiftService { + + @Resource + private GiftMapper giftMapper; + + /** + * 创建礼物商品 + */ + @Override + public Long createGift(GiftSaveReqVO createReqVO) { + // 插入 + GiftDO gift = BeanUtils.toBean(createReqVO, GiftDO.class); + giftMapper.insert(gift); + // 返回 + return gift.getId(); + } + + /** + * 更新礼物商品 + */ + @Override + public void updateGift(GiftSaveReqVO updateReqVO) { + // 校验存在 + validateGiftExists(updateReqVO.getId()); + // 更新 + GiftDO updateObj = BeanUtils.toBean(updateReqVO, GiftDO.class); + giftMapper.updateById(updateObj); + } + + /** + * 删除礼物商品 + */ + @Override + public void deleteGift(Long id) { + // 校验存在 + validateGiftExists(id); + // 删除 + giftMapper.deleteById(id); + } + + /** + * 获得礼物商品 + */ + @Override + public GiftDO getGift(Long id) { + return giftMapper.selectById(id); + } + + /** + * 获得礼物商品分页 + */ + @Override + public PageResult getGiftPage(GiftPageReqVO pageReqVO) { + return giftMapper.selectPage(pageReqVO); + } + + private void validateGiftExists(Long id) { + if (giftMapper.selectById(id) == null) { + throw exception(GIFT_NOT_EXISTS); + } + } + +} \ No newline at end of file diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/recent/RecentServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/recent/RecentServiceImpl.java index b938938..eec9a6b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/recent/RecentServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/recent/RecentServiceImpl.java @@ -46,8 +46,6 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU /** * 朋友圈 Service 实现类 - * - * @author 聊天交友 */ @Slf4j @Service