feat(themes): 新增键盘皮肤管理后台功能
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
package com.yolo.keyboard.controller.admin.themes;
|
||||
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesPageReqVO;
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesRespVO;
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesSaveReqVO;
|
||||
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
||||
import com.yolo.keyboard.service.themes.KeyboardThemesService;
|
||||
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.*;
|
||||
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 键盘皮肤")
|
||||
@RestController
|
||||
@RequestMapping("/keyboard/themes")
|
||||
@Validated
|
||||
public class KeyboardThemesController {
|
||||
|
||||
@Resource
|
||||
private KeyboardThemesService themesService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建键盘皮肤")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:create')")
|
||||
public CommonResult<Long> createThemes(@Valid @RequestBody KeyboardThemesSaveReqVO createReqVO) {
|
||||
return success(themesService.createThemes(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新键盘皮肤")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:update')")
|
||||
public CommonResult<Boolean> updateThemes(@Valid @RequestBody KeyboardThemesSaveReqVO updateReqVO) {
|
||||
themesService.updateThemes(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除键盘皮肤")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:delete')")
|
||||
public CommonResult<Boolean> deleteThemes(@RequestParam("id") Long id) {
|
||||
themesService.deleteThemes(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除键盘皮肤")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:delete')")
|
||||
public CommonResult<Boolean> deleteThemesList(@RequestParam("ids") List<Long> ids) {
|
||||
themesService.deleteThemesListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得键盘皮肤")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:query')")
|
||||
public CommonResult<KeyboardThemesRespVO> getThemes(@RequestParam("id") Long id) {
|
||||
KeyboardThemesDO themes = themesService.getThemes(id);
|
||||
return success(BeanUtils.toBean(themes, KeyboardThemesRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得键盘皮肤分页")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:query')")
|
||||
public CommonResult<PageResult<KeyboardThemesRespVO>> getThemesPage(@Valid KeyboardThemesPageReqVO pageReqVO) {
|
||||
PageResult<KeyboardThemesDO> pageResult = themesService.getThemesPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, KeyboardThemesRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出键盘皮肤 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('keyboard:themes:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportThemesExcel(@Valid KeyboardThemesPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<KeyboardThemesDO> list = themesService.getThemesPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "键盘皮肤.xls", "数据", KeyboardThemesRespVO.class,
|
||||
BeanUtils.toBean(list, KeyboardThemesRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.yolo.keyboard.controller.admin.themes.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 KeyboardThemesPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "键盘皮肤名称", example = "李四")
|
||||
private String themeName;
|
||||
|
||||
@Schema(description = "键盘价格", example = "29564")
|
||||
private BigDecimal themePrice;
|
||||
|
||||
@Schema(description = "主题标签")
|
||||
private Object themeTag;
|
||||
|
||||
@Schema(description = "主题下载次数")
|
||||
private String themeDownload;
|
||||
|
||||
@Schema(description = "主题风格")
|
||||
private Long themeStyle;
|
||||
|
||||
@Schema(description = "主题上架状态", example = "2")
|
||||
private Boolean themeStatus;
|
||||
|
||||
@Schema(description = "主题购买次数")
|
||||
private Long themePurchasesNumber;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "预览图", example = "https://www.iocoder.cn")
|
||||
private String themePreviewImageUrl;
|
||||
|
||||
@Schema(description = "是否免费")
|
||||
private Boolean isFree;
|
||||
|
||||
@Schema(description = "下载地址", example = "https://www.iocoder.cn")
|
||||
private String themeDownloadUrl;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "真实下载数量", example = "3353")
|
||||
private Long realDownloadCount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yolo.keyboard.controller.admin.themes.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 KeyboardThemesRespVO {
|
||||
|
||||
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19865")
|
||||
@ExcelProperty("主键 Id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "键盘皮肤名称", example = "李四")
|
||||
@ExcelProperty("键盘皮肤名称")
|
||||
private String themeName;
|
||||
|
||||
@Schema(description = "键盘价格", example = "29564")
|
||||
@ExcelProperty("键盘价格")
|
||||
private BigDecimal themePrice;
|
||||
|
||||
@Schema(description = "主题标签")
|
||||
@ExcelProperty("主题标签")
|
||||
private Object themeTag;
|
||||
|
||||
@Schema(description = "主题下载次数")
|
||||
@ExcelProperty("主题下载次数")
|
||||
private String themeDownload;
|
||||
|
||||
@Schema(description = "主题风格")
|
||||
@ExcelProperty("主题风格")
|
||||
private Long themeStyle;
|
||||
|
||||
@Schema(description = "主题上架状态", example = "2")
|
||||
@ExcelProperty("主题上架状态")
|
||||
private Boolean themeStatus;
|
||||
|
||||
@Schema(description = "主题购买次数")
|
||||
@ExcelProperty("主题购买次数")
|
||||
private Long themePurchasesNumber;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "预览图", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("预览图")
|
||||
private String themePreviewImageUrl;
|
||||
|
||||
@Schema(description = "是否免费")
|
||||
@ExcelProperty("是否免费")
|
||||
private Boolean isFree;
|
||||
|
||||
@Schema(description = "下载地址", example = "https://www.iocoder.cn")
|
||||
@ExcelProperty("下载地址")
|
||||
private String themeDownloadUrl;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "真实下载数量", example = "3353")
|
||||
@ExcelProperty("真实下载数量")
|
||||
private Long realDownloadCount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yolo.keyboard.controller.admin.themes.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 KeyboardThemesSaveReqVO {
|
||||
|
||||
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19865")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "键盘皮肤名称", example = "李四")
|
||||
private String themeName;
|
||||
|
||||
@Schema(description = "键盘价格", example = "29564")
|
||||
private BigDecimal themePrice;
|
||||
|
||||
@Schema(description = "主题标签")
|
||||
private Object themeTag;
|
||||
|
||||
@Schema(description = "主题下载次数")
|
||||
private String themeDownload;
|
||||
|
||||
@Schema(description = "主题风格")
|
||||
private Long themeStyle;
|
||||
|
||||
@Schema(description = "主题上架状态", example = "2")
|
||||
private Boolean themeStatus;
|
||||
|
||||
@Schema(description = "主题购买次数")
|
||||
private Long themePurchasesNumber;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
@Schema(description = "预览图", example = "https://www.iocoder.cn")
|
||||
private String themePreviewImageUrl;
|
||||
|
||||
@Schema(description = "是否免费")
|
||||
private Boolean isFree;
|
||||
|
||||
@Schema(description = "下载地址", example = "https://www.iocoder.cn")
|
||||
private String themeDownloadUrl;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "真实下载数量", example = "3353")
|
||||
private Long realDownloadCount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yolo.keyboard.dal.dataobject.themes;
|
||||
|
||||
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 键盘皮肤 DO
|
||||
*
|
||||
* @author ziin
|
||||
*/
|
||||
@TableName("keyboard_themes")
|
||||
@KeySequence("keyboard_themes_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TenantIgnore
|
||||
public class KeyboardThemesDO {
|
||||
|
||||
/**
|
||||
* 主键 Id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 键盘皮肤名称
|
||||
*/
|
||||
private String themeName;
|
||||
/**
|
||||
* 键盘价格
|
||||
*/
|
||||
private BigDecimal themePrice;
|
||||
/**
|
||||
* 主题标签
|
||||
*/
|
||||
private Object themeTag;
|
||||
/**
|
||||
* 主题下载次数
|
||||
*/
|
||||
private String themeDownload;
|
||||
/**
|
||||
* 主题风格
|
||||
*/
|
||||
private Long themeStyle;
|
||||
/**
|
||||
* 主题上架状态
|
||||
*/
|
||||
private Boolean themeStatus;
|
||||
/**
|
||||
* 主题购买次数
|
||||
*/
|
||||
private Long themePurchasesNumber;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createdAt;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updatedAt;
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
private String themePreviewImageUrl;
|
||||
/**
|
||||
* 是否免费
|
||||
*/
|
||||
private Boolean isFree;
|
||||
/**
|
||||
* 下载地址
|
||||
*/
|
||||
private String themeDownloadUrl;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 真实下载数量
|
||||
*/
|
||||
private Long realDownloadCount;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yolo.keyboard.dal.mysql.themes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesPageReqVO;
|
||||
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
||||
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 org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 键盘皮肤 Mapper
|
||||
*
|
||||
* @author ziin
|
||||
*/
|
||||
@Mapper
|
||||
public interface KeyboardThemesMapper extends BaseMapperX<KeyboardThemesDO> {
|
||||
|
||||
default PageResult<KeyboardThemesDO> selectPage(KeyboardThemesPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardThemesDO>()
|
||||
.likeIfPresent(KeyboardThemesDO::getThemeName, reqVO.getThemeName())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemePrice, reqVO.getThemePrice())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemeTag, reqVO.getThemeTag())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemeDownload, reqVO.getThemeDownload())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemeStyle, reqVO.getThemeStyle())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemeStatus, reqVO.getThemeStatus())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemePurchasesNumber, reqVO.getThemePurchasesNumber())
|
||||
.eqIfPresent(KeyboardThemesDO::getCreatedAt, reqVO.getCreatedAt())
|
||||
.eqIfPresent(KeyboardThemesDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemePreviewImageUrl, reqVO.getThemePreviewImageUrl())
|
||||
.eqIfPresent(KeyboardThemesDO::getIsFree, reqVO.getIsFree())
|
||||
.eqIfPresent(KeyboardThemesDO::getThemeDownloadUrl, reqVO.getThemeDownloadUrl())
|
||||
.eqIfPresent(KeyboardThemesDO::getSort, reqVO.getSort())
|
||||
.eqIfPresent(KeyboardThemesDO::getRealDownloadCount, reqVO.getRealDownloadCount())
|
||||
.orderByDesc(KeyboardThemesDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.yolo.keyboard.service.themes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesPageReqVO;
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesSaveReqVO;
|
||||
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
||||
import jakarta.validation.*;
|
||||
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 键盘皮肤 Service 接口
|
||||
*
|
||||
* @author ziin
|
||||
*/
|
||||
public interface KeyboardThemesService {
|
||||
|
||||
/**
|
||||
* 创建键盘皮肤
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createThemes(@Valid KeyboardThemesSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新键盘皮肤
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateThemes(@Valid KeyboardThemesSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除键盘皮肤
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteThemes(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除键盘皮肤
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteThemesListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得键盘皮肤
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 键盘皮肤
|
||||
*/
|
||||
KeyboardThemesDO getThemes(Long id);
|
||||
|
||||
/**
|
||||
* 获得键盘皮肤分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 键盘皮肤分页
|
||||
*/
|
||||
PageResult<KeyboardThemesDO> getThemesPage(KeyboardThemesPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.yolo.keyboard.service.themes;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesPageReqVO;
|
||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesSaveReqVO;
|
||||
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
||||
import com.yolo.keyboard.dal.mysql.themes.KeyboardThemesMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||
|
||||
|
||||
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.THEMES_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 键盘皮肤 Service 实现类
|
||||
*
|
||||
* @author ziin
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class KeyboardThemesServiceImpl implements KeyboardThemesService {
|
||||
|
||||
@Resource
|
||||
private KeyboardThemesMapper themesMapper;
|
||||
|
||||
@Override
|
||||
public Long createThemes(KeyboardThemesSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
KeyboardThemesDO themes = BeanUtils.toBean(createReqVO, KeyboardThemesDO.class);
|
||||
themesMapper.insert(themes);
|
||||
|
||||
// 返回
|
||||
return themes.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThemes(KeyboardThemesSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateThemesExists(updateReqVO.getId());
|
||||
// 更新
|
||||
KeyboardThemesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardThemesDO.class);
|
||||
themesMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteThemes(Long id) {
|
||||
// 校验存在
|
||||
validateThemesExists(id);
|
||||
// 删除
|
||||
themesMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteThemesListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
themesMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateThemesExists(Long id) {
|
||||
if (themesMapper.selectById(id) == null) {
|
||||
throw exception(THEMES_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyboardThemesDO getThemes(Long id) {
|
||||
return themesMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<KeyboardThemesDO> getThemesPage(KeyboardThemesPageReqVO pageReqVO) {
|
||||
return themesMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,4 +72,5 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 键盘用户 1-001-202-000 ==========
|
||||
ErrorCode KEYBOARD_USER_NOT_EXISTS = new ErrorCode(1_001_202_000, "键盘用户不存在");
|
||||
ErrorCode THEMES_NOT_EXISTS = new ErrorCode(1_001_202_001, "键盘皮肤不存在");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user