diff --git a/src/main/java/com/cultural/heritage/controller/other/BannerController.java b/src/main/java/com/cultural/heritage/controller/other/BannerController.java index abe77cd..c1cb9b2 100644 --- a/src/main/java/com/cultural/heritage/controller/other/BannerController.java +++ b/src/main/java/com/cultural/heritage/controller/other/BannerController.java @@ -1,6 +1,7 @@ package com.cultural.heritage.controller.other; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cultural.heritage.annotation.AuthCheck; import com.cultural.heritage.common.BaseResponse; @@ -120,7 +121,10 @@ public class BannerController { if (bannerQueryRequest == null) throw new BusinessException(ErrorCode.PARAMS_ERROR); long current = bannerQueryRequest.getCurrent(); long pageSize = bannerQueryRequest.getPageSize(); - Page page = bannerService.page(new Page<>(current, pageSize),null); + String type = bannerQueryRequest.getType(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StringUtils.isBlank(type), "type", type); + Page page = bannerService.page(new Page<>(current, pageSize),queryWrapper); List bannerList = page.getRecords(); List bannerVOList = commonService.convertList(bannerList, BannerVO.class); Page voPage = new Page<>(); diff --git a/src/main/java/com/cultural/heritage/model/dto/banner/BannerQueryRequest.java b/src/main/java/com/cultural/heritage/model/dto/banner/BannerQueryRequest.java index a07f20d..821a665 100644 --- a/src/main/java/com/cultural/heritage/model/dto/banner/BannerQueryRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/banner/BannerQueryRequest.java @@ -1,6 +1,7 @@ package com.cultural.heritage.model.dto.banner; import com.cultural.heritage.common.PageRequest; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; @@ -9,9 +10,15 @@ import java.io.Serializable; @EqualsAndHashCode(callSuper = true) @Data +@Schema(description = "轮播图查询请求体", requiredProperties = {"type"}) public class BannerQueryRequest extends PageRequest implements Serializable { + /** + * 类别 + */ + @Schema(description = "类别") + private String type; @Serial diff --git a/src/main/java/com/cultural/heritage/model/dto/category/CategoryAddRequest.java b/src/main/java/com/cultural/heritage/model/dto/category/CategoryAddRequest.java index a7cce78..c36b28d 100644 --- a/src/main/java/com/cultural/heritage/model/dto/category/CategoryAddRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/category/CategoryAddRequest.java @@ -22,11 +22,6 @@ public class CategoryAddRequest implements Serializable { @Schema(description = "商品图片地址", example = "https://xxx/xxx.jpg") private String typeUrl; - /** - * 类别简介 - */ - @Schema(description = "商品类别简介", example = "非遗香囊,匠心传承") - private String typeIntro; @Serial diff --git a/src/main/java/com/cultural/heritage/model/dto/category/CategoryUpdateRequest.java b/src/main/java/com/cultural/heritage/model/dto/category/CategoryUpdateRequest.java index f793833..227c2ed 100644 --- a/src/main/java/com/cultural/heritage/model/dto/category/CategoryUpdateRequest.java +++ b/src/main/java/com/cultural/heritage/model/dto/category/CategoryUpdateRequest.java @@ -32,14 +32,6 @@ public class CategoryUpdateRequest implements Serializable { private String typeUrl; - /** - * 类别介绍 - */ - @Schema(description = "商品类别简介", example = "非遗材料包,匠心传承") - private String typeIntro; - - - @Serial private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/cultural/heritage/model/entity/Category.java b/src/main/java/com/cultural/heritage/model/entity/Category.java index 0413a58..f776aeb 100644 --- a/src/main/java/com/cultural/heritage/model/entity/Category.java +++ b/src/main/java/com/cultural/heritage/model/entity/Category.java @@ -39,11 +39,6 @@ public class Category implements Serializable { private String typeUrl; - /** - * 类别介绍 - */ - private String typeIntro; - /** * 创建时间 diff --git a/src/main/java/com/cultural/heritage/service/good/impl/CategoryServiceImpl.java b/src/main/java/com/cultural/heritage/service/good/impl/CategoryServiceImpl.java index 7619c36..5e03aa1 100644 --- a/src/main/java/com/cultural/heritage/service/good/impl/CategoryServiceImpl.java +++ b/src/main/java/com/cultural/heritage/service/good/impl/CategoryServiceImpl.java @@ -50,7 +50,6 @@ public class CategoryServiceImpl extends ServiceImpl i public void validCategory(Category category, boolean add) { String typeName = category.getTypeName(); String typeUrl = category.getTypeUrl(); - String typeIntro = category.getTypeIntro(); ThrowUtils.throwIf(StringUtils.isBlank(typeName), ErrorCode.PARAMS_ERROR); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("typeName", typeName); @@ -65,7 +64,7 @@ public class CategoryServiceImpl extends ServiceImpl i ThrowUtils.throwIf(count > 0, ErrorCode.PARAMS_ERROR, "类别名称已存在"); } // 有参数则校验 - if (StringUtils.isAnyBlank(typeUrl, typeIntro)) { + if (StringUtils.isBlank(typeUrl)) { throw new BusinessException(ErrorCode.PARAMS_ERROR, "请上传图片或填写商品详情"); }