提交 eed4af2d 作者: xiaowang

产品管理

上级 68d782d7
...@@ -381,10 +381,10 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -381,10 +381,10 @@ public enum ResultEnum implements BaseErrorInfoInterface {
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"), DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"),
FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"), FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"), FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"),
SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"), PRODUCT_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "产品不存在或已删除,请刷新后重试!"),
SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"), SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"),
SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"), SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"), SPEC_EXIST_UNDER_THE_SKU("40174", "该产品下有规格存在,无法删除!"),
SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"), SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"),
SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"), SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"),
CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"), CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"),
......
...@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
/** /**
...@@ -27,15 +28,17 @@ import java.util.List; ...@@ -27,15 +28,17 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/goods") @RequestMapping("/goods")
@Api(tags = {"后台-商品管理-相关接口"}) @Api(tags = {"后台-商品管理-相关接口"})
public class BackstageGoodsManageController { public class BackstageGoodsManageController extends BaseController {
@Resource private GoodsInfoService goodsInfoService; @Resource private GoodsInfoService goodsInfoService;
@ApiOperation(value = "新增(租赁/销售)商品") @ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo") @PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods( public ResultBody addGoods(
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) { @ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO,
return goodsInfoService.addGoods(goodsAddVO); HttpServletRequest request) {
return goodsInfoService.addGoods(
goodsAddVO, this.getUserLoginInfoFromRedis(request).getUserAccountId());
} }
@ApiOperation(value = "修改(租赁/销售)商品") @ApiOperation(value = "修改(租赁/销售)商品")
......
...@@ -27,7 +27,7 @@ import java.math.BigDecimal; ...@@ -27,7 +27,7 @@ import java.math.BigDecimal;
public class BackstageProductSpecController { public class BackstageProductSpecController {
@Autowired private ProductSkuService productSkuService; @Autowired private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku") @ApiOperation(value = "新增产品")
@PostMapping("addProductSku") @PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku( public ResultBody addProductSku(
...@@ -35,14 +35,14 @@ public class BackstageProductSpecController { ...@@ -35,14 +35,14 @@ public class BackstageProductSpecController {
return productSkuService.addProductSku(param); return productSkuService.addProductSku(param);
} }
@ApiOperation(value = "产品sku详情") @ApiOperation(value = "产品详情")
@GetMapping("getProductSkuDetail") @GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) { public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id); return productSkuService.getProductSkuDetail(id);
} }
@ApiOperation(value = "编辑产品sku") @ApiOperation(value = "编辑产品")
@PostMapping("editProductSku") @PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku( public ResultBody editProductSku(
...@@ -57,7 +57,7 @@ public class BackstageProductSpecController { ...@@ -57,7 +57,7 @@ public class BackstageProductSpecController {
return productSkuService.productDirectoryList(); return productSkuService.productDirectoryList();
} }
@ApiOperation(value = "产品sku分页列表") @ApiOperation(value = "产品分页列表")
@PostMapping("listPageProductSku") @PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) { public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
......
...@@ -68,8 +68,6 @@ public interface GoodsInfoDao { ...@@ -68,8 +68,6 @@ public interface GoodsInfoDao {
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids); List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO); void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id); void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
......
...@@ -11,37 +11,37 @@ import java.util.List; ...@@ -11,37 +11,37 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface MiniProgramProductMallDao { public interface MiniProgramProductMallDao {
GoodsInfoDO getGoodsInfoByGoodsId(Integer goodsId); GoodsInfoDO getGoodsInfoByGoodsId(Integer goodsId);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer goodsId); List<GoodsImgDO> listGoodsInfoByGoodsId(Integer goodsId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsId); GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsId);
List<GoodsQaDO> listGoodsQaInfoByGoodsId(Integer goodsId); List<GoodsQaDO> listGoodsQaInfoByGoodsId(Integer goodsId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsId); List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsId);
List<MallProdInfoDO> getMallProdInfoByGoodsId(Integer goodsId); List<MallProdInfoDO> getMallProdInfoByGoodsId(Integer goodsId);
List<MallProdSkuInfoSpecDO> listMallProdSkuInfoSpec(Integer goodsId); List<MallProdSkuInfoSpecDO> listMallProdSkuInfoSpec(Integer goodsId);
List<ProductSpecDO> listProductSpecInfo(List<Integer> collect); List<ProductSpecDO> listProductSpecInfo(List<Integer> collect);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer goodsInfoId); List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer goodsInfoId);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId); List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
int countListGoodsByQO(GoodsInfoQO param); int countListGoodsByQO(GoodsInfoQO param);
List<GoodsInfoDO> listGoodsByQO(GoodsInfoQO param); List<GoodsInfoDO> listGoodsByQO(GoodsInfoQO param);
List<GoodsTypeDO> listIndustryIdBySort(); List<GoodsTypeDO> listIndustryIdBySort();
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId); List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
List<InventorySpecDO> listInventorySpec(List<Integer> collect); List<InventorySpecDO> listInventorySpec(List<Integer> collect);
ProductSpecDO getProductSpecDetail(Integer productSpecId); ProductSpecDO getProductSpecDetail(Integer productSpecId);
ProductSkuDO getProductSkuDetail(Integer productSkuId); ProductDO getProductSkuDetail(Integer productSkuId);
} }
...@@ -26,17 +26,17 @@ public interface ProductDao { ...@@ -26,17 +26,17 @@ public interface ProductDao {
int countSkuName(ProductSkuVO param); int countSkuName(ProductSkuVO param);
int insertProductSku(ProductSkuDO productSkuDO); int insertProductSku(ProductDO productDO);
int countSkuIsExist(Integer id); int countProductIsExist(Integer id);
ProductSkuDO getProductSkuDetail(Integer id); ProductDO getProductDetail(Integer id);
int updateProductSku(ProductSkuDO productSkuDO); int updateProductSku(ProductDO productDO);
int countListPageProductSku(ProductSkuQO productSkuQO); int countListPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO); List<ProductDO> listPageProductSku(ProductSkuQO productSkuQO);
int countSpecName(ProductSpecVO param); int countSpecName(ProductSpecVO param);
...@@ -68,7 +68,7 @@ public interface ProductDao { ...@@ -68,7 +68,7 @@ public interface ProductDao {
List<ProductSpecDO> listProductSpec(Integer id); List<ProductSpecDO> listProductSpec(Integer id);
List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId); List<ProductDO> listProductSkuDO(List<Integer> productSkuId);
List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds); List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds);
...@@ -119,5 +119,6 @@ public interface ProductDao { ...@@ -119,5 +119,6 @@ public interface ProductDao {
List<DirectoryDO> productDirectoryList(); List<DirectoryDO> productDirectoryList();
List<ProductSpecPriceDO> listAllProductSpecPriceByType(@Param("prodSkuSpecIds") Set<Integer> prodSkuSpecIds); List<ProductSpecPriceDO> listAllProductSpecPriceByType(
@Param("prodSkuSpecIds") Set<Integer> prodSkuSpecIds);
} }
...@@ -21,7 +21,7 @@ public class MallProdInfoDO implements Serializable { ...@@ -21,7 +21,7 @@ public class MallProdInfoDO implements Serializable {
private static final long serialVersionUID = 3667714765929443857L; private static final long serialVersionUID = 3667714765929443857L;
private Integer id; private Integer id;
private Integer goodsInfoId; private Integer goodsInfoId;
private Integer prodSkuId; private Integer productId;
private String prodSkuSpecName; private String prodSkuSpecName;
private Integer categoriesId; private Integer categoriesId;
private Integer chooseType; private Integer chooseType;
...@@ -57,7 +57,7 @@ public class MallProdInfoDO implements Serializable { ...@@ -57,7 +57,7 @@ public class MallProdInfoDO implements Serializable {
.chooseType(this.chooseType) .chooseType(this.chooseType)
.skuUnitId(skuUnitId) .skuUnitId(skuUnitId)
.unitName(this.unitName) .unitName(this.unitName)
.skuId(this.prodSkuId) .skuId(this.productId)
.typeName(this.typeName) .typeName(this.typeName)
.must(must) .must(must)
.skuName(this.productSkuName) .skuName(this.productSkuName)
......
...@@ -17,52 +17,39 @@ import java.util.Date; ...@@ -17,52 +17,39 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class ProductSkuDO implements Serializable { public class ProductDO implements Serializable {
private static final long serialVersionUID = -2830786012593215477L; private static final long serialVersionUID = -2830786012593215477L;
private Integer id; private Integer id;
private String productName; private String productName;
private Integer categoriesId; private String model;
private String model; private Date createTime;
private Date createTime; private Date updateTime;
private Date updateTime; private Integer brandInfoId;
private Integer brandInfoId; private Integer deleted;
private Integer deleted; private Integer customize;
private Integer customize; private Integer type;
private Integer directoryId;
/** 辅助字段 begin */
/** private String brandName;
* 辅助字段 begin
*/ /** 辅助字段 end */
private String categoryName; public ProductDO(ProductSkuVO param) {
this.id = param.getId();
private String directoryName; this.model = param.getModel();
this.productName = param.getProductName();
private String brandName; this.brandInfoId = param.getProductBrandId();
this.type = param.getType();
/** }
* 辅助字段 end
*/ public ProductSkuDTO buildProductSkuDTO() {
public ProductSkuDO(ProductSkuVO param) { return ProductSkuDTO.builder()
this.id = param.getId(); .id(this.id)
this.categoriesId = param.getCategoryId(); .productName(this.productName)
this.model = param.getModel(); .model(this.model)
this.productName = param.getProductName(); .productBrand(this.brandName)
this.brandInfoId = param.getProductBrandId(); .createTime(this.createTime)
this.directoryId = param.getDirectoryId(); .productBrandId(brandInfoId)
} .type(this.type)
.build();
public ProductSkuDTO buildProductSkuDTO() { }
return ProductSkuDTO.builder()
.id(this.id)
.productName(this.productName)
.model(this.model)
.productBrand(this.brandName)
.createTime(this.createTime)
.categoriesId(categoriesId)
.productBrandId(brandInfoId)
.directoryId(directoryId)
.categoryName(this.categoryName)
.directoryName(directoryName)
.build();
}
} }
package com.mmc.pms.entity; package com.mmc.pms.entity;
import com.mmc.pms.model.sale.dto.MallProductSpecDTO;
import com.mmc.pms.model.sale.dto.ProductSpecDTO; import com.mmc.pms.model.sale.dto.ProductSpecDTO;
import com.mmc.pms.model.sale.dto.ProductSpecVO; import com.mmc.pms.model.sale.dto.ProductSpecVO;
import com.mmc.pms.model.sale.dto.MallProductSpecDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -19,46 +19,46 @@ import java.util.Date; ...@@ -19,46 +19,46 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class ProductSpecDO implements Serializable { public class ProductSpecDO implements Serializable {
private static final long serialVersionUID = -5476701567447257133L; private static final long serialVersionUID = -5476701567447257133L;
private Integer id; private Integer id;
private Integer productSkuId; private Integer productId;
private String specName; private String specName;
private String specImage; private String specImage;
private String partNo; private String partNo;
private String versionDesc; private String versionDesc;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private Integer deleted; private Integer deleted;
public ProductSpecDO(ProductSpecVO param) { public ProductSpecDO(ProductSpecVO param) {
this.id = param.getId(); this.id = param.getId();
this.productSkuId = param.getProductSkuId(); this.productId = param.getProductSkuId();
this.specName = param.getSpecName(); this.specName = param.getSpecName();
this.specImage = param.getSpecImage(); this.specImage = param.getSpecImage();
this.partNo = param.getPartNo(); this.partNo = param.getPartNo();
this.versionDesc = param.getVersionDesc(); this.versionDesc = param.getVersionDesc();
} }
public ProductSpecDTO buildProductSpecDTO() { public ProductSpecDTO buildProductSpecDTO() {
return ProductSpecDTO.builder() return ProductSpecDTO.builder()
.id(this.id) .id(this.id)
.productSkuId(this.productSkuId) .productSkuId(this.productId)
.specName(this.specName) .specName(this.specName)
.specImage(this.specImage) .specImage(this.specImage)
.partNo(this.partNo) .partNo(this.partNo)
.versionDesc(this.versionDesc) .versionDesc(this.versionDesc)
.createTime(this.createTime) .createTime(this.createTime)
.build(); .build();
} }
public MallProductSpecDTO buildMallProductSpecDTO() { public MallProductSpecDTO buildMallProductSpecDTO() {
return MallProductSpecDTO.builder() return MallProductSpecDTO.builder()
.productSpec(this.id) .productSpec(this.id)
.productSkuId(this.productSkuId) .productSkuId(this.productId)
.specName(this.specName) .specName(this.specName)
.specImage(this.specImage) .specImage(this.specImage)
.partNo(this.partNo) .partNo(this.partNo)
.versionDesc(this.versionDesc) .versionDesc(this.versionDesc)
.build(); .build();
} }
} }
...@@ -13,30 +13,36 @@ import java.io.Serializable; ...@@ -13,30 +13,36 @@ import java.io.Serializable;
/** /**
* @Author LW * @Author LW
* @date 2022/9/26 11:13 *
* 概要: * @date 2022/9/26 11:13 概要:
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ProductSkuQO implements Serializable { public class ProductSkuQO implements Serializable {
private static final long serialVersionUID = 7548828456935084794L; private static final long serialVersionUID = 7548828456935084794L;
@ApiModelProperty(value = "产品名称")
private String productName; @ApiModelProperty(value = "产品名称")
@ApiModelProperty(value = "产品类型") private String productName;
private Integer categoryId;
@ApiModelProperty(value = "产品目录") @ApiModelProperty(value = "归属商品 0:商城商品 1:租赁商品")
private Integer directoryId; private Integer type;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class}) @ApiModelProperty(value = "页码", required = true)
@Min(value = 1, groups = Page.class) @NotNull(
private Integer pageNo; message = "页码不能为空",
@ApiModelProperty(value = "每页显示数", required = true) groups = {Page.class, Freeze.class})
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class}) @Min(value = 1, groups = Page.class)
@Min(value = 1, groups = Page.class) private Integer pageNo;
private Integer pageSize;
@ApiModelProperty(value = "每页显示数", required = true)
public void buildCurrentPage() { @NotNull(
this.pageNo = (pageNo - 1) * pageSize; message = "每页显示数不能为空",
} groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
} }
...@@ -18,38 +18,29 @@ import java.util.List; ...@@ -18,38 +18,29 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class ProductSkuDTO implements Serializable { public class ProductSkuDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L; private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ApiModelProperty(value = "产品名称") @ApiModelProperty(value = "产品名称")
private String productName; private String productName;
@ApiModelProperty(value = "产品类型id") @ApiModelProperty(value = "型号")
private Integer categoriesId; private String model;
@ApiModelProperty(value = "产品类型名称") @ApiModelProperty(value = "产品品牌")
private String categoryName; private String productBrand;
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "产品品牌id")
private String model; private Integer productBrandId;
@ApiModelProperty(value = "产品品牌") @ApiModelProperty(value = "创建时间")
private String productBrand; private Date createTime;
@ApiModelProperty(value = "产品品牌id") @ApiModelProperty(value = "归属商品 0:商城商品 1:租赁商品")
private Integer productBrandId; private Integer type;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "产品规格信息对象")
private Date createTime; private List<ProductSpecDTO> productSpecList;
@ApiModelProperty(value = "目录id")
private Integer directoryId;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "产品规格信息对象")
private List<ProductSpecDTO> productSpecList;
} }
...@@ -17,26 +17,29 @@ import java.io.Serializable; ...@@ -17,26 +17,29 @@ import java.io.Serializable;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ProductSkuVO implements Serializable { public class ProductSkuVO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L; private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
@NotNull(message = "修改时id不能为空", groups = {Update.class}) @NotNull(
private Integer id; message = "修改时id不能为空",
groups = {Update.class})
@NotNull(message = "产品名称不能为空", groups = {Update.class, Create.class}) private Integer id;
@ApiModelProperty(value = "产品名称")
private String productName; @NotNull(
message = "产品名称不能为空",
@NotNull(message = "产品类型id不能为空", groups = {Update.class, Create.class}) groups = {Update.class, Create.class})
@ApiModelProperty(value = "产品类型id") @ApiModelProperty(value = "产品名称")
private Integer categoryId; private String productName;
@ApiModelProperty(value = "型号") @NotNull(
private String model; message = "归属商品不能为空",
groups = {Create.class})
@ApiModelProperty(value = "品牌id") @ApiModelProperty(value = "归属商品")
private Integer productBrandId; private Integer type;
@ApiModelProperty(value = "目录id") @ApiModelProperty(value = "型号")
private Integer directoryId; private String model;
@ApiModelProperty(value = "品牌id")
private Integer productBrandId;
} }
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
*/ */
public interface GoodsInfoService { public interface GoodsInfoService {
ResultBody addGoods(GoodsAddVO goodsAddVO); ResultBody addGoods(GoodsAddVO goodsAddVO, Integer userAccountId);
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO); ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
......
package com.mmc.pms.service.Impl;
import com.mmc.pms.service.WebAndMiniProgramCategoryService;
import org.springframework.stereotype.Service;
/**
* @Author LW
* @date 2023/6/7 13:51
* 概要:
*/
@Service
public class WebAndMiniProgramCategoryServiceImpl implements WebAndMiniProgramCategoryService {
}
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.dao.ProductDao;
import com.mmc.pms.entity.BrandInfoDO;
import com.mmc.pms.model.sale.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 javax.annotation.Resource;
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;
@Resource private ProductDao productDao;
/**
* 添加品牌信息
*
* @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 = productDao.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.dao.InspComtDao;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.service.InspComtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 评论表 服务实现类
*
* @author Pika
* @since 2023-06-09
*/
@Service
public class InspComtServiceImpl implements InspComtService {
@Autowired private InspComtDao inspComtDao;
@Override
public List<InspComtDO> randomGetInspComtList(Integer size) {
return inspComtDao.randomGetInspComtList(size);
}
}
package com.mmc.pms.service.impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.WebProductMallDao;
import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author small @Date 2023/5/15 20:08 @Version 1.0
*/
@Service
public class WebProductMallServiceImpl implements WebProductMallService {
@Autowired private WebProductMallDao webProductMallDao;
@Override
public ResultBody productCategory() {
List<ProductCategory> category = webProductMallDao.productCategory();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productParts() {
List<ProductCategory> category = webProductMallDao.productParts();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productQuality() {
List<ProductCategory> category = webProductMallDao.productQuality();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
}
...@@ -63,13 +63,6 @@ ...@@ -63,13 +63,6 @@
insert into mall_industry_sku_info_spec(mall_industry_sku_info_id, industry_spec_id, goods_info_id) insert into mall_industry_sku_info_spec(mall_industry_sku_info_id, industry_spec_id, goods_info_id)
values (#{mallIndustrySkuInfoId}, #{industrySpecId}, #{goodsInfoId}) values (#{mallIndustrySkuInfoId}, #{industrySpecId}, #{goodsInfoId})
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" useGeneratedKeys="true"
keyProperty="id">
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag})
</insert>
<insert id="insertMallProdSkuInfoSpec"> <insert id="insertMallProdSkuInfoSpec">
insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id) insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id)
values (#{goodsInfoId}, #{mallProdSkuInfoId}, #{productSpecId}) values (#{goodsInfoId}, #{mallProdSkuInfoId}, #{productSpecId})
......
...@@ -346,7 +346,7 @@ ...@@ -346,7 +346,7 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductSkuDO"> <select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id, SELECT ps.id,
ps.product_name productName, ps.product_name productName,
ps.model, ps.model,
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.ProductDao"> <mapper namespace="com.mmc.pms.dao.ProductDao">
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductSkuDO" <insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductDO"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
insert into product (product_name, categories_id, model, brand_info_id, directory_id, customize) insert into product (product_name, model, brand_info_id, customize)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId}, #{customize}) values (#{productName}, #{model}, #{brandInfoId}, #{customize})
</insert> </insert>
<insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true" <insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true"
parameterType="com.mmc.pms.entity.ProductSpecDO"> parameterType="com.mmc.pms.entity.ProductSpecDO">
...@@ -30,15 +30,14 @@ ...@@ -30,15 +30,14 @@
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" <insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true"> keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type, insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, choose_type,
sku_unit_id, is_must, flag) sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must}, values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) #{flag})
</insert> </insert>
<update id="updateProductSku"> <update id="updateProductSku">
update product update product
set product_name = #{productName}, set product_name = #{productName},
categories_id = #{categoriesId},
model = #{model}, model = #{model},
brand_info_id = #{brandInfoId} brand_info_id = #{brandInfoId}
where id = #{id} where id = #{id}
...@@ -82,23 +81,20 @@ ...@@ -82,23 +81,20 @@
and id <![CDATA[<>]]> #{id} and id <![CDATA[<>]]> #{id}
</if> </if>
</select> </select>
<select id="countSkuIsExist" resultType="java.lang.Integer"> <select id="countProductIsExist" resultType="java.lang.Integer">
select count(*) select count(*)
from product from product
where id = #{id} where id = #{id}
and is_deleted = 0 and is_deleted = 0
</select> </select>
<select id="getProductSkuDetail" resultType="com.mmc.pms.entity.ProductSkuDO"> <select id="getProductDetail" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id, SELECT ps.id,
ps.product_name, ps.product_name,
ps.model, ps.model,
ps.type,
ps.create_time, ps.create_time,
c.`name` categoryName, bi.brand_name brandName
d.directory_name directoryName,
bi.brand_name brandName
FROM product ps FROM product 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 LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
WHERE ps.id = #{id} WHERE ps.id = #{id}
</select> </select>
...@@ -110,30 +106,22 @@ ...@@ -110,30 +106,22 @@
<if test="productName != null and productName !=''"> <if test="productName != null and productName !=''">
and product_name like CONCAT ('%',#{productName},'%') and product_name like CONCAT ('%',#{productName},'%')
</if> </if>
<if test="categoryId != null"> <if test="type != null">
and categories_id = #{categoryId} and `type` = #{type}
</if>
<if test="directoryId != null">
and directory_id = #{directoryId}
</if> </if>
</where> </where>
</select> </select>
<select id="listPageProductSku" resultType="com.mmc.pms.entity.ProductSkuDO"> <select id="listPageProductSku" resultType="com.mmc.pms.entity.ProductDO">
SELECT SELECT
ps.id, ps.id,
ps.product_name, ps.product_name,
ps.model, ps.model,
ps.create_time, ps.create_time,
ps.brand_info_id, ps.brand_info_id,
ps.categories_id, ps.type,
ps.directory_id,
c.`name` categoryName,
d.directory_name directoryName,
bi.brand_name brandName bi.brand_name brandName
FROM FROM
product ps product 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 LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
<where> <where>
ps.is_deleted = 0 ps.is_deleted = 0
...@@ -141,11 +129,8 @@ ...@@ -141,11 +129,8 @@
<if test="productName != null and productName != ''"> <if test="productName != null and productName != ''">
and ps.product_name like CONCAT ('%',#{productName},'%') and ps.product_name like CONCAT ('%',#{productName},'%')
</if> </if>
<if test="categoryId != null"> <if test="type != null">
and ps.categories_id = #{categoryId} and `type` = #{type}
</if>
<if test="directoryId != null">
and ps.directory_id = #{directoryId}
</if> </if>
</where> </where>
order by ps.create_time desc order by ps.create_time desc
...@@ -233,7 +218,7 @@ ...@@ -233,7 +218,7 @@
where is_deleted = 0 where is_deleted = 0
and product_id = #{productSkuId} and product_id = #{productSkuId}
</select> </select>
<select id="listProductSkuDO" resultType="com.mmc.pms.entity.ProductSkuDO"> <select id="listProductSkuDO" resultType="com.mmc.pms.entity.ProductDO">
SELECT ps.id, SELECT ps.id,
ps.product_name productName, ps.product_name productName,
ps.model, ps.model,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论