diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java index d29f7aa2f..54d72da8a 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyCreateReqVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueCreateReqVO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO; import lombok.*; import io.swagger.annotations.*; @@ -15,6 +15,6 @@ public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO { @ApiModelProperty(value = "属性值") @NotNull(message = "属性值不能为空") - List propertyValueList; + List propertyValueList; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java index ca85f4d93..978f26308 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueRespVO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO; import lombok.*; import java.util.*; import io.swagger.annotations.*; @@ -18,6 +18,6 @@ public class ProductPropertyRespVO extends ProductPropertyBaseVO { private Date createTime; @ApiModelProperty(value = "属性值") - private List propertyValueList; + private List propertyValueList; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java index 6e077829e..ed190e8b0 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyUpdateReqVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueCreateReqVO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO; import lombok.*; import io.swagger.annotations.*; import javax.validation.constraints.*; @@ -18,6 +18,6 @@ public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO { @ApiModelProperty(value = "属性值") @NotNull(message = "属性值不能为空") - List propertyValueList; + List propertyValueList; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java old mode 100755 new mode 100644 similarity index 93% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java index 814911ccb..ed600a9ac --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.*; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class PropertyValueBaseVO { +public class ProductPropertyValueBaseVO { @ApiModelProperty(value = "规格键id") private Long propertyId; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java old mode 100755 new mode 100644 similarity index 66% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java index ac4857efd..23ea0690c --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueCreateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueCreateReqVO.java @@ -1,14 +1,12 @@ package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; -import java.util.*; import io.swagger.annotations.*; -import javax.validation.constraints.*; @ApiModel("管理后台 - 规格值创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class PropertyValueCreateReqVO extends PropertyValueBaseVO { +public class ProductPropertyValueCreateReqVO extends ProductPropertyValueBaseVO { } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java old mode 100755 new mode 100644 similarity index 84% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java index ac30456d4..8cbd45a7f --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueRespVO.java @@ -8,7 +8,7 @@ import io.swagger.annotations.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class PropertyValueRespVO extends PropertyValueBaseVO { +public class ProductPropertyValueRespVO extends ProductPropertyValueBaseVO { @ApiModelProperty(value = "主键", required = true) private Integer id; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java old mode 100755 new mode 100644 similarity index 82% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java index 1883192a7..894d6f6eb --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueUpdateReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/ProductPropertyValueUpdateReqVO.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; import lombok.*; -import java.util.*; import io.swagger.annotations.*; import javax.validation.constraints.*; @@ -9,7 +8,7 @@ import javax.validation.constraints.*; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class PropertyValueUpdateReqVO extends PropertyValueBaseVO { +public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO { @ApiModelProperty(value = "主键", required = true) @NotNull(message = "主键不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java deleted file mode 100755 index 59c368f79..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExcelVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; - -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - -import com.alibaba.excel.annotation.ExcelProperty; - -/** - * 规格值 Excel VO - * - * @author 芋道源码 - */ -@Data -public class PropertyValueExcelVO { - - @ExcelProperty("主键") - private Integer id; - - @ExcelProperty("规格键id") - private Long propertyId; - - @ExcelProperty("规格值名字") - private String name; - - @ExcelProperty("状态: 1 开启 ,2 禁用") - private Integer status; - - @ExcelProperty("创建时间") - private Date createTime; - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java deleted file mode 100755 index 6c76156b7..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValueExportReqVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; - -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@ApiModel(value = "管理后台 - 规格值 Excel 导出 Request VO", description = "参数和 PropertyValuePageReqVO 是一致的") -@Data -public class PropertyValueExportReqVO { - - @ApiModelProperty(value = "规格键id") - private Long propertyId; - - @ApiModelProperty(value = "规格值名字") - private String name; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java deleted file mode 100755 index 5308c42d1..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/propertyvalue/vo/PropertyValuePageReqVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo; - -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import org.springframework.format.annotation.DateTimeFormat; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - -@ApiModel("管理后台 - 规格值分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -public class PropertyValuePageReqVO extends PageParam { - - @ApiModelProperty(value = "规格键id") - private Long propertyId; - - @ApiModelProperty(value = "规格值名字") - private String name; - - @ApiModelProperty(value = "状态: 1 开启 ,2 禁用") - private Integer status; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java new file mode 100644 index 000000000..730ce1cf4 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/ProductPropertyValueConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.product.convert.propertyvalue; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; + +/** + * 规格值 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ProductPropertyValueConvert { + + ProductPropertyValueConvert INSTANCE = Mappers.getMapper(ProductPropertyValueConvert.class); + + ProductPropertyValueDO convert(ProductPropertyValueCreateReqVO bean); + + ProductPropertyValueDO convert(ProductPropertyValueUpdateReqVO bean); + + ProductPropertyValueRespVO convert(ProductPropertyValueDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList03(List list); + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java deleted file mode 100755 index 7886eab85..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/propertyvalue/PropertyValueConvert.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.product.convert.propertyvalue; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; - -/** - * 规格值 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface PropertyValueConvert { - - PropertyValueConvert INSTANCE = Mappers.getMapper(PropertyValueConvert.class); - - PropertyValueDO convert(PropertyValueCreateReqVO bean); - - PropertyValueDO convert(PropertyValueUpdateReqVO bean); - - PropertyValueRespVO convert(PropertyValueDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - - List convertList03(List list); - -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/PropertyValueDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/ProductPropertyValueDO.java old mode 100755 new mode 100644 similarity index 95% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/PropertyValueDO.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/ProductPropertyValueDO.java index 07c7ea45b..2dd1e80b6 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/PropertyValueDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/propertyvalue/ProductPropertyValueDO.java @@ -21,7 +21,7 @@ import lombok.*; @Builder @NoArgsConstructor @AllArgsConstructor -public class PropertyValueDO extends BaseDO { +public class ProductPropertyValueDO extends BaseDO { /** * 主键 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/ProductPropertyValueMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/ProductPropertyValueMapper.java new file mode 100644 index 000000000..760d22481 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/ProductPropertyValueMapper.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.product.dal.mysql.propertyvalue; + +import java.util.*; + +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 规格值 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductPropertyValueMapper extends BaseMapperX { + + default List getPropertyValueListByPropertyId(List propertyIds){ + return selectList(new LambdaQueryWrapperX() + .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds)); + } + + default void deletePropertyValueByPropertyId(Long propertyId){ + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); + queryWrapperX.eq(ProductPropertyValueDO::getPropertyId, propertyId) + .eq(ProductPropertyValueDO::getDeleted, false); + delete(queryWrapperX); + } +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java deleted file mode 100755 index b281450f0..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/propertyvalue/PropertyValueMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.module.product.dal.mysql.propertyvalue; - -import java.util.*; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; -import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; - -/** - * 规格值 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface PropertyValueMapper extends BaseMapperX { - - default PageResult selectPage(PropertyValuePageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId()) - .likeIfPresent(PropertyValueDO::getName, reqVO.getName()) - .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(PropertyValueDO::getId)); - } - - default List selectList(PropertyValueExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(PropertyValueDO::getPropertyId, reqVO.getPropertyId()) - .likeIfPresent(PropertyValueDO::getName, reqVO.getName()) - .eqIfPresent(PropertyValueDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(PropertyValueDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc(PropertyValueDO::getId)); - } - - default List getPropertyValueListByPropertyId(List propertyIds){ - return selectList(new LambdaQueryWrapperX() - .inIfPresent(PropertyValueDO::getPropertyId, propertyIds)); - } - - default void deletePropertyValueByPropertyId(Long propertyId){ - LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); - queryWrapperX.eq(PropertyValueDO::getPropertyId, propertyId).eq(PropertyValueDO::getDeleted, false); - delete(queryWrapperX); - } -} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java index 3990855b3..b940b6799 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java @@ -4,14 +4,14 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.product.controller.admin.property.vo.*; import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyCreateReqVO; import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyUpdateReqVO; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueCreateReqVO; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueRespVO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueCreateReqVO; +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.ProductPropertyValueRespVO; import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert; -import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert; +import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO; import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyMapper; -import cn.iocoder.yudao.module.product.service.propertyvalue.PropertyValueService; +import cn.iocoder.yudao.module.product.service.propertyvalue.ProductPropertyValueService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; @@ -38,7 +38,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { private ProductPropertyMapper productPropertyMapper; @Resource - private PropertyValueService propertyValueService; + private ProductPropertyValueService productPropertyValueService; @Override @Transactional(rollbackFor = Exception.class) @@ -48,10 +48,10 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { productPropertyMapper.insert(property); //插入属性值 - List propertyValueList = createReqVO.getPropertyValueList(); - List propertyValueDOList = PropertyValueConvert.INSTANCE.convertList03(propertyValueList); - propertyValueDOList.stream().forEach(x-> x.setPropertyId(property.getId())); - propertyValueService.batchInsert(propertyValueDOList); + List propertyValueList = createReqVO.getPropertyValueList(); + List productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList); + productPropertyValueDOList.stream().forEach(x-> x.setPropertyId(property.getId())); + productPropertyValueService.batchInsert(productPropertyValueDOList); // 返回 return property.getId(); } @@ -65,11 +65,11 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO); productPropertyMapper.updateById(updateObj); //更新属性值,先删后加 - propertyValueService.deletePropertyValueByPropertyId(updateReqVO.getId()); - List propertyValueList = updateReqVO.getPropertyValueList(); - List propertyValueDOList = PropertyValueConvert.INSTANCE.convertList03(propertyValueList); - propertyValueDOList.stream().forEach(x-> x.setPropertyId(updateReqVO.getId())); - propertyValueService.batchInsert(propertyValueDOList); + productPropertyValueService.deletePropertyValueByPropertyId(updateReqVO.getId()); + List propertyValueList = updateReqVO.getPropertyValueList(); + List productPropertyValueDOList = ProductPropertyValueConvert.INSTANCE.convertList03(propertyValueList); + productPropertyValueDOList.stream().forEach(x-> x.setPropertyId(updateReqVO.getId())); + productPropertyValueService.batchInsert(productPropertyValueDOList); } @Override @@ -79,7 +79,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { // 删除 productPropertyMapper.deleteById(id); //同步删除属性值 - propertyValueService.deletePropertyValueByPropertyId(id); + productPropertyValueService.deletePropertyValueByPropertyId(id); } private void validatePropertyExists(Long id) { @@ -116,12 +116,12 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { List propertyIds = propertyRespVOPageResult.getList().stream().map(x -> x.getId()).collect(Collectors.toList()); //获取属性值列表 - List propertyValueDOList = propertyValueService.getPropertyValueListByPropertyId(propertyIds); - List propertyValueRespVOList = PropertyValueConvert.INSTANCE.convertList(propertyValueDOList); + List productPropertyValueDOList = productPropertyValueService.getPropertyValueListByPropertyId(propertyIds); + List propertyValueRespVOList = ProductPropertyValueConvert.INSTANCE.convertList(productPropertyValueDOList); //组装一对多 propertyRespVOPageResult.getList().stream().forEach(x->{ Long propertyId = x.getId(); - List valueDOList = propertyValueRespVOList.stream().filter(v -> v.getPropertyId().equals(propertyId)).collect(Collectors.toList()); + List valueDOList = propertyValueRespVOList.stream().filter(v -> v.getPropertyId().equals(propertyId)).collect(Collectors.toList()); x.setPropertyValueList(valueDOList); }); return propertyRespVOPageResult; @@ -133,8 +133,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { ProductPropertyDO property = getProperty(id); ProductPropertyRespVO propertyRespVO = ProductPropertyConvert.INSTANCE.convert(property); //查询属性值 - List valueDOList = propertyValueService.getPropertyValueListByPropertyId(Arrays.asList(id)); - List propertyValueRespVOS = PropertyValueConvert.INSTANCE.convertList(valueDOList); + List valueDOList = productPropertyValueService.getPropertyValueListByPropertyId(Arrays.asList(id)); + List propertyValueRespVOS = ProductPropertyValueConvert.INSTANCE.convertList(valueDOList); //组装 propertyRespVO.setPropertyValueList(propertyValueRespVOS); return propertyRespVO; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductProductPropertyValueServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductProductPropertyValueServiceImpl.java new file mode 100644 index 000000000..764f59c32 --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductProductPropertyValueServiceImpl.java @@ -0,0 +1,88 @@ +package cn.iocoder.yudao.module.product.service.propertyvalue; + +import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; +import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO; +import cn.iocoder.yudao.module.product.dal.mysql.propertyvalue.ProductPropertyValueMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_NOT_EXISTS; + +/** + * 规格值 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ProductProductPropertyValueServiceImpl implements ProductPropertyValueService { + + @Resource + private ProductPropertyValueMapper productPropertyValueMapper; + + // TODO @franky:这个合并到 property 中。他们本身是在一起的哈。基本不存在只查询规格,而不查询规格值。 + + @Override + public Integer createPropertyValue(ProductPropertyValueCreateReqVO createReqVO) { + // 插入 + ProductPropertyValueDO propertyValue = ProductPropertyValueConvert.INSTANCE.convert(createReqVO); + productPropertyValueMapper.insert(propertyValue); + // 返回 + return propertyValue.getId(); + } + + @Override + public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) { + // 校验存在 + this.validatePropertyValueExists(updateReqVO.getId()); + // 更新 + ProductPropertyValueDO updateObj = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); + productPropertyValueMapper.updateById(updateObj); + } + + @Override + public void deletePropertyValue(Integer id) { + // 校验存在 + this.validatePropertyValueExists(id); + // 删除 + productPropertyValueMapper.deleteById(id); + } + + private void validatePropertyValueExists(Integer id) { + if (productPropertyValueMapper.selectById(id) == null) { + throw exception(PROPERTY_VALUE_NOT_EXISTS); + } + } + + @Override + public ProductPropertyValueDO getPropertyValue(Integer id) { + return productPropertyValueMapper.selectById(id); + } + + @Override + public List getPropertyValueList(Collection ids) { + return productPropertyValueMapper.selectBatchIds(ids); + } + + @Override + public void batchInsert(List propertyValues) { + productPropertyValueMapper.insertBatch(propertyValues); + } + + @Override + public List getPropertyValueListByPropertyId(List propertyIds) { + return productPropertyValueMapper.getPropertyValueListByPropertyId(propertyIds); + } + + @Override + public void deletePropertyValueByPropertyId(Long propertyId) { + productPropertyValueMapper.deletePropertyValueByPropertyId(propertyId); + } + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductPropertyValueService.java old mode 100755 new mode 100644 similarity index 53% rename from yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java rename to yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductPropertyValueService.java index 94fb44f67..a2bab1cf7 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueService.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/ProductPropertyValueService.java @@ -3,15 +3,14 @@ package cn.iocoder.yudao.module.product.service.propertyvalue; import java.util.*; import javax.validation.*; import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.ProductPropertyValueDO; /** * 规格值 Service 接口 * * @author 芋道源码 */ -public interface PropertyValueService { +public interface ProductPropertyValueService { /** * 创建规格值 @@ -19,14 +18,14 @@ public interface PropertyValueService { * @param createReqVO 创建信息 * @return 编号 */ - Integer createPropertyValue(@Valid PropertyValueCreateReqVO createReqVO); + Integer createPropertyValue(@Valid ProductPropertyValueCreateReqVO createReqVO); /** * 更新规格值 * * @param updateReqVO 更新信息 */ - void updatePropertyValue(@Valid PropertyValueUpdateReqVO updateReqVO); + void updatePropertyValue(@Valid ProductPropertyValueUpdateReqVO updateReqVO); /** * 删除规格值 @@ -41,7 +40,7 @@ public interface PropertyValueService { * @param id 编号 * @return 规格值 */ - PropertyValueDO getPropertyValue(Integer id); + ProductPropertyValueDO getPropertyValue(Integer id); /** * 获得规格值列表 @@ -49,36 +48,20 @@ public interface PropertyValueService { * @param ids 编号 * @return 规格值列表 */ - List getPropertyValueList(Collection ids); - - /** - * 获得规格值分页 - * - * @param pageReqVO 分页查询 - * @return 规格值分页 - */ - PageResult getPropertyValuePage(PropertyValuePageReqVO pageReqVO); - - /** - * 获得规格值列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 规格值列表 - */ - List getPropertyValueList(PropertyValueExportReqVO exportReqVO); + List getPropertyValueList(Collection ids); /** * 批量插入属性值 * @param propertyValues */ - void batchInsert(List propertyValues); + void batchInsert(List propertyValues); /** * 根据属性id查询 * @param propertyIds * @return */ - List getPropertyValueListByPropertyId(List propertyIds); + List getPropertyValueListByPropertyId(List propertyIds); /** * 根据属性id 删除 diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java deleted file mode 100755 index 15ea4e72e..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/propertyvalue/PropertyValueServiceImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -package cn.iocoder.yudao.module.product.service.propertyvalue; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.*; -import cn.iocoder.yudao.module.product.convert.propertyvalue.PropertyValueConvert; -import cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue.PropertyValueDO; -import cn.iocoder.yudao.module.product.dal.mysql.propertyvalue.PropertyValueMapper; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_NOT_EXISTS; - -/** - * 规格值 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class PropertyValueServiceImpl implements PropertyValueService { - - @Resource - private PropertyValueMapper propertyValueMapper; - - // TODO @franky:这个合并到 property 中。他们本身是在一起的哈。基本不存在只查询规格,而不查询规格值。 - - @Override - public Integer createPropertyValue(PropertyValueCreateReqVO createReqVO) { - // 插入 - PropertyValueDO propertyValue = PropertyValueConvert.INSTANCE.convert(createReqVO); - propertyValueMapper.insert(propertyValue); - // 返回 - return propertyValue.getId(); - } - - @Override - public void updatePropertyValue(PropertyValueUpdateReqVO updateReqVO) { - // 校验存在 - this.validatePropertyValueExists(updateReqVO.getId()); - // 更新 - PropertyValueDO updateObj = PropertyValueConvert.INSTANCE.convert(updateReqVO); - propertyValueMapper.updateById(updateObj); - } - - @Override - public void deletePropertyValue(Integer id) { - // 校验存在 - this.validatePropertyValueExists(id); - // 删除 - propertyValueMapper.deleteById(id); - } - - private void validatePropertyValueExists(Integer id) { - if (propertyValueMapper.selectById(id) == null) { - throw exception(PROPERTY_VALUE_NOT_EXISTS); - } - } - - @Override - public PropertyValueDO getPropertyValue(Integer id) { - return propertyValueMapper.selectById(id); - } - - @Override - public List getPropertyValueList(Collection ids) { - return propertyValueMapper.selectBatchIds(ids); - } - - @Override - public PageResult getPropertyValuePage(PropertyValuePageReqVO pageReqVO) { - return propertyValueMapper.selectPage(pageReqVO); - } - - @Override - public List getPropertyValueList(PropertyValueExportReqVO exportReqVO) { - return propertyValueMapper.selectList(exportReqVO); - } - - @Override - public void batchInsert(List propertyValues) { - propertyValueMapper.insertBatch(propertyValues); - } - - @Override - public List getPropertyValueListByPropertyId(List propertyIds) { - return propertyValueMapper.getPropertyValueListByPropertyId(propertyIds); - } - - @Override - public void deletePropertyValueByPropertyId(Long propertyId) { - propertyValueMapper.deletePropertyValueByPropertyId(propertyId); - } - -}