fix(service): 修复 themeStyle=9999 时查询逻辑缺失
This commit is contained in:
@@ -3,7 +3,7 @@ package com.yolo.keyborad.controller;
|
||||
import com.yolo.keyborad.common.BaseResponse;
|
||||
import com.yolo.keyborad.common.ResultUtils;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboardThemeStylesRespVO;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboradThemesRespVO;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboardThemesRespVO;
|
||||
import com.yolo.keyborad.service.KeyboardThemeStylesService;
|
||||
import com.yolo.keyborad.service.KeyboradThemesService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -39,7 +39,7 @@ public class ThemesController {
|
||||
|
||||
@GetMapping("/listByStyle")
|
||||
@Operation(summary = "按风格查询主题", description = "按主题风格查询主题列表接口")
|
||||
public BaseResponse<List<KeyboradThemesRespVO>> listByStyle(@RequestParam("themeStyle") Long themeStyleId) {
|
||||
public BaseResponse<List<KeyboardThemesRespVO>> listByStyle(@RequestParam("themeStyle") Long themeStyleId) {
|
||||
return ResultUtils.success(themesService.selectThemesByStyle(themeStyleId));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.yolo.keyborad.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yolo.keyborad.model.entity.KeyboradThemes;
|
||||
import com.yolo.keyborad.model.entity.KeyboardThemes;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/9 14:51
|
||||
*/
|
||||
|
||||
public interface KeyboradThemesMapper extends BaseMapper<KeyboradThemes> {
|
||||
public interface KeyboardThemesMapper extends BaseMapper<KeyboardThemes> {
|
||||
}
|
||||
@@ -11,87 +11,92 @@ import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/9 14:51
|
||||
* @date: 2025/12/9 19:47
|
||||
*/
|
||||
|
||||
|
||||
@Schema
|
||||
@Data
|
||||
@TableName(value = "keyborad_themes")
|
||||
public class KeyboradThemes {
|
||||
/**
|
||||
* 主键 Id
|
||||
*/
|
||||
@TableName(value = "keyboard_themes")
|
||||
public class KeyboardThemes {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(description="主键 Id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 键盘皮肤名称
|
||||
*/
|
||||
@TableField(value = "theme_name")
|
||||
@Schema(description="键盘皮肤名称")
|
||||
private String themeName;
|
||||
|
||||
/**
|
||||
* 键盘价格
|
||||
*/
|
||||
@TableField(value = "theme_price")
|
||||
@Schema(description="键盘价格")
|
||||
private BigDecimal themePrice;
|
||||
|
||||
/**
|
||||
* 主题标签
|
||||
*/
|
||||
@TableField(value = "theme_tag")
|
||||
@Schema(description="主题标签")
|
||||
private String themeTag;
|
||||
|
||||
/**
|
||||
* 主题下载次数
|
||||
*/
|
||||
@TableField(value = "theme_download")
|
||||
@Schema(description="主题下载次数")
|
||||
private String themeDownload;
|
||||
|
||||
/**
|
||||
* 主题风格
|
||||
*/
|
||||
@TableField(value = "theme_style")
|
||||
@Schema(description="主题风格")
|
||||
private Long themeStyle;
|
||||
|
||||
/**
|
||||
* 主题状态
|
||||
* 主题上架状态
|
||||
*/
|
||||
@TableField(value = "theme_status")
|
||||
@Schema(description="主题状态")
|
||||
@Schema(description = "主题上架状态")
|
||||
private Boolean themeStatus;
|
||||
|
||||
/**
|
||||
* 主题购买次数
|
||||
*/
|
||||
@TableField(value = "theme_purchases_number")
|
||||
@Schema(description="主题购买次数")
|
||||
private Long themePurchasesNumber;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@TableField(value = "deleted")
|
||||
@Schema(description="是否删除")
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at")
|
||||
@Schema(description="创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "updated_at")
|
||||
@Schema(description="更新时间")
|
||||
private Date updatedAt;
|
||||
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
@TableField(value = "theme_preview_image_url")
|
||||
@Schema(description = "预览图")
|
||||
private String themePreviewImageUrl;
|
||||
|
||||
/**
|
||||
* 是否免费
|
||||
*/
|
||||
@TableField(value = "is_free")
|
||||
@Schema(description = "是否免费")
|
||||
private Boolean isFree;
|
||||
|
||||
/**
|
||||
* 下载地址
|
||||
*/
|
||||
@TableField(value = "theme_download_url")
|
||||
@Schema(description = "下载地址")
|
||||
private String themeDownloadUrl;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 真实下载数量
|
||||
*/
|
||||
@TableField(value = "real_download_count")
|
||||
@Schema(description = "真实下载数量")
|
||||
private Long realDownloadCount;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
||||
*/
|
||||
@Schema(description = "主题返回对象")
|
||||
@Data
|
||||
public class KeyboradThemesRespVO {
|
||||
public class KeyboardThemesRespVO {
|
||||
/**
|
||||
* 主键 Id
|
||||
*/
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.yolo.keyborad.service;
|
||||
|
||||
import com.yolo.keyborad.model.entity.KeyboradThemes;
|
||||
import com.yolo.keyborad.model.entity.KeyboardThemes;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboradThemesRespVO;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboardThemesRespVO;
|
||||
|
||||
import java.util.List;
|
||||
/*
|
||||
@@ -10,19 +10,19 @@ import java.util.List;
|
||||
* @date: 2025/12/9 14:51
|
||||
*/
|
||||
|
||||
public interface KeyboradThemesService extends IService<KeyboradThemes>{
|
||||
public interface KeyboradThemesService extends IService<KeyboardThemes>{
|
||||
|
||||
/**
|
||||
* 查询所有主题列表(未删除且上架)
|
||||
* @return 主题列表
|
||||
*/
|
||||
List<KeyboradThemesRespVO> selectAllThemes();
|
||||
List<KeyboardThemesRespVO> selectAllThemes();
|
||||
|
||||
/**
|
||||
* 按主题风格查询主题列表(未删除且上架)
|
||||
* @param themeStyle 主题风格
|
||||
* @return 主题列表
|
||||
*/
|
||||
List<KeyboradThemesRespVO> selectThemesByStyle(Long themeStyle);
|
||||
List<KeyboardThemesRespVO> selectThemesByStyle(Long themeStyle);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.yolo.keyborad.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yolo.keyborad.mapper.KeyboradThemesMapper;
|
||||
import com.yolo.keyborad.model.entity.KeyboradThemes;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboradThemesRespVO;
|
||||
import com.yolo.keyborad.mapper.KeyboardThemesMapper;
|
||||
import com.yolo.keyborad.model.entity.KeyboardThemes;
|
||||
import com.yolo.keyborad.model.vo.themes.KeyboardThemesRespVO;
|
||||
import com.yolo.keyborad.service.KeyboradThemesService;
|
||||
/*
|
||||
* @author: ziin
|
||||
@@ -15,31 +15,31 @@ import com.yolo.keyborad.service.KeyboradThemesService;
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class KeyboradThemesServiceImpl extends ServiceImpl<KeyboradThemesMapper, KeyboradThemes> implements KeyboradThemesService{
|
||||
public class KeyboradThemesServiceImpl extends ServiceImpl<KeyboardThemesMapper, KeyboardThemes> implements KeyboradThemesService{
|
||||
|
||||
@Override
|
||||
public List<KeyboradThemesRespVO> selectAllThemes() {
|
||||
List<KeyboradThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboradThemes::getDeleted, false)
|
||||
.eq(KeyboradThemes::getThemeStatus, false)
|
||||
public List<KeyboardThemesRespVO> selectAllThemes() {
|
||||
List<KeyboardThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboardThemes::getDeleted, false)
|
||||
.eq(KeyboardThemes::getThemeStatus, false)
|
||||
.list();
|
||||
return BeanUtil.copyToList(themesList, KeyboradThemesRespVO.class);
|
||||
return BeanUtil.copyToList(themesList, KeyboardThemesRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyboradThemesRespVO> selectThemesByStyle(Long themeStyle) {
|
||||
public List<KeyboardThemesRespVO> selectThemesByStyle(Long themeStyle) {
|
||||
if (themeStyle == 9999) {
|
||||
List<KeyboradThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboradThemes::getDeleted, false)
|
||||
.eq(KeyboradThemes::getThemeStatus, false)
|
||||
List<KeyboardThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboardThemes::getDeleted, false)
|
||||
.eq(KeyboardThemes::getThemeStatus, false)
|
||||
.list();
|
||||
return BeanUtil.copyToList(themesList, KeyboradThemesRespVO.class);
|
||||
return BeanUtil.copyToList(themesList, KeyboardThemesRespVO.class);
|
||||
}
|
||||
List<KeyboradThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboradThemes::getDeleted, false)
|
||||
.eq(KeyboradThemes::getThemeStatus, false)
|
||||
.eq(KeyboradThemes::getThemeStyle, themeStyle)
|
||||
List<KeyboardThemes> themesList = this.lambdaQuery()
|
||||
.eq(KeyboardThemes::getDeleted, false)
|
||||
.eq(KeyboardThemes::getThemeStatus, false)
|
||||
.eq(KeyboardThemes::getThemeStyle, themeStyle)
|
||||
.list();
|
||||
return BeanUtil.copyToList(themesList, KeyboradThemesRespVO.class);
|
||||
return BeanUtil.copyToList(themesList, KeyboardThemesRespVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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.keyborad.mapper.KeyboradThemesMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yolo.keyborad.model.entity.KeyboradThemes">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table keyborad_themes-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="theme_name" jdbcType="VARCHAR" property="themeName" />
|
||||
<result column="theme_price" jdbcType="NUMERIC" property="themePrice" />
|
||||
<result column="theme_tag" jdbcType="CHAR" property="themeTag" />
|
||||
<result column="theme_download" jdbcType="VARCHAR" property="themeDownload" />
|
||||
<result column="theme_style" jdbcType="BIGINT" property="themeStyle" />
|
||||
<result column="theme_status" jdbcType="BOOLEAN" property="themeStatus" />
|
||||
<result column="theme_purchases_number" jdbcType="BIGINT" property="themePurchasesNumber" />
|
||||
<result column="deleted" jdbcType="BOOLEAN" property="deleted" />
|
||||
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, theme_name, theme_price, theme_tag, theme_download, theme_style, theme_status,
|
||||
theme_purchases_number, deleted, created_at, updated_at
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user