规则修改 2:sku模块
This commit is contained in:
@@ -41,8 +41,6 @@
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>2.2.20</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tashow.cloud</groupId>
|
||||
<artifactId>tashow-framework-monitor</artifactId>
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.tashow.cloud.product.controller;
|
||||
|
||||
import com.tashow.cloud.product.dto.SkuDO;
|
||||
import com.tashow.cloud.product.dto.SkuServiceDetailsDO;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.tashow.cloud.product.dto.*;
|
||||
import com.tashow.cloud.product.mapper.ProdExtendMapper;
|
||||
import com.tashow.cloud.product.mapper.SkuMapper;
|
||||
import com.tashow.cloud.product.service.ProdExtendService;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.service.ProdPropValueService;
|
||||
import com.tashow.cloud.product.service.SkuService;
|
||||
import com.tashow.cloud.product.vo.prod.ProdServiceVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuExtendVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPageReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuRespVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropRespVO;
|
||||
import com.tashow.cloud.product.vo.sku.*;
|
||||
import com.tashow.cloud.productapi.enums.BaseEnum;
|
||||
import com.tashow.cloud.productapi.enums.ProdPropRule;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -43,6 +49,17 @@ public class SkuController {
|
||||
@Resource
|
||||
private SkuService skuService;
|
||||
|
||||
@Resource
|
||||
private ProdPropService prodPropService;
|
||||
@Resource
|
||||
private ProdPropValueService prodPropValueService;
|
||||
|
||||
@Resource
|
||||
private ProdExtendService prodExtendService;
|
||||
|
||||
@Resource
|
||||
private SkuMapper skuMapper;
|
||||
|
||||
/* @PostMapping("/create")
|
||||
@Operation(summary = "创建单品SKU")
|
||||
@PreAuthorize("@ss.hasPermission('tz:sku:create')")
|
||||
@@ -52,22 +69,82 @@ public class SkuController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新单品SKU")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateSku(@Valid @RequestBody SkuSaveReqVO updateReqVO) {
|
||||
skuService.updateSku(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/updateProp")
|
||||
@Operation(summary = "更新sku规格")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateProp(@Valid @RequestBody SkuPropVO skuPropVO) {
|
||||
skuService.updateProp(skuPropVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getSKuPropList")
|
||||
@Operation(summary = "获取sku规格")
|
||||
@PermitAll
|
||||
@Parameter(name = "prodId", description = "商品id", required = true)
|
||||
public CommonResult<SkuPropInfoVO> getSKuPropList(@RequestParam("prodId") Long prodId) {
|
||||
return success(skuService.getSKuPropList(prodId));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除单品SKU")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteSku(@RequestParam("id") Long id) {
|
||||
skuService.deleteSku(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/deleteSkuList")
|
||||
@Operation(summary = "批量删除SKU")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> deleteSkuList(@RequestParam("id") List<Long> ids) {
|
||||
skuMapper.deleteByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/updateSkuShelf")
|
||||
@Operation(summary = "修改单品上下架")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Parameter(name = "isShelf", description = "是否上下架(0下架 1上架)", required = true)
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateSkuShelf(@RequestParam("id") Long id,@RequestParam("isShelf") Integer isShelf) {
|
||||
SkuDO sku = new SkuDO();
|
||||
sku.setSkuId(id);
|
||||
sku.setIsShelf(isShelf);
|
||||
skuMapper.updateBatch(sku);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/updateSkuShelfList")
|
||||
@Operation(summary = "批量上下架")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Parameter(name = "isShelf", description = "是否上下架(0下架 1上架)", required = true)
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateSkuShelfList(@RequestParam("id") List<Long> ids,@RequestParam("isShelf") Integer isShelf) {
|
||||
for(Long id:ids){
|
||||
SkuDO sku = new SkuDO();
|
||||
sku.setSkuId(id);
|
||||
sku.setIsShelf(isShelf);
|
||||
skuMapper.updateBatch(sku);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得单品SKU")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PermitAll
|
||||
public CommonResult<SkuRespVO> getSku(@RequestParam("id") Long id) {
|
||||
SkuDO sku = skuService.getSku(id);
|
||||
return success(BeanUtils.toBean(sku, SkuRespVO.class));
|
||||
@@ -93,14 +170,39 @@ public class SkuController {
|
||||
return success(skuExtendVO);
|
||||
}
|
||||
|
||||
/* @PostMapping("/updateTransportCar")
|
||||
@Operation(summary = "修改遗体接运车辆配置")
|
||||
|
||||
@PostMapping("/updateServiceDetails")
|
||||
@Operation(summary = "修改扩展服务信息配置(遗体接运扩展服务,遗体清洁配置,追思告别配置,骨灰处理配置......)")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> createSkuExtend(@RequestBody List<SkuServiceDetailsDO> transportCarList) {
|
||||
skuService.createSkuExtend(skuExtendVO);
|
||||
public CommonResult<Boolean> updateServiceDetails(@RequestBody List<SkuServiceDetailsDO> skuServiceDetailsList) {
|
||||
skuService.updateServiceDetails(skuServiceDetailsList);
|
||||
return success(true);
|
||||
}
|
||||
*/
|
||||
|
||||
@PostMapping("/updateMaterial")
|
||||
@Operation(summary = "修物料配置")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateMaterial(@RequestBody List<SkuServiceMaterialDO> skuServiceMaterialList) {
|
||||
skuService.updateMaterial(skuServiceMaterialList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/updateTransportAdress")
|
||||
@Operation(summary = "修改接运地址配置")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateTransportAdress(@RequestBody List<SkuServiceTransportDO> skuServiceTransportDOList) {
|
||||
skuService.updateTransportAdress(skuServiceTransportDOList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/updateDeliver")
|
||||
@Operation(summary = "修改配送方式")
|
||||
@PermitAll
|
||||
public CommonResult<Boolean> updateDeliver(@RequestBody List<SkuServiceDeliverDO> skuServiceDeliverList) {
|
||||
skuService.updateDeliver(skuServiceDeliverList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/* @GetMapping("/page")
|
||||
@Operation(summary = "获得单品SKU分页")
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.tashow.cloud.product.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 属性规则 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("tz_prod_extend")
|
||||
@KeySequence("tz_prod_extend_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProdExtendDO {
|
||||
|
||||
/**
|
||||
* 属性值ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long prodId;
|
||||
/**
|
||||
* 是否显示失效规格值 0否1是
|
||||
*/
|
||||
private Integer isExpire;
|
||||
|
||||
/**
|
||||
* 是否显示禁用规格值 0否1是
|
||||
*/
|
||||
private Integer isDisable;
|
||||
|
||||
}
|
||||
@@ -19,10 +19,13 @@ import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
@AllArgsConstructor
|
||||
public class ProdPropDO{
|
||||
|
||||
|
||||
/**
|
||||
* 属性id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
private Long propId;
|
||||
/**
|
||||
* 属性名称
|
||||
@@ -39,11 +42,29 @@ public class ProdPropDO{
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer prodId;
|
||||
private Long prodId;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
/**
|
||||
* isExist 是否新增 0否1是
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private Integer isExist;
|
||||
|
||||
|
||||
/**
|
||||
* 状态0禁用1启用
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
|
||||
@@ -20,9 +20,11 @@ import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||
public class ProdPropValueDO {
|
||||
|
||||
/**
|
||||
* 属性值ID
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
private Long valueId;
|
||||
/**
|
||||
* 属性值名称
|
||||
@@ -35,6 +37,26 @@ public class ProdPropValueDO {
|
||||
/**
|
||||
* 是否删除0否1是
|
||||
*/
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* 状态0禁用1启用
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 是否失效0否1是
|
||||
*/
|
||||
private Integer isExpire;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* isExist 是否新增 0否1是
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private Integer isExist;
|
||||
|
||||
}
|
||||
@@ -45,9 +45,13 @@ public class SkuDO extends BaseDO {
|
||||
*/
|
||||
private String alias;
|
||||
/**
|
||||
* 价格
|
||||
* 当前价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 基准价
|
||||
*/
|
||||
private BigDecimal basePrice;
|
||||
/**
|
||||
* 最低价格
|
||||
*/
|
||||
@@ -64,6 +68,15 @@ public class SkuDO extends BaseDO {
|
||||
* 市场价
|
||||
*/
|
||||
private BigDecimal marketPrice;
|
||||
|
||||
/**
|
||||
* 服务内容
|
||||
*/
|
||||
private String serviceContent;
|
||||
/**
|
||||
* 规格id 多个用逗号分隔(1,2,3)
|
||||
*/
|
||||
private String propIds;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@@ -143,4 +156,12 @@ public class SkuDO extends BaseDO {
|
||||
*/
|
||||
private Long formId;
|
||||
|
||||
|
||||
/**
|
||||
* isExist 是否新增 0否1是
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private Integer isExist;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.tashow.cloud.product.mapper;
|
||||
|
||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||
import com.tashow.cloud.product.dto.ProdExtendDO;
|
||||
import com.tashow.cloud.product.dto.ProdPropValueDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 属性规则 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProdExtendMapper extends BaseMapperX<ProdExtendDO> {
|
||||
// 自定义更新方法(可选)
|
||||
int updateByProdId(@Param("prodId") Long prodId,
|
||||
@Param("isDisable") Integer isDisable,
|
||||
@Param("isExpire") Integer isExpire);
|
||||
}
|
||||
@@ -20,9 +20,9 @@ public interface ProdPropMapper extends BaseMapperX<ProdPropDO> {
|
||||
/**
|
||||
* 根据店铺id和属性名称获取商品属性
|
||||
* @param propName
|
||||
* @param shopId
|
||||
* @param prodId
|
||||
* @param rule
|
||||
* @return
|
||||
*/
|
||||
ProdPropDO getProdPropByPropNameAndShopId(@Param("propName") String propName, @Param("shopId") Long shopId, @Param("rule") Integer rule);
|
||||
ProdPropDO getProdPropByPropNameAndShopId(@Param("propName") String propName, @Param("prodId") Integer prodId, @Param("rule") Integer rule);
|
||||
}
|
||||
@@ -16,5 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SkuServiceDeliverMapper extends BaseMapperX<SkuServiceDeliverDO> {
|
||||
|
||||
|
||||
void deleteDelivers(Long serviceId);
|
||||
}
|
||||
@@ -16,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SkuServiceDetailsMapper extends BaseMapperX<SkuServiceDetailsDO> {
|
||||
|
||||
void deleteDetails(Long serviceId);
|
||||
|
||||
}
|
||||
@@ -17,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface SkuServiceMaterialMapper extends BaseMapperX<SkuServiceMaterialDO> {
|
||||
|
||||
|
||||
void deleteMaterials(Long serviceId);
|
||||
}
|
||||
@@ -17,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface SkuServiceTransportMapper extends BaseMapperX<SkuServiceTransportDO> {
|
||||
|
||||
|
||||
void deleteTransports(Long serviceId);
|
||||
}
|
||||
@@ -19,4 +19,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface SkuServicesFormMapper extends BaseMapperX<SkuServicesFormDO> {
|
||||
|
||||
List<SkuServiceExtendVO> selectSkuServiceExtendWithDetails(Integer formId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.tashow.cloud.product.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.product.dto.ProdExtendDO;
|
||||
import com.tashow.cloud.product.dto.ProdPropDO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropPageReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPropVO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface ProdExtendService extends IService<ProdExtendDO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -4,8 +4,10 @@ import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.tashow.cloud.product.dto.ProdPropDO;
|
||||
import com.tashow.cloud.product.vo.prod.ProdSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropPageReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPropVO;
|
||||
import jakarta.validation.*;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
@@ -25,7 +27,11 @@ public interface ProdPropService extends IService<ProdPropDO> {
|
||||
*/
|
||||
Long createProdProp(@Valid ProdPropSaveReqVO createReqVO);
|
||||
|
||||
void saveProdPropAndValues(ProdPropSaveReqVO createReqVO);
|
||||
void saveProdPropAndValues(ProdSaveReqVO createReqVO);
|
||||
|
||||
|
||||
|
||||
void updateProdPropAndValues(SkuPropVO skuPropVO);
|
||||
/**
|
||||
* 更新商品属性
|
||||
*
|
||||
|
||||
@@ -2,13 +2,12 @@ package com.tashow.cloud.product.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.tashow.cloud.product.dto.SkuDO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuExtendVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPageReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuSaveReqVO;
|
||||
import com.tashow.cloud.product.dto.*;
|
||||
import com.tashow.cloud.product.vo.sku.*;
|
||||
import jakarta.validation.*;
|
||||
import com.tashow.cloud.common.pojo.PageResult;
|
||||
import com.tashow.cloud.common.pojo.PageParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 单品SKU Service 接口
|
||||
@@ -32,6 +31,9 @@ public interface SkuService {
|
||||
*/
|
||||
void createSkuExtend(@Valid SkuExtendVO skuExtendVO);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建sku扩展服务配置
|
||||
*
|
||||
@@ -47,6 +49,16 @@ public interface SkuService {
|
||||
*/
|
||||
void updateSku(@Valid SkuSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 更新sku规格
|
||||
*
|
||||
* @param skuPropVO 更新信息
|
||||
*/
|
||||
void updateProp(SkuPropVO skuPropVO);
|
||||
|
||||
|
||||
SkuPropInfoVO getSKuPropList(Long prodId);
|
||||
|
||||
/**
|
||||
* 删除单品SKU
|
||||
*
|
||||
@@ -70,4 +82,35 @@ public interface SkuService {
|
||||
*/
|
||||
PageResult<SkuDO> getSkuPage(SkuPageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 创建sku扩展服务配置
|
||||
*
|
||||
* @param skuServiceDetailsList 更新信息
|
||||
*/
|
||||
void updateServiceDetails(List<SkuServiceDetailsDO> skuServiceDetailsList);
|
||||
|
||||
|
||||
/**
|
||||
* 修物料配置
|
||||
*
|
||||
* @param skuServiceMaterialList 更新信息
|
||||
*/
|
||||
void updateMaterial(List<SkuServiceMaterialDO> skuServiceMaterialList);
|
||||
|
||||
|
||||
/**
|
||||
* 修改接运地址配置
|
||||
*
|
||||
* @param skuServiceTransportDOList 更新信息
|
||||
*/
|
||||
void updateTransportAdress( List<SkuServiceTransportDO> skuServiceTransportDOList);
|
||||
|
||||
/**
|
||||
* 修改配送方式
|
||||
*
|
||||
* @param skuServiceDeliverList 更新信息
|
||||
*/
|
||||
void updateDeliver(List<SkuServiceDeliverDO> skuServiceDeliverList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.tashow.cloud.product.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.tashow.cloud.product.dto.ProdExtendDO;
|
||||
import com.tashow.cloud.product.dto.ProdPropValueDO;
|
||||
import com.tashow.cloud.product.mapper.ProdExtendMapper;
|
||||
import com.tashow.cloud.product.mapper.ProdPropValueMapper;
|
||||
import com.tashow.cloud.product.service.ProdExtendService;
|
||||
import com.tashow.cloud.product.service.ProdPropValueService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
||||
/**
|
||||
* 超区规则 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProdExtendServiceImpl extends ServiceImpl<ProdExtendMapper, ProdExtendDO> implements ProdExtendService {
|
||||
|
||||
}
|
||||
@@ -3,11 +3,15 @@ package com.tashow.cloud.product.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.tashow.cloud.product.dto.ProdPropDO;
|
||||
import com.tashow.cloud.product.dto.ProdPropValueDO;
|
||||
import com.tashow.cloud.product.mapper.ProdPropMapper;
|
||||
import com.tashow.cloud.product.mapper.ProdPropValueMapper;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.vo.prod.ProdSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropPageReqVO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPropVO;
|
||||
import com.tashow.cloud.productapi.enums.BaseEnum;
|
||||
import com.tashow.cloud.productapi.enums.ErrorCodeConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -47,20 +51,52 @@ public class ProdPropServiceImpl extends ServiceImpl<ProdPropMapper, ProdPropDO>
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveProdPropAndValues(ProdPropSaveReqVO createReqVO) {
|
||||
if(createReqVO.getShopId()==null){
|
||||
createReqVO.setShopId(1L);
|
||||
}
|
||||
ProdPropDO dbProdProp = prodPropMapper.getProdPropByPropNameAndShopId(createReqVO.getPropName(), createReqVO.getShopId(), createReqVO.getRule());
|
||||
public void saveProdPropAndValues(ProdSaveReqVO createReqVOInfo) {
|
||||
|
||||
for (ProdPropSaveReqVO createReqVO : createReqVOInfo.getProdPropSaveReqVO()){
|
||||
ProdPropDO dbProdProp = prodPropMapper.getProdPropByPropNameAndShopId(createReqVO.getPropName(), createReqVO.getProdId(), createReqVO.getRule());
|
||||
if (dbProdProp != null) {
|
||||
throw new RuntimeException("已有相同名称规格");
|
||||
}
|
||||
ProdPropDO prodProp = BeanUtils.toBean(createReqVO, ProdPropDO.class);
|
||||
prodProp.setProdId(createReqVOInfo.getProdId());
|
||||
prodPropMapper.insert(prodProp);
|
||||
if (CollUtil.isEmpty(createReqVO.getProdPropValues())) {
|
||||
return;
|
||||
}
|
||||
prodPropValueMapper.insertPropValues(prodProp.getPropId(), createReqVO.getProdPropValues());
|
||||
for (ProdPropValueDO prodPropValueDO : createReqVO.getProdPropValues()){
|
||||
prodPropValueDO.setPropId(prodProp.getPropId());
|
||||
prodPropValueMapper.insert(prodPropValueDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProdPropAndValues(SkuPropVO skuPropVO) {
|
||||
for (ProdPropSaveReqVO createReqVO : skuPropVO.getProdPropSaveReqVO()){
|
||||
ProdPropDO dbProdProp = prodPropMapper.getProdPropByPropNameAndShopId(createReqVO.getPropName(), createReqVO.getProdId(), createReqVO.getRule());
|
||||
if (dbProdProp != null) {
|
||||
throw new RuntimeException("已有相同名称规格");
|
||||
}
|
||||
ProdPropDO prodProp = BeanUtils.toBean(createReqVO, ProdPropDO.class);
|
||||
if(Objects.equals(BaseEnum.YES_ONE.getKey(),createReqVO.getIsExist())){
|
||||
prodPropMapper.insert(prodProp);
|
||||
}else {
|
||||
prodPropMapper.updateById(prodProp);
|
||||
}
|
||||
if (CollUtil.isEmpty(createReqVO.getProdPropValues())) {
|
||||
return;
|
||||
}
|
||||
for (ProdPropValueDO prodPropValueDO : createReqVO.getProdPropValues()){
|
||||
if(Objects.equals(BaseEnum.YES_ONE.getKey(),prodPropValueDO.getIsExist())){
|
||||
prodPropValueDO.setPropId(prodProp.getPropId());
|
||||
prodPropValueMapper.insert(prodPropValueDO);
|
||||
}else {
|
||||
prodPropValueMapper.updateById(prodPropValueDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ public class ProdServiceImpl implements ProdService {
|
||||
private ProdAdditionalFeePeriodsMapper prodAdditionalFeePeriodsMapper;
|
||||
@Resource
|
||||
private ProdWeightRangePricesMapper prodWeightRangePricesMapper;
|
||||
@Resource
|
||||
private ProdExtendMapper prodExtendMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -75,11 +77,16 @@ public class ProdServiceImpl implements ProdService {
|
||||
for(SkuDO sku : skuList){
|
||||
sku.setProdId(prod.getProdId());
|
||||
}
|
||||
skuMapper.insert(skuList);
|
||||
skuMapper.insertBatch(skuList);
|
||||
}
|
||||
createReqVO.setProdId(prod.getProdId());
|
||||
//保存规格
|
||||
prodPropService.saveProdPropAndValues(createReqVO.getProdPropSaveReqVO());
|
||||
prodPropService.saveProdPropAndValues(createReqVO);
|
||||
ProdExtendDO prodExtendDO = new ProdExtendDO();
|
||||
prodExtendDO.setIsExpire(BaseEnum.YES_ONE.getKey());
|
||||
prodExtendDO.setIsExpire(BaseEnum.YES_ONE.getKey());
|
||||
prodExtendDO.setProdId(prod.getProdId());
|
||||
prodExtendMapper.insert(prodExtendDO);
|
||||
// 返回
|
||||
return prod.getProdId();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.tashow.cloud.product.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.tashow.cloud.product.dto.*;
|
||||
import com.tashow.cloud.product.mapper.*;
|
||||
import com.tashow.cloud.product.service.ProdExtendService;
|
||||
import com.tashow.cloud.product.service.ProdPropService;
|
||||
import com.tashow.cloud.product.service.ProdPropValueService;
|
||||
import com.tashow.cloud.product.service.SkuService;
|
||||
import com.tashow.cloud.product.vo.sku.SkuExtendVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuPageReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuSaveReqVO;
|
||||
import com.tashow.cloud.product.vo.sku.SkuServiceExtendVO;
|
||||
import com.tashow.cloud.product.vo.sku.*;
|
||||
import com.tashow.cloud.productapi.enums.BaseEnum;
|
||||
import com.tashow.cloud.productapi.enums.ErrorCodeConstants;
|
||||
import com.tashow.cloud.productapi.enums.ServiceTypeEnum;
|
||||
@@ -45,6 +48,14 @@ public class SkuServiceImpl implements SkuService {
|
||||
private SkuServiceTransportMapper skuServiceTransportMapper;
|
||||
@Resource
|
||||
private SkuServiceDeliverMapper skuServiceDeliverMapper;
|
||||
@Resource
|
||||
private ProdPropService prodPropService;
|
||||
@Resource
|
||||
private ProdExtendMapper prodExtendMapper;
|
||||
@Resource
|
||||
private ProdPropValueService prodPropValueService;
|
||||
@Resource
|
||||
private ProdExtendService prodExtendService;
|
||||
|
||||
@Override
|
||||
public Long createSku(SkuSaveReqVO createReqVO) {
|
||||
@@ -62,7 +73,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getTransportCarSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.TRANSPORT_CAR_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.TRANSPORT_CAR_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -72,7 +83,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.TRANSPORT_CAR_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.TRANSPORT_CAR_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -85,7 +96,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getTrafficSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.BODY_TRANSPORT_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.BODY_TRANSPORT_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -95,7 +106,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.BODY_TRANSPORT_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.BODY_TRANSPORT_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -108,7 +119,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getCleanSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.BODY_CLEAN_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.BODY_CLEAN_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -118,7 +129,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.BODY_CLEAN_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.BODY_CLEAN_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -131,7 +142,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getReflectionSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.MEMORIAL_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.MEMORIAL_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -141,7 +152,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.MEMORIAL_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.MEMORIAL_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -155,7 +166,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getCremationSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.CREMATION_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.CREMATION_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -165,7 +176,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.CREMATION_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.CREMATION_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -179,7 +190,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getAshProcessingSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.ASH_PROCESSING_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.ASH_PROCESSING_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -189,7 +200,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuForm = new SkuServicesFormDO();
|
||||
skuForm.setServiceName(ServiceTypeEnum.ASH_PROCESSING_DELIVERY.getDescription());
|
||||
skuForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuForm.setType(ServiceTypeEnum.ASH_PROCESSING_DELIVERY.getCode());
|
||||
skuForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuForm);
|
||||
@@ -199,7 +210,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuServicesForm = new SkuServicesFormDO();
|
||||
skuServicesForm.setServiceName(ServiceTypeEnum.ASH_PROCESSING_MATERIAL.getDescription());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesForm.setType(ServiceTypeEnum.ASH_PROCESSING_MATERIAL.getCode());
|
||||
skuServicesForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesForm);
|
||||
@@ -213,7 +224,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getBoneashSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.BONE_ASH_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.BONE_ASH_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -227,7 +238,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
if(Objects.equals(skuExtendVO.getSouvenirSwitch(),BaseEnum.YES_ONE.getKey())){
|
||||
SkuServicesFormDO skuServicesFormDO = new SkuServicesFormDO();
|
||||
skuServicesFormDO.setServiceName(ServiceTypeEnum.SOUVENIR_CONFIG.getDescription());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuServicesFormDO.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuServicesFormDO.setType(ServiceTypeEnum.SOUVENIR_CONFIG.getCode());
|
||||
skuServicesFormDO.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuServicesFormDO);
|
||||
@@ -237,7 +248,7 @@ public class SkuServiceImpl implements SkuService {
|
||||
}
|
||||
SkuServicesFormDO skuForm = new SkuServicesFormDO();
|
||||
skuForm.setServiceName(ServiceTypeEnum.SOUVENIR_DELIVERY.getDescription());
|
||||
skuForm.setIsEnabled(BaseEnum.YES.getKey());
|
||||
skuForm.setIsEnabled(BaseEnum.YES_ONE.getKey());
|
||||
skuForm.setType(ServiceTypeEnum.SOUVENIR_DELIVERY.getCode());
|
||||
skuForm.setName(skuExtendVO.getSkuFormName());
|
||||
skuServicesFormMapper.insert(skuForm);
|
||||
@@ -366,6 +377,67 @@ public class SkuServiceImpl implements SkuService {
|
||||
skuMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateProp(SkuPropVO skuPropVO) {
|
||||
//保存sku
|
||||
if (CollectionUtil.isNotEmpty(skuPropVO.getSkuList())) {
|
||||
List<SkuDO> skuList = skuPropVO.getSkuList();
|
||||
List<SkuDO> skuListNew = new ArrayList<>();
|
||||
List<SkuDO> skuListUpdate = new ArrayList<>();
|
||||
for(SkuDO sku : skuList){
|
||||
if(Objects.equals(BaseEnum.YES_ONE.getKey(), sku.getIsExist())){
|
||||
sku.setProdId(skuPropVO.getProdId());
|
||||
skuListNew.add(sku);
|
||||
}else {
|
||||
skuListUpdate.add(sku);
|
||||
}
|
||||
}
|
||||
if(CollUtil.isNotEmpty(skuListNew)){
|
||||
skuMapper.insertBatch(skuListNew);
|
||||
}
|
||||
if(CollUtil.isNotEmpty(skuListUpdate)){
|
||||
skuMapper.updateBatch(skuListUpdate);
|
||||
}
|
||||
}
|
||||
/* prodExtendMapper.updateByProdId(skuPropVO.getProdId(),skuPropVO.getIsDisable(),skuPropVO.getIsExpire());
|
||||
//保存规格
|
||||
prodPropService.updateProdPropAndValues(skuPropVO);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkuPropInfoVO getSKuPropList(Long prodId) {
|
||||
LambdaQueryWrapper<ProdPropDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ProdPropDO::getProdId,prodId);
|
||||
wrapper.eq(ProdPropDO::getState, BaseEnum.YES_ONE.getKey())
|
||||
.orderByDesc(ProdPropDO::getSort);
|
||||
|
||||
List<ProdPropDO> list = prodPropService.list(wrapper);
|
||||
list.forEach(prop -> {
|
||||
List<ProdPropValueDO> values = prodPropValueService.list(
|
||||
new LambdaQueryWrapper<ProdPropValueDO>()
|
||||
.eq(ProdPropValueDO::getPropId, prop.getId())
|
||||
.orderByDesc(ProdPropValueDO::getSort)
|
||||
);
|
||||
/* LambdaQueryWrapper<ProdPropValueDO> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(ProdPropValueDO::getPropId,prop.getPropId());
|
||||
wrapper1.eq(ProdPropValueDO::getState, BaseEnum.YES_ONE.getKey());
|
||||
if (merchantComm.getScore() != null) {
|
||||
wrapper.eq("score", merchantComm.getScore());
|
||||
}
|
||||
wrapper1.orderByDesc(ProdPropValueDO::getSort);*/
|
||||
|
||||
prop.setProdPropValues(values);
|
||||
});
|
||||
SkuPropInfoVO skuPropInfoVO = new SkuPropInfoVO();
|
||||
skuPropInfoVO.setProdId(prodId);
|
||||
skuPropInfoVO.setProdPropSaveReqVO(list);
|
||||
ProdExtendDO prodExtendDO = prodExtendService.getOne(new LambdaQueryWrapper<ProdExtendDO>().eq(ProdExtendDO::getProdId, prodId));
|
||||
skuPropInfoVO.setIsDisable(prodExtendDO.getIsDisable());
|
||||
skuPropInfoVO.setIsExpire(prodExtendDO.getIsExpire());
|
||||
return skuPropInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSku(Long id) {
|
||||
// 校验存在
|
||||
@@ -390,4 +462,40 @@ public class SkuServiceImpl implements SkuService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateServiceDetails(List<SkuServiceDetailsDO> skuServiceDetailsList) {
|
||||
if (ObjectUtils.isNotEmpty(skuServiceDetailsList)) {
|
||||
skuServiceDetailsMapper.delete(SkuServiceDetailsDO::getServiceId, skuServiceDetailsList.get(0).getServiceId());
|
||||
skuServiceDetailsMapper.insertBatch(skuServiceDetailsList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateMaterial(List<SkuServiceMaterialDO> skuServiceMaterialList) {
|
||||
if (ObjectUtils.isNotEmpty(skuServiceMaterialList)) {
|
||||
skuServiceMaterialMapper.delete(SkuServiceMaterialDO::getServiceId, skuServiceMaterialList.get(0).getServiceId());
|
||||
skuServiceMaterialMapper.insertBatch(skuServiceMaterialList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTransportAdress(List<SkuServiceTransportDO> skuServiceTransportDOList) {
|
||||
if (ObjectUtils.isNotEmpty(skuServiceTransportDOList)) {
|
||||
skuServiceTransportMapper.delete(SkuServiceTransportDO::getServiceId, skuServiceTransportDOList.get(0).getServiceId());
|
||||
skuServiceTransportMapper.insertBatch(skuServiceTransportDOList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeliver(List<SkuServiceDeliverDO> skuServiceDeliverList) {
|
||||
if (ObjectUtils.isNotEmpty(skuServiceDeliverList)) {
|
||||
skuServiceDeliverMapper.delete(SkuServiceDeliverDO::getServiceId, skuServiceDeliverList.get(0).getServiceId());
|
||||
skuServiceDeliverMapper.insertBatch(skuServiceDeliverList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -127,6 +127,6 @@ public class ProdSaveReqVO {
|
||||
private List<SkuDO> skuList;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private ProdPropSaveReqVO prodPropSaveReqVO;
|
||||
private List<ProdPropSaveReqVO> prodPropSaveReqVO;
|
||||
|
||||
}
|
||||
@@ -24,6 +24,6 @@ public class ProdPropPageReqVO extends PageParam {
|
||||
private Integer prodId;
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -32,6 +32,6 @@ public class ProdPropRespVO {
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
@ExcelProperty("是否删除0否1是")
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -27,8 +27,13 @@ public class ProdPropSaveReqVO {
|
||||
private Integer prodId;
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
|
||||
/**
|
||||
* isExist 是否新增 0否1是
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private Integer isExist;
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,6 @@ public class ProdPropValuePageReqVO extends PageParam {
|
||||
private Long propId;
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
private Integer isDelete;
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -24,6 +24,6 @@ public class ProdPropValueRespVO {
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
@ExcelProperty("是否删除0否1是")
|
||||
private Boolean isDelete;
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
@@ -19,6 +19,6 @@ public class ProdPropValueSaveReqVO {
|
||||
private Long propId;
|
||||
|
||||
@Schema(description = "是否删除0否1是")
|
||||
private Boolean isDelete;
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
@@ -25,9 +25,14 @@ public class SkuPageReqVO extends PageParam {
|
||||
@Schema(description = "别名")
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "价格", example = "32405")
|
||||
@Schema(description = "当前价格", example = "32405")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 基准价
|
||||
*/
|
||||
private BigDecimal basePrice;
|
||||
|
||||
@Schema(description = "最低价格", example = "5040")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@@ -103,4 +108,14 @@ public class SkuPageReqVO extends PageParam {
|
||||
* 是否默认规则0否1是
|
||||
*/
|
||||
private Integer isSpecs;
|
||||
|
||||
|
||||
/**
|
||||
* 服务内容
|
||||
*/
|
||||
private String serviceContent;
|
||||
/**
|
||||
* 规格id 多个用逗号分隔(1,2,3)
|
||||
*/
|
||||
private String propIds;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tashow.cloud.product.vo.sku;
|
||||
|
||||
import com.tashow.cloud.product.dto.ProdPropDO;
|
||||
import com.tashow.cloud.product.dto.SkuDO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropSaveReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SkuPropInfoVO {
|
||||
@Schema(description = "产品id")
|
||||
private Long prodId;
|
||||
|
||||
/**
|
||||
* 是否显示失效规格值 0否1是
|
||||
*/
|
||||
private Integer isExpire;
|
||||
|
||||
/**
|
||||
* 是否显示禁用规格值 0否1是
|
||||
*/
|
||||
private Integer isDisable;
|
||||
|
||||
@Schema(description = "规格")
|
||||
public List<ProdPropDO> prodPropSaveReqVO;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.tashow.cloud.product.vo.sku;
|
||||
|
||||
import com.tashow.cloud.product.dto.SkuDO;
|
||||
import com.tashow.cloud.product.vo.prodprop.ProdPropSaveReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SkuPropVO {
|
||||
@Schema(description = "产品id")
|
||||
private Long prodId;
|
||||
|
||||
/**
|
||||
* 是否显示失效规格值 0否1是
|
||||
*/
|
||||
private Integer isExpire = 1;
|
||||
|
||||
/**
|
||||
* 是否显示禁用规格值 0否1是
|
||||
*/
|
||||
private Integer isDisable =1;
|
||||
|
||||
|
||||
@Schema(description = "sku列表")
|
||||
public List<SkuDO> skuList;
|
||||
|
||||
@Schema(description = "规格")
|
||||
public List<ProdPropSaveReqVO> prodPropSaveReqVO;
|
||||
}
|
||||
@@ -29,10 +29,15 @@ public class SkuRespVO {
|
||||
@ExcelProperty("别名")
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "价格", example = "32405")
|
||||
@Schema(description = "当前价格", example = "32405")
|
||||
@ExcelProperty("价格")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 基准价
|
||||
*/
|
||||
private BigDecimal basePrice;
|
||||
|
||||
@Schema(description = "最低价格", example = "5040")
|
||||
@ExcelProperty("最低价格")
|
||||
private BigDecimal minPrice;
|
||||
@@ -129,4 +134,13 @@ public class SkuRespVO {
|
||||
* 是否默认规则0否1是
|
||||
*/
|
||||
private Integer isSpecs;
|
||||
|
||||
/**
|
||||
* 服务内容
|
||||
*/
|
||||
private String serviceContent;
|
||||
/**
|
||||
* 规格id 多个用逗号分隔(1,2,3)
|
||||
*/
|
||||
private String propIds;
|
||||
}
|
||||
@@ -23,9 +23,14 @@ public class SkuSaveReqVO {
|
||||
@Schema(description = "别名")
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "价格", example = "32405")
|
||||
@Schema(description = "当前价格", example = "32405")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 基准价
|
||||
*/
|
||||
private BigDecimal basePrice;
|
||||
|
||||
@Schema(description = "最低价格", example = "5040")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@@ -93,4 +98,13 @@ public class SkuSaveReqVO {
|
||||
* 扩展服务表单id
|
||||
*/
|
||||
private Long formId;
|
||||
|
||||
/**
|
||||
* 服务内容
|
||||
*/
|
||||
private String serviceContent;
|
||||
/**
|
||||
* 规格id 多个用逗号分隔(1,2,3)
|
||||
*/
|
||||
private String propIds;
|
||||
}
|
||||
@@ -73,4 +73,11 @@
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<settings>
|
||||
<!-- 开启自动映射 -->
|
||||
<setting name="autoMappingBehavior" value="FULL"/>
|
||||
<!-- 打印查询的 SQL -->
|
||||
<setting name="logImpl" value="STDOUT_LOGGING"/>
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.tashow.cloud.product.mapper.ProdExtendMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<update id="updateByProdId">
|
||||
UPDATE tz_prod_extend
|
||||
SET
|
||||
is_disable = #{isDisable},
|
||||
is_expire = #{isExpire}
|
||||
WHERE prod_id = #{prodId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -9,6 +9,6 @@
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="getProdPropByPropNameAndShopId" resultType="com.tashow.cloud.product.dto.ProdPropDO">
|
||||
select * from tz_prod_prop where prop_name = #{propName} and shop_id = #{shopId} and rule = #{rule}
|
||||
select * from tz_prod_prop where prop_name = #{propName} and prod_id = #{prodId} and rule = #{rule}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -8,5 +8,7 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteDelivers">
|
||||
delete from tz_sku_service_deliver where service_id = #{serviceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -8,5 +8,7 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteDetails">
|
||||
delete from tz_sku_service_details where service_id = #{serviceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -8,5 +8,7 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteMaterials">
|
||||
delete from tz_sku_service_material where service_id = #{serviceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -8,5 +8,7 @@
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<delete id="deleteTransports">
|
||||
delete from tz_sku_service_transport where service_id = #{serviceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user