feat(theme-purchase): 新增皮肤购买管理模块
新增后台皮肤购买记录(积分支付)完整功能,包括 DO、Mapper、Service、Controller 及对应 VO 与错误码定义
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package com.yolo.keyboard.controller.admin.themepurchase;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.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 jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.yolo.keyboard.controller.admin.themepurchase.vo.*;
|
||||
import com.yolo.keyboard.dal.dataobject.themepurchase.KeyboardThemePurchaseDO;
|
||||
import com.yolo.keyboard.service.themepurchase.KeyboardThemePurchaseService;
|
||||
|
||||
@Tag(name = "管理后台 - 皮肤购买记录表(积分支付)")
|
||||
@RestController
|
||||
@RequestMapping("/keyboard/theme-purchase")
|
||||
@Validated
|
||||
public class KeyboardThemePurchaseController {
|
||||
|
||||
@Resource
|
||||
private KeyboardThemePurchaseService themePurchaseService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建皮肤购买记录表(积分支付)")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:create')")
|
||||
public CommonResult<Long> createThemePurchase(@Valid @RequestBody KeyboardThemePurchaseSaveReqVO createReqVO) {
|
||||
return success(themePurchaseService.createThemePurchase(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新皮肤购买记录表(积分支付)")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:update')")
|
||||
public CommonResult<Boolean> updateThemePurchase(@Valid @RequestBody KeyboardThemePurchaseSaveReqVO updateReqVO) {
|
||||
themePurchaseService.updateThemePurchase(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除皮肤购买记录表(积分支付)")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:delete')")
|
||||
public CommonResult<Boolean> deleteThemePurchase(@RequestParam("id") Long id) {
|
||||
themePurchaseService.deleteThemePurchase(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除皮肤购买记录表(积分支付)")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:delete')")
|
||||
public CommonResult<Boolean> deleteThemePurchaseList(@RequestParam("ids") List<Long> ids) {
|
||||
themePurchaseService.deleteThemePurchaseListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得皮肤购买记录表(积分支付)")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:query')")
|
||||
public CommonResult<KeyboardThemePurchaseRespVO> getThemePurchase(@RequestParam("id") Long id) {
|
||||
KeyboardThemePurchaseDO themePurchase = themePurchaseService.getThemePurchase(id);
|
||||
return success(BeanUtils.toBean(themePurchase, KeyboardThemePurchaseRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得皮肤购买记录表(积分支付)分页")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:query')")
|
||||
public CommonResult<PageResult<KeyboardThemePurchaseRespVO>> getThemePurchasePage(@Valid KeyboardThemePurchasePageReqVO pageReqVO) {
|
||||
PageResult<KeyboardThemePurchaseDO> pageResult = themePurchaseService.getThemePurchasePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, KeyboardThemePurchaseRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出皮肤购买记录表(积分支付) Excel")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:theme-purchase:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportThemePurchaseExcel(@Valid KeyboardThemePurchasePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<KeyboardThemePurchaseDO> list = themePurchaseService.getThemePurchasePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "皮肤购买记录表(积分支付).xls", "数据", KeyboardThemePurchaseRespVO.class,
|
||||
BeanUtils.toBean(list, KeyboardThemePurchaseRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.yolo.keyboard.controller.admin.themepurchase.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 皮肤购买记录表(积分支付)分页 Request VO")
|
||||
@Data
|
||||
public class KeyboardThemePurchasePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "业务订单号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "购买用户ID", example = "24047")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "主题皮肤ID", example = "28953")
|
||||
private Long themeId;
|
||||
|
||||
@Schema(description = "皮肤原始所需积分")
|
||||
private BigDecimal costPoints;
|
||||
|
||||
@Schema(description = "实际扣除积分")
|
||||
private BigDecimal paidPoints;
|
||||
|
||||
@Schema(description = "支付状态:0待支付 1已支付 2已关闭 3已退款", example = "1")
|
||||
private Short payStatus;
|
||||
|
||||
@Schema(description = "关联的积分扣费流水ID", example = "24853")
|
||||
private Long walletTxId;
|
||||
|
||||
@Schema(description = "已退款的积分数量")
|
||||
private Integer refundPoints;
|
||||
|
||||
@Schema(description = "积分退款完成时间")
|
||||
private LocalDateTime refundedAt;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "支付完成时间")
|
||||
private LocalDateTime paidAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "备注或扩展信息", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.yolo.keyboard.controller.admin.themepurchase.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 皮肤购买记录表(积分支付) Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class KeyboardThemePurchaseRespVO {
|
||||
|
||||
@Schema(description = "主键 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15568")
|
||||
@ExcelProperty("主键 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "业务订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("业务订单号")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "购买用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24047")
|
||||
@ExcelProperty("购买用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "主题皮肤ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28953")
|
||||
@ExcelProperty("主题皮肤ID")
|
||||
private Long themeId;
|
||||
|
||||
@Schema(description = "皮肤原始所需积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("皮肤原始所需积分")
|
||||
private BigDecimal costPoints;
|
||||
|
||||
@Schema(description = "实际扣除积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("实际扣除积分")
|
||||
private BigDecimal paidPoints;
|
||||
|
||||
@Schema(description = "支付状态:0待支付 1已支付 2已关闭 3已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("支付状态:0待支付 1已支付 2已关闭 3已退款")
|
||||
private Short payStatus;
|
||||
|
||||
@Schema(description = "关联的积分扣费流水ID", example = "24853")
|
||||
@ExcelProperty("关联的积分扣费流水ID")
|
||||
private Long walletTxId;
|
||||
|
||||
@Schema(description = "已退款的积分数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("已退款的积分数量")
|
||||
private Integer refundPoints;
|
||||
|
||||
@Schema(description = "积分退款完成时间")
|
||||
@ExcelProperty("积分退款完成时间")
|
||||
private LocalDateTime refundedAt;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "支付完成时间")
|
||||
@ExcelProperty("支付完成时间")
|
||||
private LocalDateTime paidAt;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "备注或扩展信息", example = "你说的对")
|
||||
@ExcelProperty("备注或扩展信息")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yolo.keyboard.controller.admin.themepurchase.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 皮肤购买记录表(积分支付)新增/修改 Request VO")
|
||||
@Data
|
||||
public class KeyboardThemePurchaseSaveReqVO {
|
||||
|
||||
@Schema(description = "主键 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15568")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "业务订单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "业务订单号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "购买用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24047")
|
||||
@NotNull(message = "购买用户ID不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "主题皮肤ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28953")
|
||||
@NotNull(message = "主题皮肤ID不能为空")
|
||||
private Long themeId;
|
||||
|
||||
@Schema(description = "皮肤原始所需积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "皮肤原始所需积分不能为空")
|
||||
private BigDecimal costPoints;
|
||||
|
||||
@Schema(description = "实际扣除积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "实际扣除积分不能为空")
|
||||
private BigDecimal paidPoints;
|
||||
|
||||
@Schema(description = "支付状态:0待支付 1已支付 2已关闭 3已退款", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "支付状态:0待支付 1已支付 2已关闭 3已退款不能为空")
|
||||
private Short payStatus;
|
||||
|
||||
@Schema(description = "关联的积分扣费流水ID", example = "24853")
|
||||
private Long walletTxId;
|
||||
|
||||
@Schema(description = "已退款的积分数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "已退款的积分数量不能为空")
|
||||
private Integer refundPoints;
|
||||
|
||||
@Schema(description = "积分退款完成时间")
|
||||
private LocalDateTime refundedAt;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "创建时间不能为空")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "支付完成时间")
|
||||
private LocalDateTime paidAt;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "更新时间不能为空")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "备注或扩展信息", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.yolo.keyboard.dal.dataobject.themepurchase;
|
||||
|
||||
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 皮肤购买记录表(积分支付) DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("keyboard_theme_purchase")
|
||||
@KeySequence("keyboard_theme_purchase_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TenantIgnore
|
||||
public class KeyboardThemePurchaseDO {
|
||||
|
||||
/**
|
||||
* 主键 ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 业务订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 购买用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 主题皮肤ID
|
||||
*/
|
||||
private Long themeId;
|
||||
/**
|
||||
* 皮肤原始所需积分
|
||||
*/
|
||||
private BigDecimal costPoints;
|
||||
/**
|
||||
* 实际扣除积分
|
||||
*/
|
||||
private BigDecimal paidPoints;
|
||||
/**
|
||||
* 支付状态:0待支付 1已支付 2已关闭 3已退款
|
||||
*/
|
||||
private Short payStatus;
|
||||
/**
|
||||
* 关联的积分扣费流水ID
|
||||
*/
|
||||
private Long walletTxId;
|
||||
/**
|
||||
* 已退款的积分数量
|
||||
*/
|
||||
private Integer refundPoints;
|
||||
/**
|
||||
* 积分退款完成时间
|
||||
*/
|
||||
private LocalDateTime refundedAt;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 支付完成时间
|
||||
*/
|
||||
private LocalDateTime paidAt;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
/**
|
||||
* 备注或扩展信息
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yolo.keyboard.dal.mysql.themepurchase;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.yolo.keyboard.dal.dataobject.themepurchase.KeyboardThemePurchaseDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.yolo.keyboard.controller.admin.themepurchase.vo.*;
|
||||
|
||||
/**
|
||||
* 皮肤购买记录表(积分支付) Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface KeyboardThemePurchaseMapper extends BaseMapperX<KeyboardThemePurchaseDO> {
|
||||
|
||||
default PageResult<KeyboardThemePurchaseDO> selectPage(KeyboardThemePurchasePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardThemePurchaseDO>()
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getOrderNo, reqVO.getOrderNo())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getThemeId, reqVO.getThemeId())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getCostPoints, reqVO.getCostPoints())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getPaidPoints, reqVO.getPaidPoints())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getPayStatus, reqVO.getPayStatus())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getWalletTxId, reqVO.getWalletTxId())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getRefundPoints, reqVO.getRefundPoints())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getRefundedAt, reqVO.getRefundedAt())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getCreatedAt, reqVO.getCreatedAt())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getPaidAt, reqVO.getPaidAt())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||
.eqIfPresent(KeyboardThemePurchaseDO::getRemark, reqVO.getRemark())
|
||||
.orderByDesc(KeyboardThemePurchaseDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yolo.keyboard.service.themepurchase;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import com.yolo.keyboard.controller.admin.themepurchase.vo.*;
|
||||
import com.yolo.keyboard.dal.dataobject.themepurchase.KeyboardThemePurchaseDO;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 皮肤购买记录表(积分支付) Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface KeyboardThemePurchaseService {
|
||||
|
||||
/**
|
||||
* 创建皮肤购买记录表(积分支付)
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createThemePurchase(@Valid KeyboardThemePurchaseSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新皮肤购买记录表(积分支付)
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateThemePurchase(@Valid KeyboardThemePurchaseSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除皮肤购买记录表(积分支付)
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteThemePurchase(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除皮肤购买记录表(积分支付)
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteThemePurchaseListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得皮肤购买记录表(积分支付)
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 皮肤购买记录表(积分支付)
|
||||
*/
|
||||
KeyboardThemePurchaseDO getThemePurchase(Long id);
|
||||
|
||||
/**
|
||||
* 获得皮肤购买记录表(积分支付)分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 皮肤购买记录表(积分支付)分页
|
||||
*/
|
||||
PageResult<KeyboardThemePurchaseDO> getThemePurchasePage(KeyboardThemePurchasePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.yolo.keyboard.service.themepurchase;
|
||||
|
||||
import com.yolo.keyboard.controller.admin.themepurchase.vo.KeyboardThemePurchasePageReqVO;
|
||||
import com.yolo.keyboard.controller.admin.themepurchase.vo.KeyboardThemePurchaseSaveReqVO;
|
||||
import com.yolo.keyboard.dal.dataobject.themepurchase.KeyboardThemePurchaseDO;
|
||||
import com.yolo.keyboard.dal.mysql.themepurchase.KeyboardThemePurchaseMapper;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.THEME_PURCHASE_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 皮肤购买记录表(积分支付) Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class KeyboardThemePurchaseServiceImpl implements KeyboardThemePurchaseService {
|
||||
|
||||
@Resource
|
||||
private KeyboardThemePurchaseMapper themePurchaseMapper;
|
||||
|
||||
@Override
|
||||
public Long createThemePurchase(KeyboardThemePurchaseSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
KeyboardThemePurchaseDO themePurchase = BeanUtils.toBean(createReqVO, KeyboardThemePurchaseDO.class);
|
||||
themePurchaseMapper.insert(themePurchase);
|
||||
|
||||
// 返回
|
||||
return themePurchase.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThemePurchase(KeyboardThemePurchaseSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateThemePurchaseExists(updateReqVO.getId());
|
||||
// 更新
|
||||
KeyboardThemePurchaseDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardThemePurchaseDO.class);
|
||||
themePurchaseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteThemePurchase(Long id) {
|
||||
// 校验存在
|
||||
validateThemePurchaseExists(id);
|
||||
// 删除
|
||||
themePurchaseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteThemePurchaseListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
themePurchaseMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateThemePurchaseExists(Long id) {
|
||||
if (themePurchaseMapper.selectById(id) == null) {
|
||||
throw exception(THEME_PURCHASE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyboardThemePurchaseDO getThemePurchase(Long id) {
|
||||
return themePurchaseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<KeyboardThemePurchaseDO> getThemePurchasePage(KeyboardThemePurchasePageReqVO pageReqVO) {
|
||||
return themePurchaseMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yolo.keyboard.dal.mysql.themepurchase.KeyboardThemePurchaseMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user