ProductCategory获取不到fix
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package com.aida.seller.module.listing.entity;
|
||||
|
||||
import com.aida.seller.module.listing.enums.ProductCategoryEnum;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
@@ -17,7 +15,7 @@ import java.util.List;
|
||||
* 商品实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("seller_listing")
|
||||
@TableName(value = "seller_listing", autoResultMap = true)
|
||||
public class ListingEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -68,5 +66,5 @@ public class ListingEntity implements Serializable {
|
||||
|
||||
/** 商品分类列表 */
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<ProductCategoryEnum> productCategory;
|
||||
private List<String> productCategory;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ public enum ProductCategoryEnum {
|
||||
BLOUSE("blouse", "衬衫"),
|
||||
DRESS("dress", "连衣裙"),
|
||||
SKIRT("skirt", "半身裙"),
|
||||
ACCESSORIES("accessories", "配饰");
|
||||
OTHERS("others", "其他"),
|
||||
TOP("top", "上装"),
|
||||
BOTTOMS("bottoms", "下装");
|
||||
|
||||
@JsonValue
|
||||
private final String code;
|
||||
|
||||
@@ -52,13 +52,7 @@ public class ListingServiceImpl extends ServiceImpl<ListingMapper, ListingEntity
|
||||
BeanUtils.copyProperties(dto, entity);
|
||||
entity.setSellerId(sellerId);
|
||||
|
||||
if (!CollectionUtils.isEmpty(dto.getProductCategory())) {
|
||||
List<ProductCategoryEnum> categories = dto.getProductCategory().stream()
|
||||
.map(ProductCategoryEnum::of)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
entity.setProductCategory(categories.isEmpty() ? null : categories);
|
||||
}
|
||||
|
||||
|
||||
if (dto.getDesignFor() != null && DesignForEnum.of(dto.getDesignFor()) == null) {
|
||||
throw new BusinessException("designFor 只能为 male/female");
|
||||
@@ -125,13 +119,6 @@ public class ListingServiceImpl extends ServiceImpl<ListingMapper, ListingEntity
|
||||
ListingSaveDTO dto = new ListingSaveDTO();
|
||||
BeanUtils.copyProperties(entity, dto);
|
||||
|
||||
if (!CollectionUtils.isEmpty(entity.getProductCategory())) {
|
||||
dto.setProductCategory(
|
||||
entity.getProductCategory().stream()
|
||||
.map(ProductCategoryEnum::getCode)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<ListingImageEntity> images = listingImageMapper.selectList(
|
||||
new LambdaQueryWrapper<ListingImageEntity>()
|
||||
.eq(ListingImageEntity::getListingId, id)
|
||||
|
||||
Reference in New Issue
Block a user