商品规格的迁移

This commit is contained in:
YunaiV 2020-07-30 01:13:08 +08:00
parent 90047c10d7
commit 72347c8149
20 changed files with 146 additions and 181 deletions

View File

@ -66,8 +66,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(value = MissingServletRequestParameterException.class) @ExceptionHandler(value = MissingServletRequestParameterException.class)
public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) { public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) {
logger.warn("[missingServletRequestParameterExceptionHandler]", ex); logger.warn("[missingServletRequestParameterExceptionHandler]", ex);
return CommonResult.error(BAD_REQUEST.getCode(), return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数缺失:%s", ex.getParameterName()))
String.format("请求参数缺失:%s", ex.getParameterName())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -78,8 +78,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(MethodArgumentTypeMismatchException.class) @ExceptionHandler(MethodArgumentTypeMismatchException.class)
public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) { public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) {
logger.warn("[missingServletRequestParameterExceptionHandler]", ex); logger.warn("[missingServletRequestParameterExceptionHandler]", ex);
return CommonResult.error(BAD_REQUEST.getCode(), return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", ex.getMessage()))
String.format("请求参数类型错误:%s", ex.getMessage())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -90,8 +90,8 @@ public class GlobalExceptionHandler {
logger.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex); logger.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex);
FieldError fieldError = ex.getBindingResult().getFieldError(); FieldError fieldError = ex.getBindingResult().getFieldError();
assert fieldError != null; // 断言避免告警 assert fieldError != null; // 断言避免告警
return CommonResult.error(BAD_REQUEST.getCode(), return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage()))
String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -102,8 +102,8 @@ public class GlobalExceptionHandler {
logger.warn("[handleBindException]", ex); logger.warn("[handleBindException]", ex);
FieldError fieldError = ex.getFieldError(); FieldError fieldError = ex.getFieldError();
assert fieldError != null; // 断言避免告警 assert fieldError != null; // 断言避免告警
return CommonResult.error(BAD_REQUEST.getCode(), return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage()))
String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -113,8 +113,8 @@ public class GlobalExceptionHandler {
public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) { public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) {
logger.warn("[constraintViolationExceptionHandler]", ex); logger.warn("[constraintViolationExceptionHandler]", ex);
ConstraintViolation<?> constraintViolation = ex.getConstraintViolations().iterator().next(); ConstraintViolation<?> constraintViolation = ex.getConstraintViolations().iterator().next();
return CommonResult.error(BAD_REQUEST.getCode(), return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", constraintViolation.getMessage()))
String.format("请求参数不正确:%s", constraintViolation.getMessage())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -127,8 +127,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(NoHandlerFoundException.class) @ExceptionHandler(NoHandlerFoundException.class)
public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) { public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) {
logger.warn("[noHandlerFoundExceptionHandler]", ex); logger.warn("[noHandlerFoundExceptionHandler]", ex);
return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(), return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL()))
String.format("请求地址不存在:%s", ex.getRequestURL())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -139,8 +139,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(HttpRequestMethodNotSupportedException.class) @ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) { public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) {
logger.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex); logger.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex);
return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(), return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(), String.format("请求方法不正确:%s", ex.getMessage()))
String.format("请求方法不正确:%s", ex.getMessage())); .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -180,7 +180,8 @@ public class GlobalExceptionHandler {
public CommonResult validationException(ValidationException ex) { public CommonResult validationException(ValidationException ex) {
logger.warn("[constraintViolationExceptionHandler]", ex); logger.warn("[constraintViolationExceptionHandler]", ex);
// 无法拼接明细的错误信息因为 Dubbo Consumer 抛出 ValidationException 异常时是直接的字符串信息且人类不可读 // 无法拼接明细的错误信息因为 Dubbo Consumer 抛出 ValidationException 异常时是直接的字符串信息且人类不可读
return CommonResult.error(BAD_REQUEST.getCode(), "请求参数不正确"); return CommonResult.error(BAD_REQUEST.getCode(), "请求参数不正确")
.setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
/** /**
@ -192,7 +193,8 @@ public class GlobalExceptionHandler {
// 插入异常日志 // 插入异常日志
this.createExceptionLog(req, ex); this.createExceptionLog(req, ex);
// 返回 ERROR CommonResult // 返回 ERROR CommonResult
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMessage()); return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMessage())
.setDetailMessage(ExceptionUtil.getRootCauseMessage(ex));
} }
public void createExceptionLog(HttpServletRequest req, Throwable e) { public void createExceptionLog(HttpServletRequest req, Throwable e) {

View File

@ -0,0 +1,7 @@
### /product-attr/page 成功(全部)
GET {{baseUrl}}/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
###

View File

@ -4,6 +4,7 @@ import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.attr.*; import cn.iocoder.mall.managementweb.controller.product.vo.attr.*;
import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager; import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager;
import cn.iocoder.security.annotations.RequiresPermissions;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -30,12 +31,14 @@ public class ProductAttrController {
@PostMapping("/key/create") @PostMapping("/key/create")
@ApiOperation("创建商品规格键") @ApiOperation("创建商品规格键")
@RequiresPermissions("product:attr-key:create")
public CommonResult<Integer> createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) { public CommonResult<Integer> createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrKey(createVO)); return success(productAttrKeyManager.createProductAttrKey(createVO));
} }
@PostMapping("/key/update") @PostMapping("/key/update")
@ApiOperation("更新商品规格键") @ApiOperation("更新商品规格键")
@RequiresPermissions("product:attr-key:update")
public CommonResult<Boolean> updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) { public CommonResult<Boolean> updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrKey(updateVO); productAttrKeyManager.updateProductAttrKey(updateVO);
return success(true); return success(true);
@ -43,32 +46,37 @@ public class ProductAttrController {
@GetMapping("/key/get") @GetMapping("/key/get")
@ApiOperation("获得商品规格键") @ApiOperation("获得商品规格键")
@ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true) @ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true, example = "1")
@RequiresPermissions("product:attr-key:page")
public CommonResult<ProductAttrKeyRespVO> getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) { public CommonResult<ProductAttrKeyRespVO> getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) {
return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId)); return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId));
} }
@GetMapping("/key/list") @GetMapping("/key/list")
@ApiOperation("获得商品规格键列表") @ApiOperation("获得商品规格键列表")
@ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true) @ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true, example = "1,3")
@RequiresPermissions("product:attr-key:page")
public CommonResult<List<ProductAttrKeyRespVO>> listProductAttrKeys(@RequestParam("productAttrKeyIds") List<Integer> productAttrKeyIds) { public CommonResult<List<ProductAttrKeyRespVO>> listProductAttrKeys(@RequestParam("productAttrKeyIds") List<Integer> productAttrKeyIds) {
return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds)); return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds));
} }
@GetMapping("/key/page") @GetMapping("/key/page")
@ApiOperation("获得商品规格键分页") @ApiOperation("获得商品规格键分页")
@RequiresPermissions("product:attr-key:page")
public CommonResult<PageResult<ProductAttrKeyRespVO>> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) { public CommonResult<PageResult<ProductAttrKeyRespVO>> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) {
return success(productAttrKeyManager.pageProductAttrKey(pageVO)); return success(productAttrKeyManager.pageProductAttrKey(pageVO));
} }
@PostMapping("/value/create") @PostMapping("/value/create")
@ApiOperation("创建商品规格值") @ApiOperation("创建商品规格值")
@RequiresPermissions("product:attr-value:create")
public CommonResult<Integer> createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) { public CommonResult<Integer> createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) {
return success(productAttrKeyManager.createProductAttrValue(createVO)); return success(productAttrKeyManager.createProductAttrValue(createVO));
} }
@PostMapping("/value/update") @PostMapping("/value/update")
@ApiOperation("更新商品规格值") @ApiOperation("更新商品规格值")
@RequiresPermissions("product:attr-value:update")
public CommonResult<Boolean> updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) { public CommonResult<Boolean> updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) {
productAttrKeyManager.updateProductAttrValue(updateVO); productAttrKeyManager.updateProductAttrValue(updateVO);
return success(true); return success(true);
@ -77,15 +85,16 @@ public class ProductAttrController {
@GetMapping("/value/get") @GetMapping("/value/get")
@ApiOperation("获得商品规格值") @ApiOperation("获得商品规格值")
@ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true) @ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true)
@RequiresPermissions("product:attr-value:list")
public CommonResult<ProductAttrValueRespVO> getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) { public CommonResult<ProductAttrValueRespVO> getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) {
return success(productAttrKeyManager.getProductAttrValue(productAttrValueId)); return success(productAttrKeyManager.getProductAttrValue(productAttrValueId));
} }
@GetMapping("/value/list") @GetMapping("/value/list")
@ApiOperation("获得商品规格值列表") @ApiOperation("获得商品规格值列表")
@ApiImplicitParam(name = "productAttrValueIds", value = "商品规格值编号列表", required = true) @RequiresPermissions("product:attr-value:list")
public CommonResult<List<ProductAttrValueRespVO>> listProductAttrValues(@RequestParam("productAttrValueIds") List<Integer> productAttrValueIds) { public CommonResult<List<ProductAttrValueRespVO>> listProductAttrValues(@Valid ProductAttrValueListQueryReqVO queryReqVO) {
return success(productAttrKeyManager.listProductAttrValues(productAttrValueIds)); return success(productAttrKeyManager.listProductAttrValues(queryReqVO));
} }
} }

View File

@ -0,0 +1,21 @@
package cn.iocoder.mall.managementweb.controller.product.vo.attr;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@ApiModel("商品规格值的列表查询条件 Request VO")
@Data
@Accessors(chain = true)
public class ProductAttrValueListQueryReqVO {
@ApiModelProperty(value = "商品规格值编号列表", example = "1, 3")
private List<Integer> productAttrValueIds;
@ApiModelProperty(value = "规格键编号", required = true, example = "2")
private Integer productAttrKeyId;
}

View File

@ -34,4 +34,6 @@ public interface ProductAttrConvert {
List<ProductAttrValueRespVO> convertList02(List<ProductAttrValueRespDTO> list); List<ProductAttrValueRespVO> convertList02(List<ProductAttrValueRespDTO> list);
ProductAttrValueListQueryRequestDTO convert(ProductAttrValueListQueryReqVO bean);
} }

View File

@ -121,11 +121,12 @@ public class ProductAttrKeyManager {
/** /**
* 获得商品规格值列表 * 获得商品规格值列表
* *
* @param productAttrValueIds 商品规格值编号列表 * @param queryReqVO 商品规格值的列表查询条件 VO
* @return 商品规格值列表 * @return 商品规格值列表
*/ */
public List<ProductAttrValueRespVO> listProductAttrValues(List<Integer> productAttrValueIds) { public List<ProductAttrValueRespVO> listProductAttrValues(ProductAttrValueListQueryReqVO queryReqVO) {
CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValueResult = productAttrKeyRpc.listProductAttrValues(productAttrValueIds); CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValueResult = productAttrKeyRpc.listProductAttrValues(
ProductAttrConvert.INSTANCE.convert(queryReqVO));
listProductAttrValueResult.checkError(); listProductAttrValueResult.checkError();
return ProductAttrConvert.INSTANCE.convertList02(listProductAttrValueResult.getData()); return ProductAttrConvert.INSTANCE.convertList02(listProductAttrValueResult.getData());
} }

View File

@ -76,9 +76,9 @@ public interface ProductAttrRpc {
/** /**
* 获得商品规格值列表 * 获得商品规格值列表
* *
* @param productAttrValueIds 商品规格值编号列表 * @param queryDTO 商品规格值的列表查询条件 DTO
* @return 商品规格值列表 * @return 商品规格值列表
*/ */
CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValues(List<Integer> productAttrValueIds); CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO);
} }

View File

@ -0,0 +1,26 @@
package cn.iocoder.mall.productservice.rpc.attr.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 商品规格值的列表查询条件 Request DTO
*/
@Data
@Accessors(chain = true)
public class ProductAttrValueListQueryRequestDTO implements Serializable {
/**
* 商品规格值编号列表
*/
private List<Integer> productAttrValueIds;
/**
* 商品规格键编号
*/
private Integer productAttrKeyId;
}

View File

@ -2,16 +2,13 @@ package cn.iocoder.mall.productservice.rpc.attr.dto;
import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.enums.CommonStatusEnum;
import cn.iocoder.common.framework.validator.InEnum; import cn.iocoder.common.framework.validator.InEnum;
import lombok.*; import lombok.Data;
import lombok.experimental.*; import lombok.experimental.Accessors;
import io.swagger.annotations.*; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.io.Serializable; import java.io.Serializable;
import javax.validation.constraints.*;
/** /**
* 商品规格值更新 Request DTO * 商品规格值更新 Request DTO
*/ */
@ -24,11 +21,6 @@ public class ProductAttrValueUpdateReqDTO implements Serializable {
*/ */
@NotNull(message = "规格值编号不能为空") @NotNull(message = "规格值编号不能为空")
private Integer id; private Integer id;
/**
* 规格键编号
*/
@NotNull(message = "规格键编号不能为空")
private Integer attrKeyId;
/** /**
* 规格值名字 * 规格值名字
*/ */

View File

@ -7,6 +7,7 @@ import cn.iocoder.mall.productservice.rpc.attr.dto.*;
import cn.iocoder.mall.productservice.service.attr.bo.*; import cn.iocoder.mall.productservice.service.attr.bo.*;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List; import java.util.List;
@ -24,7 +25,8 @@ public interface ProductAttrConvert {
List<ProductAttrKeyBO> convertList(List<ProductAttrKeyDO> list); List<ProductAttrKeyBO> convertList(List<ProductAttrKeyDO> list);
PageResult<ProductAttrKeyBO> convertPage(IPage<ProductAttrKeyDO> page); @Mapping(source = "records", target = "list")
PageResult<ProductAttrKeyBO> convertPage(IPage<ProductAttrKeyDO> page);
ProductAttrKeyCreateBO convert(ProductAttrKeyCreateReqDTO bean); ProductAttrKeyCreateBO convert(ProductAttrKeyCreateReqDTO bean);
@ -54,4 +56,6 @@ public interface ProductAttrConvert {
List<ProductAttrValueRespDTO> convertList04(List<ProductAttrValueBO> list); List<ProductAttrValueRespDTO> convertList04(List<ProductAttrValueBO> list);
ProductAttrValueListQueryBO convert(ProductAttrValueListQueryRequestDTO bean);
} }

View File

@ -1,15 +1,24 @@
package cn.iocoder.mall.productservice.dal.mysql.mapper.attr; package cn.iocoder.mall.productservice.dal.mysql.mapper.attr;
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrValueDO; import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrValueDO;
import cn.iocoder.mall.productservice.service.attr.bo.ProductAttrValueListQueryBO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface ProductAttrValueMapper extends BaseMapper<ProductAttrValueDO> { public interface ProductAttrValueMapper extends BaseMapper<ProductAttrValueDO> {
default ProductAttrValueDO selectByAttrKeyIdAndName(Integer attrKeyId, String name) { default ProductAttrValueDO selectByAttrKeyIdAndName(Integer attrKeyId, String name) {
return selectOne(new QueryWrapper<ProductAttrValueDO>().eq("attrKeyId", attrKeyId).eq("name", name)); return selectOne(new QueryWrapper<ProductAttrValueDO>().eq("attr_key_id", attrKeyId).eq("name", name));
}
default List<ProductAttrValueDO> selectList(ProductAttrValueListQueryBO queryBO) {
return selectList(new QueryWrapperX<ProductAttrValueDO>().inIfPresent("id", queryBO.getProductAttrValueIds())
.eqIfPresent("attr_key_id", queryBO.getProductAttrKeyId()));
} }
} }

View File

@ -107,11 +107,11 @@ public class ProductAttrManager {
/** /**
* 获得商品规格值列表 * 获得商品规格值列表
* *
* @param productAttrValueIds 商品规格值编号列表 * @param queryDTO 商品规格值的列表查询条件 DTO
* @return 商品规格值列表 * @return 商品规格值列表
*/ */
public List<ProductAttrValueRespDTO> listProductAttrValues(List<Integer> productAttrValueIds) { public List<ProductAttrValueRespDTO> listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO) {
List<ProductAttrValueBO> productAttrValueBOs = productAttrService.listProductAttrValues(productAttrValueIds); List<ProductAttrValueBO> productAttrValueBOs = productAttrService.listProductAttrValues(ProductAttrConvert.INSTANCE.convert(queryDTO));
return ProductAttrConvert.INSTANCE.convertList04(productAttrValueBOs); return ProductAttrConvert.INSTANCE.convertList04(productAttrValueBOs);
} }

View File

@ -63,8 +63,8 @@ public class ProductAttrRpcImpl implements ProductAttrRpc {
} }
@Override @Override
public CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValues(List<Integer> productAttrValueIds) { public CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO) {
return success(productAttrManager.listProductAttrValues(productAttrValueIds)); return success(productAttrManager.listProductAttrValues(queryDTO));
} }
} }

View File

@ -200,11 +200,11 @@ public class ProductAttrService {
/** /**
* 获得商品规格值列表 * 获得商品规格值列表
* *
* @param productAttrValueIds 商品规格值编号列表 * @param queryBO 商品规格值的列表查询条件 BO
* @return 商品规格值列表 * @return 商品规格值列表
*/ */
public List<ProductAttrValueBO> listProductAttrValues(List<Integer> productAttrValueIds) { public List<ProductAttrValueBO> listProductAttrValues(ProductAttrValueListQueryBO queryBO) {
List<ProductAttrValueDO> productAttrValueDOs = productAttrValueMapper.selectBatchIds(productAttrValueIds); List<ProductAttrValueDO> productAttrValueDOs = productAttrValueMapper.selectList(queryBO);
return ProductAttrConvert.INSTANCE.convertList03(productAttrValueDOs); return ProductAttrConvert.INSTANCE.convertList03(productAttrValueDOs);
} }

View File

@ -0,0 +1,25 @@
package cn.iocoder.mall.productservice.service.attr.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
/**
* 商品规格值的列表查询条件 BO
*/
@Data
@Accessors(chain = true)
public class ProductAttrValueListQueryBO {
/**
* 商品规格值编号列表
*/
private List<Integer> productAttrValueIds;
/**
* 商品规格键编号
*/
private Integer productAttrKeyId;
}

View File

@ -1,38 +0,0 @@
package cn.iocoder.mall.product.biz.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 商品规格明细 VO
*/
@Data
@Accessors(chain = true)
public class ProductAttrDetailBO implements Serializable {
/**
* 规格编号
*/
private Integer id;
/**
* 规格名
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 规格值数组
*/
private List<ProductAttrValueDetailBO> values;
}

View File

@ -1,25 +0,0 @@
package cn.iocoder.mall.product.biz.bo.product;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 商品规格明细分页 BO
*/
@Data
@Accessors(chain = true)
public class ProductAttrPageBO implements Serializable {
/**
* 规格数组
*/
private List<ProductAttrDetailBO> attrs;
/**
* 总数
*/
private Integer count;
}

View File

@ -23,11 +23,4 @@ public interface ProductAttrService {
*/ */
List<ProductAttrSimpleBO> getProductAttrList(); List<ProductAttrSimpleBO> getProductAttrList();
ProductAttrValueBO addProductAttrValue(Integer adminId, ProductAttrValueAddDTO productAttrValueAddDTO);
Boolean updateProductAttrValue(Integer adminId, ProductAttrValueUpdateDTO productAttrValueUpdateDTO);
Boolean updateProductAttrValueStatus(Integer adminId, Integer productAttrValueId,
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
} }

View File

@ -1,38 +0,0 @@
package cn.iocoder.mall.product.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 商品规格明细 VO
*/
@Data
@Accessors(chain = true)
public class ProductAttrDetailBO implements Serializable {
/**
* 规格编号
*/
private Integer id;
/**
* 规格名
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 规格值数组
*/
private List<ProductAttrValueDetailBO> values;
}

View File

@ -1,25 +0,0 @@
package cn.iocoder.mall.product.api.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* 商品规格明细分页 BO
*/
@Data
@Accessors(chain = true)
public class ProductAttrPageBO implements Serializable {
/**
* 规格数组
*/
private List<ProductAttrDetailBO> attrs;
/**
* 总数
*/
private Integer count;
}