文件上传https
This commit is contained in:
parent
d1bddaf892
commit
a97da6427a
|
@ -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<Banner> page = bannerService.page(new Page<>(current, pageSize),null);
|
||||
String type = bannerQueryRequest.getType();
|
||||
QueryWrapper<Banner> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isBlank(type), "type", type);
|
||||
Page<Banner> page = bannerService.page(new Page<>(current, pageSize),queryWrapper);
|
||||
List<Banner> bannerList = page.getRecords();
|
||||
List<BannerVO> bannerVOList = commonService.convertList(bannerList, BannerVO.class);
|
||||
Page<BannerVO> voPage = new Page<>();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -39,11 +39,6 @@ public class Category implements Serializable {
|
|||
private String typeUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 类别介绍
|
||||
*/
|
||||
private String typeIntro;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
|
@ -50,7 +50,6 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> 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<Category> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("typeName", typeName);
|
||||
|
@ -65,7 +64,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|||
ThrowUtils.throwIf(count > 0, ErrorCode.PARAMS_ERROR, "类别名称已存在");
|
||||
}
|
||||
// 有参数则校验
|
||||
if (StringUtils.isAnyBlank(typeUrl, typeIntro)) {
|
||||
if (StringUtils.isBlank(typeUrl)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请上传图片或填写商品详情");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user