diff --git a/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java b/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java index d036fce45..976d9c1f7 100644 --- a/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java +++ b/common/mall-spring-boot-starter-web/src/main/java/cn/iocoder/mall/web/core/handler/GlobalExceptionHandler.java @@ -66,8 +66,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(value = MissingServletRequestParameterException.class) public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) { logger.warn("[missingServletRequestParameterExceptionHandler]", ex); - return CommonResult.error(BAD_REQUEST.getCode(), - String.format("请求参数缺失:%s", ex.getParameterName())); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数缺失:%s", ex.getParameterName())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -78,8 +78,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(MethodArgumentTypeMismatchException.class) public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) { logger.warn("[missingServletRequestParameterExceptionHandler]", ex); - return CommonResult.error(BAD_REQUEST.getCode(), - String.format("请求参数类型错误:%s", ex.getMessage())); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", ex.getMessage())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -90,8 +90,8 @@ public class GlobalExceptionHandler { logger.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex); FieldError fieldError = ex.getBindingResult().getFieldError(); assert fieldError != null; // 断言,避免告警 - return CommonResult.error(BAD_REQUEST.getCode(), - String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -102,8 +102,8 @@ public class GlobalExceptionHandler { logger.warn("[handleBindException]", ex); FieldError fieldError = ex.getFieldError(); assert fieldError != null; // 断言,避免告警 - return CommonResult.error(BAD_REQUEST.getCode(), - String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -113,8 +113,8 @@ public class GlobalExceptionHandler { public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) { logger.warn("[constraintViolationExceptionHandler]", ex); ConstraintViolation constraintViolation = ex.getConstraintViolations().iterator().next(); - return CommonResult.error(BAD_REQUEST.getCode(), - String.format("请求参数不正确:%s", constraintViolation.getMessage())); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", constraintViolation.getMessage())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -127,8 +127,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) { logger.warn("[noHandlerFoundExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(), - String.format("请求地址不存在:%s", ex.getRequestURL())); + return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -139,8 +139,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(HttpRequestMethodNotSupportedException.class) public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) { logger.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex); - return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(), - String.format("请求方法不正确:%s", ex.getMessage())); + return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(), String.format("请求方法不正确:%s", ex.getMessage())) + .setDetailMessage(ExceptionUtil.getRootCauseMessage(ex)); } /** @@ -180,7 +180,8 @@ public class GlobalExceptionHandler { public CommonResult validationException(ValidationException ex) { logger.warn("[constraintViolationExceptionHandler]", ex); // 无法拼接明细的错误信息,因为 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); // 返回 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) { diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http new file mode 100644 index 000000000..c86c14a08 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http @@ -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}} + +### + diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java index aed155397..ad77f1a2c 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java @@ -4,6 +4,7 @@ import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.managementweb.controller.product.vo.attr.*; import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager; +import cn.iocoder.security.annotations.RequiresPermissions; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -30,12 +31,14 @@ public class ProductAttrController { @PostMapping("/key/create") @ApiOperation("创建商品规格键") + @RequiresPermissions("product:attr-key:create") public CommonResult createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) { return success(productAttrKeyManager.createProductAttrKey(createVO)); } @PostMapping("/key/update") @ApiOperation("更新商品规格键") + @RequiresPermissions("product:attr-key:update") public CommonResult updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) { productAttrKeyManager.updateProductAttrKey(updateVO); return success(true); @@ -43,32 +46,37 @@ public class ProductAttrController { @GetMapping("/key/get") @ApiOperation("获得商品规格键") - @ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true) + @ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true, example = "1") + @RequiresPermissions("product:attr-key:page") public CommonResult getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) { return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId)); } @GetMapping("/key/list") @ApiOperation("获得商品规格键列表") - @ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true) + @ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true, example = "1,3") + @RequiresPermissions("product:attr-key:page") public CommonResult> listProductAttrKeys(@RequestParam("productAttrKeyIds") List productAttrKeyIds) { return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds)); } @GetMapping("/key/page") @ApiOperation("获得商品规格键分页") + @RequiresPermissions("product:attr-key:page") public CommonResult> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) { return success(productAttrKeyManager.pageProductAttrKey(pageVO)); } @PostMapping("/value/create") @ApiOperation("创建商品规格值") + @RequiresPermissions("product:attr-value:create") public CommonResult createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) { return success(productAttrKeyManager.createProductAttrValue(createVO)); } @PostMapping("/value/update") @ApiOperation("更新商品规格值") + @RequiresPermissions("product:attr-value:update") public CommonResult updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) { productAttrKeyManager.updateProductAttrValue(updateVO); return success(true); @@ -77,15 +85,16 @@ public class ProductAttrController { @GetMapping("/value/get") @ApiOperation("获得商品规格值") @ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true) + @RequiresPermissions("product:attr-value:list") public CommonResult getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) { return success(productAttrKeyManager.getProductAttrValue(productAttrValueId)); } @GetMapping("/value/list") @ApiOperation("获得商品规格值列表") - @ApiImplicitParam(name = "productAttrValueIds", value = "商品规格值编号列表", required = true) - public CommonResult> listProductAttrValues(@RequestParam("productAttrValueIds") List productAttrValueIds) { - return success(productAttrKeyManager.listProductAttrValues(productAttrValueIds)); + @RequiresPermissions("product:attr-value:list") + public CommonResult> listProductAttrValues(@Valid ProductAttrValueListQueryReqVO queryReqVO) { + return success(productAttrKeyManager.listProductAttrValues(queryReqVO)); } } diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java new file mode 100644 index 000000000..b77815791 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java @@ -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 productAttrValueIds; + + @ApiModelProperty(value = "规格键编号", required = true, example = "2") + private Integer productAttrKeyId; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java index a6ee07584..60d0cfd34 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java @@ -34,4 +34,6 @@ public interface ProductAttrConvert { List convertList02(List list); + ProductAttrValueListQueryRequestDTO convert(ProductAttrValueListQueryReqVO bean); + } diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductAttrKeyManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductAttrKeyManager.java index c724b7826..cfa5ec083 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductAttrKeyManager.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductAttrKeyManager.java @@ -121,11 +121,12 @@ public class ProductAttrKeyManager { /** * 获得商品规格值列表 * - * @param productAttrValueIds 商品规格值编号列表 + * @param queryReqVO 商品规格值的列表查询条件 VO * @return 商品规格值列表 */ - public List listProductAttrValues(List productAttrValueIds) { - CommonResult> listProductAttrValueResult = productAttrKeyRpc.listProductAttrValues(productAttrValueIds); + public List listProductAttrValues(ProductAttrValueListQueryReqVO queryReqVO) { + CommonResult> listProductAttrValueResult = productAttrKeyRpc.listProductAttrValues( + ProductAttrConvert.INSTANCE.convert(queryReqVO)); listProductAttrValueResult.checkError(); return ProductAttrConvert.INSTANCE.convertList02(listProductAttrValueResult.getData()); } diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpc.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpc.java index 577660bac..385e224b3 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpc.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpc.java @@ -76,9 +76,9 @@ public interface ProductAttrRpc { /** * 获得商品规格值列表 * - * @param productAttrValueIds 商品规格值编号列表 + * @param queryDTO 商品规格值的列表查询条件 DTO * @return 商品规格值列表 */ - CommonResult> listProductAttrValues(List productAttrValueIds); + CommonResult> listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO); } diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueListQueryRequestDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueListQueryRequestDTO.java new file mode 100644 index 000000000..d11f7b31d --- /dev/null +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueListQueryRequestDTO.java @@ -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 productAttrValueIds; + + /** + * 商品规格键编号 + */ + private Integer productAttrKeyId; + +} diff --git a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueUpdateReqDTO.java b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueUpdateReqDTO.java index 69e455c11..2cac47a0f 100644 --- a/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueUpdateReqDTO.java +++ b/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/attr/dto/ProductAttrValueUpdateReqDTO.java @@ -2,16 +2,13 @@ package cn.iocoder.mall.productservice.rpc.attr.dto; import cn.iocoder.common.framework.enums.CommonStatusEnum; import cn.iocoder.common.framework.validator.InEnum; -import lombok.*; -import lombok.experimental.*; +import lombok.Data; +import lombok.experimental.Accessors; -import io.swagger.annotations.*; - -import java.util.*; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; import java.io.Serializable; -import javax.validation.constraints.*; - /** * 商品规格值更新 Request DTO */ @@ -24,11 +21,6 @@ public class ProductAttrValueUpdateReqDTO implements Serializable { */ @NotNull(message = "规格值编号不能为空") private Integer id; - /** - * 规格键编号 - */ - @NotNull(message = "规格键编号不能为空") - private Integer attrKeyId; /** * 规格值名字 */ diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java index b9a258e82..9e6e1ee7c 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java @@ -7,6 +7,7 @@ import cn.iocoder.mall.productservice.rpc.attr.dto.*; import cn.iocoder.mall.productservice.service.attr.bo.*; import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.List; @@ -24,7 +25,8 @@ public interface ProductAttrConvert { List convertList(List list); - PageResult convertPage(IPage page); + @Mapping(source = "records", target = "list") + PageResult convertPage(IPage page); ProductAttrKeyCreateBO convert(ProductAttrKeyCreateReqDTO bean); @@ -54,4 +56,6 @@ public interface ProductAttrConvert { List convertList04(List list); + ProductAttrValueListQueryBO convert(ProductAttrValueListQueryRequestDTO bean); + } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java index 4915d134c..76f6a8456 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java @@ -1,15 +1,24 @@ 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.service.attr.bo.ProductAttrValueListQueryBO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface ProductAttrValueMapper extends BaseMapper { default ProductAttrValueDO selectByAttrKeyIdAndName(Integer attrKeyId, String name) { - return selectOne(new QueryWrapper().eq("attrKeyId", attrKeyId).eq("name", name)); + return selectOne(new QueryWrapper().eq("attr_key_id", attrKeyId).eq("name", name)); + } + + default List selectList(ProductAttrValueListQueryBO queryBO) { + return selectList(new QueryWrapperX().inIfPresent("id", queryBO.getProductAttrValueIds()) + .eqIfPresent("attr_key_id", queryBO.getProductAttrKeyId())); } } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/attr/ProductAttrManager.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/attr/ProductAttrManager.java index b05ba37d0..12aa25f4b 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/attr/ProductAttrManager.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/attr/ProductAttrManager.java @@ -107,11 +107,11 @@ public class ProductAttrManager { /** * 获得商品规格值列表 * - * @param productAttrValueIds 商品规格值编号列表 + * @param queryDTO 商品规格值的列表查询条件 DTO * @return 商品规格值列表 */ - public List listProductAttrValues(List productAttrValueIds) { - List productAttrValueBOs = productAttrService.listProductAttrValues(productAttrValueIds); + public List listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO) { + List productAttrValueBOs = productAttrService.listProductAttrValues(ProductAttrConvert.INSTANCE.convert(queryDTO)); return ProductAttrConvert.INSTANCE.convertList04(productAttrValueBOs); } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpcImpl.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpcImpl.java index 85ee0d1f8..0606b06d1 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpcImpl.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/attr/ProductAttrRpcImpl.java @@ -63,8 +63,8 @@ public class ProductAttrRpcImpl implements ProductAttrRpc { } @Override - public CommonResult> listProductAttrValues(List productAttrValueIds) { - return success(productAttrManager.listProductAttrValues(productAttrValueIds)); + public CommonResult> listProductAttrValues(ProductAttrValueListQueryRequestDTO queryDTO) { + return success(productAttrManager.listProductAttrValues(queryDTO)); } } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/ProductAttrService.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/ProductAttrService.java index dac4844c9..517fa257c 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/ProductAttrService.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/ProductAttrService.java @@ -200,11 +200,11 @@ public class ProductAttrService { /** * 获得商品规格值列表 * - * @param productAttrValueIds 商品规格值编号列表 + * @param queryBO 商品规格值的列表查询条件 BO * @return 商品规格值列表 */ - public List listProductAttrValues(List productAttrValueIds) { - List productAttrValueDOs = productAttrValueMapper.selectBatchIds(productAttrValueIds); + public List listProductAttrValues(ProductAttrValueListQueryBO queryBO) { + List productAttrValueDOs = productAttrValueMapper.selectList(queryBO); return ProductAttrConvert.INSTANCE.convertList03(productAttrValueDOs); } diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/bo/ProductAttrValueListQueryBO.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/bo/ProductAttrValueListQueryBO.java new file mode 100644 index 000000000..9f5d3d614 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/attr/bo/ProductAttrValueListQueryBO.java @@ -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 productAttrValueIds; + + /** + * 商品规格键编号 + */ + private Integer productAttrKeyId; + +} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrDetailBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrDetailBO.java deleted file mode 100644 index d6c8737b7..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrDetailBO.java +++ /dev/null @@ -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 values; - -} diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrPageBO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrPageBO.java deleted file mode 100644 index 12786462f..000000000 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/bo/product/ProductAttrPageBO.java +++ /dev/null @@ -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 attrs; - /** - * 总数 - */ - private Integer count; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductAttrService.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductAttrService.java index 55f58a212..6c749d058 100644 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductAttrService.java +++ b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductAttrService.java @@ -23,11 +23,4 @@ public interface ProductAttrService { */ List 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); - } diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrDetailBO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrDetailBO.java deleted file mode 100644 index 0911e4d0e..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrDetailBO.java +++ /dev/null @@ -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 values; - -} diff --git a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrPageBO.java b/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrPageBO.java deleted file mode 100644 index f44cce203..000000000 --- a/product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrPageBO.java +++ /dev/null @@ -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 attrs; - /** - * 总数 - */ - private Integer count; - -}