提交 aeb6b386 作者: xiaowang

产品管理及品牌

上级 be517ab5
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.dto.BrandInfoDTO;
import com.mmc.pms.service.BrandManageService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/3/14 13:22
* 概要:
*/
@RestController
@RequestMapping("/brand")
@Api(tags = {"品牌管理-相关接口"})
public class BrandManageController {
@Autowired
private BrandManageService brandManageService;
@ApiOperation(value = "新增品牌")
@GetMapping("addBrandInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addBrandInfo(@ApiParam(value = "品牌名称") @RequestParam String brandName) {
return brandManageService.addBrandInfo(brandName);
}
@ApiOperation(value = "品牌列表")
@GetMapping("listBrandInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = BrandInfoDTO.class)})
public ResultBody listBrandInfo(@RequestParam Integer pageNo, @RequestParam Integer pageSize) {
return ResultBody.success(brandManageService.listBrandInfo(pageNo, pageSize));
}
// @ApiOperation(value = "删除品牌")
// @GetMapping("deleteBrandInfo")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// public ResultBody deleteBrandInfo(Integer id) {
// return brandManageService.deleteBrandInfo(id);
// }
@ApiOperation(value = "编辑品牌")
@GetMapping("editBrandInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editBrandInfo(Integer id, String brandName) {
return brandManageService.editBrandInfo(id, brandName);
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.dto.*;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.vo.Create;
import com.mmc.pms.model.vo.ProductSpecCPQVO;
import com.mmc.pms.model.vo.Update;
import com.mmc.pms.service.ProductSkuService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @Author LW
* @date 2022/9/22 10:28
* 概要:
*/
@RestController
@RequestMapping("/product/spec/")
@Api(tags = {"产品管理模块-相关接口"})
public class ProductSpecController {
@Autowired
private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param);
}
@ApiOperation(value = "产品sku详情")
@GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id);
}
@ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param);
}
@ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
return productSkuService.listPageProductSku(productSkuQO);
}
// @ApiOperation(value = "产品sku管理---删除产品sku")
// @GetMapping("removeProductSku")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// public ResultBody removeProductSku(@ApiParam("id") @RequestParam(value = "id") Integer id) {
// return productSpecService.removeProductSku(id);
// }
//
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param);
}
@ApiOperation(value = "产品规格编辑回显")
@GetMapping("getProductSpecDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody getProductSpecDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSpecDetail(id);
}
@ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId);
}
@ApiOperation(value = "产品规格管理-价格配置")
@PostMapping("productSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.updateProductSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "产品规格管理---获取价格配置信息")
@PostMapping("getProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ResultBody getProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.getProductSpecCPQ(productSpecCPQVO);
}
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
// @ApiOperation(value = "产品规格管理---删除规格")
// @GetMapping("removeProductSpec")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
// public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
// return productSpecService.removeProductSpec(id);
// }
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId,
// @RequestParam(value = "tagId")Integer tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.BrandInfoDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* @Author LW
* @date 2023/3/14 13:27
* 概要:
*/
@Mapper
public interface BrandManageDao {
/**
* 插入品牌信息
*
* @param brandInfoDO 品牌信息
* @return int
*/
void insertBrandInfo(BrandInfoDO brandInfoDO);
/**
* 数品牌信息名字
* 品牌信息名字计数
*
* @param brandName 品牌名称
* @param id id
* @return int
*/
int countBrandInfoByName(Integer id, String brandName);
/**
* 通过id删除品牌信息
*
* @param id id
*/
void removeBrandInfoById(Integer id);
/**
* 品牌信息id列表
*
* @param ids id
* @return {@link List}<{@link BrandInfoDO}>
*/
List<BrandInfoDO> listBrandInfoByIds(@Param("ids") Set<Integer> ids);
/**
* 品牌列表信息
*
* @param itemIndex 项指数
* @param pageSize 页面大小
* @return {@link List}<{@link BrandInfoDO}>
*/
List<BrandInfoDO> listBrandInfo(Integer itemIndex, Integer pageSize);
/**
* 数品牌信息
*
* @return int
*/
int countBrandInfo();
/**
* 更新品牌信息
*
* @param brandInfoDO 品牌信息做
*/
void updateBrandInfo(BrandInfoDO brandInfoDO);
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.ProductSkuDO;
import com.mmc.pms.entity.ProductSpecDO;
import com.mmc.pms.entity.ProductSpecPriceDO;
import com.mmc.pms.model.dto.ProductSkuVO;
import com.mmc.pms.model.dto.ProductSpecVO;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.vo.ProductSpecCPQVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Mapper
* @createDate 2023-05-25 14:55:56
* @Entity com.mmc.pms.entity.ProductSku
*/
@Mapper
public interface ProductSkuDao {
int countSkuName(ProductSkuVO param);
int insertProductSku(ProductSkuDO productSkuDO);
int countSkuIsExist(Integer id);
ProductSkuDO getProductSkuDetail(Integer id);
int updateProductSku(ProductSkuDO productSkuDO);
int countListPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO);
int countSpecName(ProductSpecVO param);
int insertProductSpec(ProductSpecDO productSpecDO);
int updateProductSpec(ProductSpecDO productSpecDO);
int countSpecIsExist(Integer id);
ProductSpecDO getProductSpecDetail(Integer id);
int countListPageProductSpec(Integer productSkuId);
List<ProductSpecDO> listPageProductSpec(int i, Integer pageSize, Integer productSkuId);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPrice(ProductSpecCPQVO productSpecCPQVO);
}
package com.mmc.pms.entity;
import com.mmc.pms.model.dto.BrandInfoDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author LW
* @date 2022/6/20 16:33
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BrandInfoDO implements Serializable {
private static final long serialVersionUID = 2832084701380349536L;
private Integer id;
private String brandName;
private Date createTime;
private Date updateTime;
private Integer delete;
public BrandInfoDO(String brandName) {
this.brandName = brandName;
}
public BrandInfoDTO buildBrandInfoDTO() {
return BrandInfoDTO.builder().id(id).brandName(brandName).createTime(createTime).build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.dto.GoodsProductSkuDTO;
import com.mmc.pms.model.dto.GoodsProductSkuVO;
import com.mmc.pms.model.dto.ProductSkuDTO;
import com.mmc.pms.model.dto.ProductSkuVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -18,46 +18,48 @@ import java.util.Date;
@AllArgsConstructor
@Accessors(chain = true)
public class ProductSkuDO implements Serializable {
private static final long serialVersionUID = -2830786012593215477L;
private Integer id;
private String productName;
private Integer goodsTypeId;
private String model;
private String productBrand;
private Date createTime;
private Date updateTime;
private Integer brandInfoId;
private Integer deleted;
private Integer sortTypeId;
private Integer customize;
/** 辅助字段 begin */
private String typeName;
private String sortName;
/** 辅助字段 end */
public ProductSkuDO(GoodsProductSkuVO param) {
this.id = param.getId();
this.goodsTypeId = param.getGoodsTypeId();
this.model = param.getModel();
this.productName = param.getProductName();
this.brandInfoId = param.getProductBrandId();
this.sortTypeId = param.getDirectoryId();
}
public GoodsProductSkuDTO buildGoodsProductSkuDTO() {
return GoodsProductSkuDTO.builder()
.id(this.id)
.productName(this.productName)
.goodsTypeId(this.goodsTypeId)
.model(this.model)
.productBrand(this.productBrand)
.productBrandId(brandInfoId)
.createTime(this.createTime)
.typeName(this.typeName)
.directoryId(sortTypeId)
.directoryName(this.sortName)
.build();
}
private static final long serialVersionUID = -2830786012593215477L;
private Integer id;
private String productName;
private Integer categoriesId;
private String model;
private Date createTime;
private Date updateTime;
private Integer brandInfoId;
private Integer deleted;
private Integer customize;
private Integer directoryId;
/**
* 辅助字段 begin
*/
private String categoryName;
private String directoryName;
private String brandName;
/**
* 辅助字段 end
*/
public ProductSkuDO(ProductSkuVO param) {
this.id = param.getId();
this.categoriesId = param.getCategoryId();
this.model = param.getModel();
this.productName = param.getProductName();
this.brandInfoId = param.getProductBrandId();
this.directoryId = param.getDirectoryId();
}
public ProductSkuDTO buildProductSkuDTO() {
return ProductSkuDTO.builder()
.id(this.id)
.productName(this.productName)
.model(this.model)
.productBrand(this.brandName)
.createTime(this.createTime)
.categoryName(this.categoryName)
.directoryName(directoryName)
.build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.dto.ProductSpecPriceDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 产品规格价格配置表(ProductSpecPriceDO)实体类
*
* @author makejava
* @since 2023-05-25 17:51:18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductSpecPriceDO implements Serializable {
private static final long serialVersionUID = 270307563560175486L;
private Integer id;
/**
* 产品规格id
*/
private Integer productSpecId;
/**
* 渠道等级id
*/
private Integer cooperationTag;
/**
* 价格
*/
private BigDecimal price;
private Integer type;
private Date createTime;
private Date updateTime;
private Integer leaseTerm;
public ProductSpecPriceDTO buildProductSpecPriceDTO() {
return ProductSpecPriceDTO.builder().id(this.id)
.cooperationTag(this.cooperationTag)
.price(this.price).createTime(this.createTime)
.leaseTerm(this.leaseTerm).build();
}
}
package com.mmc.pms.model.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author LW
* @date 2022/6/20 16:33
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BrandInfoDTO implements Serializable {
private static final long serialVersionUID = 2845503394350034900L;
private Integer id;
private String brandName;
private Date createTime;
}
package com.mmc.pms.model.dto;
import com.mmc.pms.entity.GoodsConfigExportDO;
import com.mmc.pms.entity.GoodsTypeDO;
import com.mmc.pms.entity.GoodsVideoDO;
import com.mmc.pms.model.vo.CategoryParamAndValueVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 13:41 @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
public class GoodsInfoDO implements Serializable {
private static final long serialVersionUID = -1329342381196659417L;
private Integer id;
private Integer pid;
private String goodsNo;
private String goodsName;
private Integer masterTypeId;
private Integer slaveTypeId;
private Integer shelfStatus;
private Integer skuNum;
private Integer deleted;
private Date createTime;
private Date updateTime;
private Integer goodsAttr;
private String ecoLabel;
private Integer goodsCategoryId;
private Integer repoId;
private Integer shareFlyServiceId;
private Integer goodsType;
private Integer sort;
private Integer showCode;
private Integer standardProduct;
private String tag;
/** 辅助字段-start */
private String videoUrl;
private Integer goodsVideoId;
private String goodsDesc;
private GoodsVideoDO goodsVideoDO;
private String mainImg; // 主图
private GoodsTypeDO goodsMasterType;
private GoodsTypeDO goodsSlaveType;
private String remark; // 底部备注
private Integer sortTypeId;
private List<CategoryParamAndValueVO> paramAndValue;
private GoodsConfigExportDO goodsConfigExport; // 功能清单
private Integer buyNum; // 购买数量
private String directoryName;
private Integer isCoupons;
}
package com.mmc.pms.model.dto;
import com.mmc.pms.model.vo.GoodsProductSkuVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -15,17 +16,17 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
public class ProductInventoryVO implements Serializable {
private static final long serialVersionUID = -2224789550998518979L;
private static final long serialVersionUID = -2224789550998518979L;
@ApiModelProperty(value = "是否指定 不指定0 指定1")
private Integer select;
@ApiModelProperty(value = "是否指定 不指定0 指定1")
private Integer select;
@ApiModelProperty(value = "产品sku")
private GoodsProductSkuVO productSku;
@ApiModelProperty(value = "产品sku")
private GoodsProductSkuVO productSku;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "产品规格")
private List<ProductSpecVO> productSpecList;
@ApiModelProperty(value = "产品规格")
private List<ProductSpecVO> productSpecList;
}
......@@ -8,7 +8,6 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 16:29 @Version 1.0
......@@ -17,39 +16,36 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GoodsProductSkuDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
public class ProductSkuDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品类型id")
private Integer goodsTypeId;
@ApiModelProperty(value = "产品类型id")
private Integer categoriesId;
@ApiModelProperty(value = "产品类型名称")
private String typeName;
@ApiModelProperty(value = "产品类型名称")
private String categoryName;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "产品品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "产品品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "产品规格信息对象")
private List<ProductSpecDTO> productSpecList;
@ApiModelProperty(value = "目录名称")
private String directoryName;
}
......@@ -16,36 +16,27 @@ import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsProductSkuVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(
message = "修改时id不能为空",
groups = {Update.class})
private Integer id;
@NotNull(
message = "产品名称不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品名称")
private String productName;
@NotNull(
message = "产品类型不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品类型")
private Integer goodsTypeId;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
public class ProductSkuVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(message = "修改时id不能为空", groups = {Update.class})
private Integer id;
@NotNull(message = "产品名称不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品名称")
private String productName;
@NotNull(message = "产品类型id不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品类型id")
private Integer categoryId;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
}
......@@ -9,7 +9,6 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 15:30 @Version 1.0
......@@ -20,29 +19,26 @@ import java.util.List;
@Builder
@Accessors
public class ProductSpecDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "规格名称")
private String specName;
@ApiModelProperty(value = "规格名称")
private String specName;
@ApiModelProperty(value = "规格图片")
private String specImage;
@ApiModelProperty(value = "规格图片")
private String specImage;
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "价格配置")
private List<ProductSpecPriceDTO> priceList;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -18,18 +18,18 @@ import java.util.Date;
@AllArgsConstructor
@Builder
public class ProductSpecPriceDTO implements Serializable {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "规格id")
private Integer productSpecId;
@ApiModelProperty(value = "等级标签id")
private Integer cooperationTag;
@ApiModelProperty(value = "等级标签id")
private Integer tagInfoId;
@ApiModelProperty(value = "价格")
private BigDecimal price;
@ApiModelProperty(value = "价格")
private BigDecimal price;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "租赁期限 (0:1-7天,1:8-15天,2:16-30天,3:30天以上)")
private Integer leaseTerm;
}
package com.mmc.pms.model.dto;
import com.mmc.pms.model.vo.Create;
import com.mmc.pms.model.vo.ProductSpecCPQVO;
import com.mmc.pms.model.vo.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -20,41 +19,27 @@ import java.io.Serializable;
@AllArgsConstructor
@Accessors(chain = true)
public class ProductSpecVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(
message = "修改时id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "productSkuId")
@NotNull(
message = "修改时productSkuId不能为空",
groups = {Create.class})
private Integer productSkuId;
@NotNull(
message = "规格名称不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "规格名称")
private String specName;
@NotNull(
message = "规格图片不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "规格图片")
private String specImage;
@NotNull(
message = "料号不能为空",
groups = {Update.class, Create.class})
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
@ApiModelProperty(value = "价格配置信息")
private ProductSpecCPQVO productSpecCPQVO;
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "productSkuId")
@NotNull(message = "修改时productSkuId不能为空", groups = {Create.class})
private Integer productSkuId;
@NotNull(message = "规格名称不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "规格名称")
private String specName;
@NotNull(message = "规格图片不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "规格图片")
private String specImage;
@NotNull(message = "料号不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
}
package com.mmc.pms.model.qo;
import com.mmc.pms.model.vo.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author LW
* @date 2022/9/26 11:13
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProductSkuQO implements Serializable {
private static final long serialVersionUID = 7548828456935084794L;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "产品类型")
private Integer categoryId;
@ApiModelProperty(value = "产品目录")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author LW
* @date 2022/9/23 10:33
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsProductSkuVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
@NotNull(message = "修改时id不能为空", groups = {Update.class})
private Integer id;
@NotNull(message = "产品名称不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品名称")
private String productName;
@NotNull(message = "产品类型不能为空", groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品类型")
private Integer goodsTypeId;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "产品品牌")
private String productBrand;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
}
......@@ -15,11 +15,14 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
public class ProductSpecCPQVO implements Serializable {
private static final long serialVersionUID = 6055658459871113781L;
private static final long serialVersionUID = 6055658459871113781L;
@ApiModelProperty(value = "产品规格id")
private Integer productSpecId;
@ApiModelProperty(value = "规格价格配置VO")
private List<SpecPriceVO> specPrice;
@ApiModelProperty(value = "产品规格id")
private Integer productSpecId;
@ApiModelProperty(value = "销售:0 租赁:1")
private Integer type;
@ApiModelProperty(value = "租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
private Integer leaseTerm;
@ApiModelProperty(value = "规格价格配置VO")
private List<SpecPriceVO> specPrice;
}
......@@ -14,8 +14,8 @@ import java.math.BigDecimal;
@NoArgsConstructor
@AllArgsConstructor
public class SpecPriceVO implements Serializable {
private static final long serialVersionUID = -8976672168410262190L;
private Integer id;
private Integer tagInfoId;
private BigDecimal price;
private static final long serialVersionUID = -8976672168410262190L;
private Integer id;
private Integer cooperationTag;
private BigDecimal price;
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.page.PageResult;
/**
* @Author LW
* @date 2023/3/14 13:26
* 概要:
*/
public interface BrandManageService {
/**
* 添加品牌信息
*
* @param brandName 品牌名称
* @return {@link ResultBody}
*/
ResultBody addBrandInfo(String brandName);
/**
* 品牌列表信息
*
* @param pageNo 页面没有
* @param pageSize 页面大小
* @return {@link PageResult}
*/
PageResult listBrandInfo(Integer pageNo, Integer pageSize);
// /**
// * 删除品牌信息
// *
// * @param id id
// * @return {@link ResultBody}
// */
// ResultBody deleteBrandInfo(Integer id);
/**
* 编辑品牌信息
*
* @param id id
* @param name 名字
* @return {@link ResultBody}
*/
ResultBody editBrandInfo(Integer id, String name);
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.BrandManageDao;
import com.mmc.pms.entity.BrandInfoDO;
import com.mmc.pms.model.dto.BrandInfoDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BrandManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author LW
* @date 2023/3/14 13:27
* 概要:
*/
@Service
public class BrandManageServiceImpl implements BrandManageService {
@Autowired
private BrandManageDao brandManageDao;
/**
* 添加品牌信息
*
* @param brandName 品牌名称
* @return {@link ResultBody}
*/
@Override
public ResultBody addBrandInfo(String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(null, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandManageDao.insertBrandInfo(brandInfoDO);
return ResultBody.success();
}
/**
* 品牌列表信息
*
* @return {@link ResultBody}
*/
@Override
public PageResult listBrandInfo(Integer pageNo, Integer pageSize) {
int count = brandManageDao.countBrandInfo();
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, 0);
}
int itemIndex = (pageNo - 1) * pageSize;
List<BrandInfoDO> brandInfo = brandManageDao.listBrandInfo(itemIndex, pageSize);
List<BrandInfoDTO> brandInfoList = brandInfo.stream()
.map(BrandInfoDO::buildBrandInfoDTO)
.collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, brandInfoList);
}
// /**
// * 删除品牌信息
// *
// * @param id id
// * @return {@link ResultBody}
// */
// @Override
// public ResultBody deleteBrandInfo(Integer id) {
// // 判断该品牌是否绑定产品信息
// int count = productSpecDao.countProductSpecByBrandId(id);
// if (count > 0) {
// return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL);
// }
// brandManageDao.removeBrandInfoById(id);
// return ResultBody.success();
// }
@Override
public ResultBody editBrandInfo(Integer id, String brandName) {
// 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(id, brandName);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandInfoDO.setId(id);
brandManageDao.updateBrandInfo(brandInfoDO);
return ResultBody.success();
}
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.ProductSkuDao;
import com.mmc.pms.entity.ProductSkuDO;
import com.mmc.pms.entity.ProductSpecDO;
import com.mmc.pms.entity.ProductSpecPriceDO;
import com.mmc.pms.model.dto.*;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.vo.ProductSpecCPQVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.ProductSkuService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Service实现
* @createDate 2023-05-25 14:55:56
*/
@Service
public class ProductSkuServiceImpl implements ProductSkuService {
@Autowired
private ProductSkuDao productSkuDao;
@Override
public ResultBody addProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productSkuDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
// 新增产品sku
int status = productSkuDao.insertProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
}
@Override
public ResultBody getProductSkuDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productSkuDao.countSkuIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = productSkuDao.getProductSkuDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
}
@Override
public ResultBody editProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productSkuDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
int status = productSkuDao.updateProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
}
@Override
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
int count = productSkuDao.countListPageProductSku(productSkuQO);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
}
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productSkuDao.listPageProductSku(productSkuQO);
List<ProductSkuDTO> list = productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
}
@Override
public ResultBody addOrEditProductSpec(ProductSpecVO param) {
// 获取名称判断此前是否已经存在
int count = productSkuDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
if (param.getId() == null) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
int status = productSkuDao.insertProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
int status = productSkuDao.updateProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
}
return ResultBody.success();
}
@Override
public ResultBody getProductSpecDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productSkuDao.countSpecIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSpecDO productSpecDO = productSkuDao.getProductSpecDetail(id);
return ResultBody.success(productSpecDO.buildProductSpecDTO());
}
@Override
public ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId) {
int count = productSkuDao.countListPageProductSpec(productSkuId);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<ProductSpecDO> productSpecList = productSkuDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId);
List<ProductSpecDTO> list = productSpecList.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
}
@Override
public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 判断该规格是否存在
int count = productSkuDao.countSpecIsExist(productSpecCPQVO.getProductSpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream().map(d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice());
productSpecPriceDO.setType(productSpecCPQVO.getType());
productSpecPriceDO.setProductSpecId(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(1)) {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
}).collect(Collectors.toList());
}
@Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 先删除原来该规格下的所有价格配置信息
productSkuDao.removeProductSpecCPQ(productSpecCPQVO);
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@NotNull
private ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
// 批量插入规格销售价格
if (productSpecCPQVO.getType().equals(0)) {
int status = productSkuDao.batchInsertSpecPrice(list);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
// 批量插入租赁价格
productSkuDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
}
@Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<ProductSpecPriceDO> productSpecPriceList = productSkuDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list = productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO).collect(Collectors.toList());
return ResultBody.success(list);
}
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ProductSpecPriceDO;
import com.mmc.pms.model.dto.ProductSkuVO;
import com.mmc.pms.model.dto.ProductSpecVO;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.vo.ProductSpecCPQVO;
import java.util.List;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Service
* @createDate 2023-05-25 14:55:56
*/
public interface ProductSkuService {
ResultBody addProductSku(ProductSkuVO param);
ResultBody getProductSkuDetail(Integer id);
ResultBody editProductSku(ProductSkuVO param);
ResultBody listPageProductSku(ProductSkuQO productSkuQO);
ResultBody addOrEditProductSpec(ProductSpecVO param);
ResultBody getProductSpecDetail(Integer id);
ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
}
......@@ -13,6 +13,18 @@ spring:
jedis:
pool:
max-active: 2
#mybatis-plus
mybatis-plus:
global-config:
db-config:
id-type: auto
type-aliases-package: com.mmc.pms
mapper-locations: classpath*:mapper/**/*Dao.xml
configuration:
# 开启 "_" 转大写的驼峰功能
map-underscore-to-camel-case: true
# mybatis日志
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
springfox:
documentation:
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.BrandManageDao">
<insert id="insertBrandInfo">
insert into brand_info (brand_name)
values (#{brandName});
</insert>
<update id="removeBrandInfoById">
update brand_info
set is_delete = 1
where id = #{id}
</update>
<update id="updateBrandInfo">
update brand_info
set brand_name = #{brandName}
where id = #{id}
</update>
<select id="countBrandInfoByName" resultType="java.lang.Integer">
select count(*)
from brand_info
where brand_name = #{brandName}
<if test="id!=null and id!=''">
and id <![CDATA[<>]]> #{id}
</if>
</select>
<select id="listBrandInfo" resultType="com.mmc.pms.entity.BrandInfoDO">
select id, brand_name, create_time
from brand_info
where is_delete = 0
order by create_time desc
limit #{itemIndex}, #{pageSize}
</select>
<select id="listBrandInfoByIds" resultType="com.mmc.pms.entity.BrandInfoDO">
select id,brand_name
from brand_info
where id in( <foreach collection="ids" separator="," index="index" item="item">
#{item}
</foreach>)
</select>
<select id="countBrandInfo" resultType="java.lang.Integer">
select count(*)
from brand_info
where is_delete = 0
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.ProductSkuDao">
<insert id="insertProductSku">
insert into product_sku (product_name, categories_id, model, brand_info_id, directory_id)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId})
</insert>
<insert id="insertProductSpec">
insert into product_spec (product_sku_id, spec_name, spec_image, part_no, version_desc)
values (#{productSkuId}, #{specName}, #{specImage}, #{partNo}, #{versionDesc})
</insert>
<insert id="batchInsertSpecPrice" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.pms.entity.ProductSpecPriceDO">
insert into product_spec_price (product_spec_id,cooperation_tag,price,`type`)
values
<foreach collection="list" item="item" separator=",">
(#{item.productSpecId},#{item.cooperationTag},#{item.price},#{item.type})
</foreach>
</insert>
<insert id="batchInsertLeaseSpecPrice">
insert into product_spec_price (product_spec_id,cooperation_tag,price,`type`,lease_term)
values
<foreach collection="list" item="item" separator=",">
(#{item.productSpecId},#{item.cooperationTag},#{item.price},#{item.type},#{item.leaseTerm})
</foreach>
</insert>
<update id="updateProductSku">
update product_sku
set product_name = #{productName},
categories_id = #{categoriesId},
model = #{model},
brand_info_id = #{brandInfoId},
where id = #{id}
</update>
<update id="updateProductSpec">
update product_spec
set spec_name = #{specName},
spec_image = #{specImage},
part_no = #{partNo},
version_desc = #{versionDesc},
product_sku_id = #{productSkuId}
where id = #{id}
</update>
<delete id="removeProductSpecCPQ">
DELETE
FROM product_spec_price
WHERE product_spec_id = #{id}
and `type` = #{type}
</delete>
<select id="countSkuName" resultType="java.lang.Integer">
select count(*) from product_sku
where product_name = #{productName} and is_deleted = 0
<if test="id !=null and id !=''">
and id <![CDATA[<>]]> #{id}
</if>
</select>
<select id="countSkuIsExist" resultType="java.lang.Integer">
select count(*)
from product_sku
where id = #{id}
and is_deleted = 0
</select>
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductSkuDO">
SELECT ps.id,
ps.product_name,
ps.model,
ps.create_time,
c.`name` categoryName,
d.directory_name directoryName,
bi.brand_name brandName
FROM product_sku ps
INNER JOIN categories c ON ps.categories_id = c.id
INNER JOIN `directory` d ON ps.directory_id = d.id
LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
WHERE ps.id = #{id}
</select>
<select id="countListPageProductSku" resultType="java.lang.Integer">
select count(*) from product_sku
<where>
is_deleted = 0
and customize <![CDATA[<>]]> 1
<if test="productName != null and productName !=''">
and product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and categories = #{categoryId}
</if>
<if test="directoryId != null">
and directory_id = #{directoryId}
</if>
</where>
</select>
<select id="listPageProductSku" resultType="com.mmc.pms.entity.ProductSkuDO">
SELECT
SELECT
ps.id,
ps.product_name,
ps.model,
ps.create_time,
ps.brand_info_id,
ps.categories_id,
ps.directory_id,
c.`name` categoryName,
d.directory_name directoryName,
bi.brand_name brandName
FROM
product_sku ps
INNER JOIN categories c ON ps.categories_id = c.id
INNER JOIN `directory` d ON ps.directory_id = d.id
LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
<where>
ps.is_deleted = 0
and is_customize <![CDATA[<>]]> 1
<if test="productName != null and productName != ''">
and ps.product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and ps.categories_id = #{categoryId}
</if>
<if test="directoryId != null">
and ps.directory_id = #{directoryId}
</if>
</where>
order by ps.create_time desc
limit #{pageNo},#{pageSize}
</select>
<select id="countSpecName" resultType="java.lang.Integer">
select count(*) from product_spec
where spec_name = #{specName} and is_deleted = 0 and product_sku_id = #{productSkuId}
<if test="id !=null and id !=''">
and id <![CDATA[<>]]> #{id}
</if>
</select>
<select id="countSpecIsExist" resultType="java.lang.Integer">
select count(*)
from product_spec
where id = #{id}
and is_deleted = 0
</select>
<select id="getProductSpecDetail" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_sku_id productSkuId,
spec_name specName,
spec_image specImage,
part_no partNo,
version_desc versionDesc,
create_time createTime
from product_spec
where id = #{id}
</select>
<select id="countListPageProductSpec" resultType="java.lang.Integer">
select count(*)
from product_spec
where is_deleted = 0
and product_sku_id = #{id}
</select>
<select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_sku_id productSkuId,
spec_name specName,
spec_image specImage,
part_no partNo,
version_desc versionDesc,
create_time createTime
from product_spec
where is_deleted = 0
and product_sku_id = #{productSkuId}
order by create_time desc
limit #{pageNo}, #{pageSize}
</select>
<select id="getProductSpecPrice" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
select id,
product_spec_id productSpecId,
cooperation_tag cooperationTag,
price,
create_time createTime,
lease_term
from product_spec_price
<where>
product_spec_id = #{productSpecId}
and `type` =#{type}
<if test="leaseTerm != null">
and lease_term = #{leaseTerm}
</if>
</where>
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论