diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java index 139e156e..27b587c2 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java @@ -9,10 +9,12 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain; import co.yixiang.modules.category.domain.YxStoreCategory; +import co.yixiang.modules.product.service.dto.Parameter; import co.yixiang.modules.store.domain.YxStoreBrand; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -27,6 +29,7 @@ import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.math.BigDecimal; +import java.util.ArrayList; /** * @author hupeng @@ -34,7 +37,7 @@ import java.math.BigDecimal; */ -@TableName("yx_store_product") +@TableName(value = "yx_store_product",autoResultMap = true) @Builder @AllArgsConstructor @NoArgsConstructor @@ -178,6 +181,10 @@ public class YxStoreProduct extends BaseDomain { @ApiModelProperty(value = "商品详情") private String description; + /** 商品参数 */ + @ApiModelProperty(value = "商品参数") + @TableField(typeHandler = JacksonTypeHandler.class) + private ArrayList parameter; /** 是否包邮 */ @ApiModelProperty(value = "是否包邮") diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java index 6020da2f..e66f871a 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java @@ -119,6 +119,7 @@ public class StoreProductController { @DeleteMapping(value = "/yxStoreProduct/{id}") @PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')") public ResponseEntity delete(@PathVariable Long id){ + //这里增加评测/热榜判断 yxStoreProductService.removeById(id); return new ResponseEntity(HttpStatus.OK); } @@ -174,9 +175,11 @@ public class StoreProductController { return new ResponseEntity<>(map,HttpStatus.OK); } - //处理商品详情 + + //处理商品详情/商品参数 YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id); ProductDto productDto = new ProductDto(); + productDto.setParameter(yxStoreProduct.getParameter()); BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage"); productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(","))); YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/Parameter.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/Parameter.java new file mode 100644 index 00000000..c816cb26 --- /dev/null +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/Parameter.java @@ -0,0 +1,11 @@ +package co.yixiang.modules.product.service.dto; + +import lombok.Data; + +@Data +public class Parameter { +// 商品参数名 + private String name; +// 参数详情 + private String details; +} diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java index 1c12de4a..067eb480 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java @@ -7,6 +7,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -85,6 +86,9 @@ public class ProductDto @JsonProperty("is_show") private Integer isShow; + /** 商品参数 */ + private ArrayList parameter; + /** 是否热卖 */ @JsonProperty("is_hot") private Integer isHot; diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java index c3e267dc..f6c5cc16 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java @@ -1,5 +1,7 @@ package co.yixiang.modules.product.service.dto; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; @@ -7,7 +9,9 @@ import lombok.ToString; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; +import java.util.ArrayList; import java.util.List; +import java.util.Map; /** @@ -48,6 +52,7 @@ public class StoreProductDto @NotBlank(message = "关键字不能为空") private String keyword; + /** 商品条码(一维码) */ @JsonProperty("bar_code") private String barCode; @@ -107,6 +112,8 @@ public class StoreProductDto @NotBlank(message = "商品详情不能为空") private String description; + /** 商品参数 */ + private ArrayList parameter; /** 是否包邮 */ @JsonProperty("is_postage") diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java index badf2749..b6c24ec3 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java @@ -106,7 +106,7 @@ public interface StoreProductMapper extends CoreMapper { void deleteForwardImg(@Param("id") Long id,@Param("name") String name); @Override - @Select("SELECT id,spec_type,ot_price,mer_use,description,is_postage,is_sub,is_best,(sales+ficti) as sales,price,is_bargain,vip_price,store_name,stock," + + @Select("SELECT id,spec_type,ot_price,mer_use,description,parameter,is_postage,is_sub,is_best,(sales+ficti) as sales,price,is_bargain,vip_price,store_name,stock," + "keyword,image,cost,is_good,unit_name,is_benefit,update_time,give_integral,is_new,sort,slider_image,is_show,bar_code,postage,code_path,create_time," + "cate_id,brand_id,is_seckill,mer_id,temp_id,ficti,store_info,is_del,is_hot,is_integral,integral,browse FROM yx_store_product ${ew.customSqlSegment}") > E selectPage(E page, @Param(Constants.WRAPPER) Wrapper queryWrapper); diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java b/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java index 9cd7df50..a4bcc350 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java @@ -4,6 +4,7 @@ package co.yixiang.modules.product.vo; import cn.hutool.core.util.StrUtil; import co.yixiang.modules.product.domain.YxStoreProductAttrValue; +import co.yixiang.modules.product.service.dto.Parameter; import co.yixiang.serializer.BigDecimalSerializer; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.swagger.annotations.ApiModel; @@ -119,6 +120,9 @@ public class YxStoreProductQueryVo implements Serializable { @ApiModelProperty(value = "产品描述") private String description; + @ApiModelProperty(value = "商品参数") + private ArrayList parameter; + @ApiModelProperty(value = "是否包邮") private Integer isPostage;