Browse Source

商品增加商品参数字段

zyj
sj 2 years ago
parent
commit
ddc1cddcb9
  1. 9
      zsw-bxg/src/main/java/co/yixiang/modules/product/domain/YxStoreProduct.java
  2. 5
      zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java
  3. 11
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/Parameter.java
  4. 4
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/ProductDto.java
  5. 7
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java
  6. 2
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java
  7. 4
      zsw-bxg/src/main/java/co/yixiang/modules/product/vo/YxStoreProductQueryVo.java

9
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.hutool.core.bean.copier.CopyOptions;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain;
import co.yixiang.modules.category.domain.YxStoreCategory; import co.yixiang.modules.category.domain.YxStoreCategory;
import co.yixiang.modules.product.service.dto.Parameter;
import co.yixiang.modules.store.domain.YxStoreBrand; import co.yixiang.modules.store.domain.YxStoreBrand;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -27,6 +29,7 @@ import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
/** /**
* @author hupeng * @author hupeng
@ -34,7 +37,7 @@ import java.math.BigDecimal;
*/ */
@TableName("yx_store_product") @TableName(value = "yx_store_product",autoResultMap = true)
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ -178,6 +181,10 @@ public class YxStoreProduct extends BaseDomain {
@ApiModelProperty(value = "商品详情") @ApiModelProperty(value = "商品详情")
private String description; private String description;
/** 商品参数 */
@ApiModelProperty(value = "商品参数")
@TableField(typeHandler = JacksonTypeHandler.class)
private ArrayList<Parameter> parameter;
/** 是否包邮 */ /** 是否包邮 */
@ApiModelProperty(value = "是否包邮") @ApiModelProperty(value = "是否包邮")

5
zsw-bxg/src/main/java/co/yixiang/modules/product/rest/StoreProductController.java

@ -119,6 +119,7 @@ public class StoreProductController {
@DeleteMapping(value = "/yxStoreProduct/{id}") @DeleteMapping(value = "/yxStoreProduct/{id}")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')") @PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
public ResponseEntity delete(@PathVariable Long id){ public ResponseEntity delete(@PathVariable Long id){
//这里增加评测/热榜判断
yxStoreProductService.removeById(id); yxStoreProductService.removeById(id);
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
@ -174,9 +175,11 @@ public class StoreProductController {
return new ResponseEntity<>(map,HttpStatus.OK); return new ResponseEntity<>(map,HttpStatus.OK);
} }
//处理商品详情
//处理商品详情/商品参数
YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id); YxStoreProduct yxStoreProduct = yxStoreProductService.getById(id);
ProductDto productDto = new ProductDto(); ProductDto productDto = new ProductDto();
productDto.setParameter(yxStoreProduct.getParameter());
BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage"); BeanUtil.copyProperties(yxStoreProduct,productDto,"sliderImage");
productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(","))); productDto.setSliderImage(Arrays.asList(yxStoreProduct.getSliderImage().split(",")));
YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService YxStoreProductAttrResult storeProductAttrResult = yxStoreProductAttrResultService

11
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;
}

4
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.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -85,6 +86,9 @@ public class ProductDto
@JsonProperty("is_show") @JsonProperty("is_show")
private Integer isShow; private Integer isShow;
/** 商品参数 */
private ArrayList<Parameter> parameter;
/** 是否热卖 */ /** 是否热卖 */
@JsonProperty("is_hot") @JsonProperty("is_hot")
private Integer isHot; private Integer isHot;

7
zsw-bxg/src/main/java/co/yixiang/modules/product/service/dto/StoreProductDto.java

@ -1,5 +1,7 @@
package co.yixiang.modules.product.service.dto; 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 com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -7,7 +9,9 @@ import lombok.ToString;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -48,6 +52,7 @@ public class StoreProductDto
@NotBlank(message = "关键字不能为空") @NotBlank(message = "关键字不能为空")
private String keyword; private String keyword;
/** 商品条码(一维码) */ /** 商品条码(一维码) */
@JsonProperty("bar_code") @JsonProperty("bar_code")
private String barCode; private String barCode;
@ -107,6 +112,8 @@ public class StoreProductDto
@NotBlank(message = "商品详情不能为空") @NotBlank(message = "商品详情不能为空")
private String description; private String description;
/** 商品参数 */
private ArrayList<Parameter> parameter;
/** 是否包邮 */ /** 是否包邮 */
@JsonProperty("is_postage") @JsonProperty("is_postage")

2
zsw-bxg/src/main/java/co/yixiang/modules/product/service/mapper/StoreProductMapper.java

@ -106,7 +106,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
void deleteForwardImg(@Param("id") Long id,@Param("name") String name); void deleteForwardImg(@Param("id") Long id,@Param("name") String name);
@Override @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," + "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}") "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 extends IPage<YxStoreProduct>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<YxStoreProduct> queryWrapper); <E extends IPage<YxStoreProduct>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<YxStoreProduct> queryWrapper);

4
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 cn.hutool.core.util.StrUtil;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue; import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.dto.Parameter;
import co.yixiang.serializer.BigDecimalSerializer; import co.yixiang.serializer.BigDecimalSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -119,6 +120,9 @@ public class YxStoreProductQueryVo implements Serializable {
@ApiModelProperty(value = "产品描述") @ApiModelProperty(value = "产品描述")
private String description; private String description;
@ApiModelProperty(value = "商品参数")
private ArrayList<Parameter> parameter;
@ApiModelProperty(value = "是否包邮") @ApiModelProperty(value = "是否包邮")
private Integer isPostage; private Integer isPostage;

Loading…
Cancel
Save