mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
商品规格实体类增加Product前缀
This commit is contained in:
parent
9dad9e555f
commit
733a3c4615
47
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
Executable file → Normal file
47
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/PropertyController.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java
Executable file → Normal file
@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property;
|
||||
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
@ -22,31 +22,30 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
|
||||
import cn.iocoder.yudao.module.product.convert.property.PropertyConvert;
|
||||
import cn.iocoder.yudao.module.product.service.property.PropertyService;
|
||||
import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyService;
|
||||
|
||||
@Api(tags = "管理后台 - 规格名称")
|
||||
@RestController
|
||||
@RequestMapping("/product/property")
|
||||
@Validated
|
||||
public class PropertyController {
|
||||
public class ProductPropertyController {
|
||||
|
||||
@Resource
|
||||
private PropertyService propertyService;
|
||||
private ProductPropertyService productPropertyService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建规格名称")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:create')")
|
||||
public CommonResult<Long> createProperty(@Valid @RequestBody PropertyCreateReqVO createReqVO) {
|
||||
return success(propertyService.createProperty(createReqVO));
|
||||
public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyCreateReqVO createReqVO) {
|
||||
return success(productPropertyService.createProperty(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新规格名称")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:update')")
|
||||
public CommonResult<Boolean> updateProperty(@Valid @RequestBody PropertyUpdateReqVO updateReqVO) {
|
||||
propertyService.updateProperty(updateReqVO);
|
||||
public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyUpdateReqVO updateReqVO) {
|
||||
productPropertyService.updateProperty(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ public class PropertyController {
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('product:property:delete')")
|
||||
public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) {
|
||||
propertyService.deleteProperty(id);
|
||||
productPropertyService.deleteProperty(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -63,38 +62,38 @@ public class PropertyController {
|
||||
@ApiOperation("获得规格名称")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('product:property:query')")
|
||||
public CommonResult<PropertyRespVO> getProperty(@RequestParam("id") Long id) {
|
||||
PropertyDO property = propertyService.getProperty(id);
|
||||
return success(PropertyConvert.INSTANCE.convert(property));
|
||||
public CommonResult<ProductPropertyRespVO> getProperty(@RequestParam("id") Long id) {
|
||||
ProductPropertyDO property = productPropertyService.getProperty(id);
|
||||
return success(ProductPropertyConvert.INSTANCE.convert(property));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得规格名称列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('product:property:query')")
|
||||
public CommonResult<List<PropertyRespVO>> getPropertyList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PropertyDO> list = propertyService.getPropertyList(ids);
|
||||
return success(PropertyConvert.INSTANCE.convertList(list));
|
||||
public CommonResult<List<ProductPropertyRespVO>> getPropertyList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<ProductPropertyDO> list = productPropertyService.getPropertyList(ids);
|
||||
return success(ProductPropertyConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得规格名称分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:query')")
|
||||
public CommonResult<PageResult<PropertyRespVO>> getPropertyPage(@Valid PropertyPageReqVO pageVO) {
|
||||
PageResult<PropertyDO> pageResult = propertyService.getPropertyPage(pageVO);
|
||||
return success(PropertyConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<ProductPropertyRespVO>> getPropertyPage(@Valid ProductPropertyPageReqVO pageVO) {
|
||||
PageResult<ProductPropertyDO> pageResult = productPropertyService.getPropertyPage(pageVO);
|
||||
return success(ProductPropertyConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出规格名称 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportPropertyExcel(@Valid PropertyExportReqVO exportReqVO,
|
||||
public void exportPropertyExcel(@Valid ProductPropertyExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<PropertyDO> list = propertyService.getPropertyList(exportReqVO);
|
||||
List<ProductPropertyDO> list = productPropertyService.getPropertyList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<PropertyExcelVO> datas = PropertyConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "规格名称.xls", "数据", PropertyExcelVO.class, datas);
|
||||
List<ProductPropertyExcelVO> datas = ProductPropertyConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "规格名称.xls", "数据", ProductPropertyExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
2
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyBaseVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java
Executable file → Normal file
2
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyBaseVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyBaseVO.java
Executable file → Normal file
@ -10,7 +10,7 @@ import javax.validation.constraints.*;
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PropertyBaseVO {
|
||||
public class ProductPropertyBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "规格名称")
|
||||
private String name;
|
@ -1,14 +1,12 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.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 PropertyCreateReqVO extends PropertyBaseVO {
|
||||
public class ProductPropertyCreateReqVO extends ProductPropertyBaseVO {
|
||||
|
||||
}
|
2
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java
Executable file → Normal file
2
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyExcelVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyExcelVO.java
Executable file → Normal file
@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class PropertyExcelVO {
|
||||
public class ProductPropertyExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
|
||||
@ApiModel(value = "管理后台 - 规格名称 Excel 导出 Request VO", description = "参数和 PropertyPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PropertyExportReqVO {
|
||||
public class ProductPropertyExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格名称")
|
||||
private String name;
|
@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PropertyPageReqVO extends PageParam {
|
||||
public class ProductPropertyPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "规格名称")
|
||||
private String name;
|
5
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java
Executable file → Normal file
5
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/PropertyRespVO.java → yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/ProductPropertyRespVO.java
Executable file → Normal file
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.propertyvalue.vo.PropertyValueRespVO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
@ -8,7 +9,7 @@ import io.swagger.annotations.*;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PropertyRespVO extends PropertyBaseVO {
|
||||
public class ProductPropertyRespVO extends ProductPropertyBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "主键", required = true)
|
||||
private Long id;
|
||||
@ -16,4 +17,6 @@ public class PropertyRespVO extends PropertyBaseVO {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
private List<PropertyValueRespVO> propertyValueRespVOList;
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.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 PropertyUpdateReqVO extends PropertyBaseVO {
|
||||
public class ProductPropertyUpdateReqVO extends ProductPropertyBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "主键", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.product.convert.property;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
|
||||
|
||||
/**
|
||||
* 规格名称 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductPropertyConvert {
|
||||
|
||||
ProductPropertyConvert INSTANCE = Mappers.getMapper(ProductPropertyConvert.class);
|
||||
|
||||
ProductPropertyDO convert(ProductPropertyCreateReqVO bean);
|
||||
|
||||
ProductPropertyDO convert(ProductPropertyUpdateReqVO bean);
|
||||
|
||||
ProductPropertyRespVO convert(ProductPropertyDO bean);
|
||||
|
||||
List<ProductPropertyRespVO> convertList(List<ProductPropertyDO> list);
|
||||
|
||||
PageResult<ProductPropertyRespVO> convertPage(PageResult<ProductPropertyDO> page);
|
||||
|
||||
List<ProductPropertyExcelVO> convertList02(List<ProductPropertyDO> list);
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.convert.property;
|
||||
|
||||
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.property.vo.*;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
|
||||
|
||||
/**
|
||||
* 规格名称 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PropertyConvert {
|
||||
|
||||
PropertyConvert INSTANCE = Mappers.getMapper(PropertyConvert.class);
|
||||
|
||||
PropertyDO convert(PropertyCreateReqVO bean);
|
||||
|
||||
PropertyDO convert(PropertyUpdateReqVO bean);
|
||||
|
||||
PropertyRespVO convert(PropertyDO bean);
|
||||
|
||||
List<PropertyRespVO> convertList(List<PropertyDO> list);
|
||||
|
||||
PageResult<PropertyRespVO> convertPage(PageResult<PropertyDO> page);
|
||||
|
||||
List<PropertyExcelVO> convertList02(List<PropertyDO> list);
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ import lombok.*;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PropertyDO extends BaseDO {
|
||||
public class ProductPropertyDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.propertyvalue;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -31,7 +31,7 @@ public class PropertyValueDO extends BaseDO {
|
||||
/**
|
||||
* 规格键 id
|
||||
*
|
||||
* TODO @franky:加个 关联 {@link PropertyDO#getId()} ,这样就能更好的知道
|
||||
* TODO @franky:加个 关联 {@link ProductPropertyDO#getId()} ,这样就能更好的知道
|
||||
*/
|
||||
private Long propertyId;
|
||||
/**
|
||||
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.property;
|
||||
|
||||
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.property.ProductPropertyDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
|
||||
|
||||
/**
|
||||
* 规格名称 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> {
|
||||
|
||||
default PageResult<ProductPropertyDO> selectPage(ProductPropertyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ProductPropertyDO>()
|
||||
.likeIfPresent(ProductPropertyDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ProductPropertyDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(ProductPropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(ProductPropertyDO::getId));
|
||||
}
|
||||
|
||||
default List<ProductPropertyDO> selectList(ProductPropertyExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<ProductPropertyDO>()
|
||||
.likeIfPresent(ProductPropertyDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ProductPropertyDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(ProductPropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(ProductPropertyDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.property;
|
||||
|
||||
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.property.PropertyDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
|
||||
|
||||
/**
|
||||
* 规格名称 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PropertyMapper extends BaseMapperX<PropertyDO> {
|
||||
|
||||
default PageResult<PropertyDO> selectPage(PropertyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PropertyDO>()
|
||||
.likeIfPresent(PropertyDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PropertyDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(PropertyDO::getId));
|
||||
}
|
||||
|
||||
default List<PropertyDO> selectList(PropertyExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<PropertyDO>()
|
||||
.likeIfPresent(PropertyDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PropertyDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(PropertyDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc(PropertyDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.product.service.property;
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.*;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
@ -11,7 +11,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PropertyService {
|
||||
public interface ProductPropertyService {
|
||||
|
||||
/**
|
||||
* 创建规格名称
|
||||
@ -19,14 +19,14 @@ public interface PropertyService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createProperty(@Valid PropertyCreateReqVO createReqVO);
|
||||
Long createProperty(@Valid ProductPropertyCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新规格名称
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProperty(@Valid PropertyUpdateReqVO updateReqVO);
|
||||
void updateProperty(@Valid ProductPropertyUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除规格名称
|
||||
@ -41,7 +41,7 @@ public interface PropertyService {
|
||||
* @param id 编号
|
||||
* @return 规格名称
|
||||
*/
|
||||
PropertyDO getProperty(Long id);
|
||||
ProductPropertyDO getProperty(Long id);
|
||||
|
||||
/**
|
||||
* 获得规格名称列表
|
||||
@ -49,7 +49,7 @@ public interface PropertyService {
|
||||
* @param ids 编号
|
||||
* @return 规格名称列表
|
||||
*/
|
||||
List<PropertyDO> getPropertyList(Collection<Long> ids);
|
||||
List<ProductPropertyDO> getPropertyList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得规格名称分页
|
||||
@ -57,7 +57,7 @@ public interface PropertyService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 规格名称分页
|
||||
*/
|
||||
PageResult<PropertyDO> getPropertyPage(PropertyPageReqVO pageReqVO);
|
||||
PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得规格名称列表, 用于 Excel 导出
|
||||
@ -65,6 +65,6 @@ public interface PropertyService {
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 规格名称列表
|
||||
*/
|
||||
List<PropertyDO> getPropertyList(PropertyExportReqVO exportReqVO);
|
||||
List<ProductPropertyDO> getPropertyList(ProductPropertyExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package cn.iocoder.yudao.module.product.service.property;
|
||||
|
||||
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.convert.property.ProductPropertyConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyMapper;
|
||||
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_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 规格名称 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProductPropertyServiceImpl implements ProductPropertyService {
|
||||
|
||||
@Resource
|
||||
private ProductPropertyMapper productPropertyMapper;
|
||||
|
||||
@Override
|
||||
public Long createProperty(ProductPropertyCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
ProductPropertyDO property = ProductPropertyConvert.INSTANCE.convert(createReqVO);
|
||||
productPropertyMapper.insert(property);
|
||||
// 返回
|
||||
return property.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
this.validatePropertyExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ProductPropertyDO updateObj = ProductPropertyConvert.INSTANCE.convert(updateReqVO);
|
||||
productPropertyMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProperty(Long id) {
|
||||
// 校验存在
|
||||
this.validatePropertyExists(id);
|
||||
// 删除
|
||||
productPropertyMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePropertyExists(Long id) {
|
||||
if (productPropertyMapper.selectById(id) == null) {
|
||||
throw exception(PROPERTY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductPropertyDO getProperty(Long id) {
|
||||
return productPropertyMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductPropertyDO> getPropertyList(Collection<Long> ids) {
|
||||
return productPropertyMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ProductPropertyDO> getPropertyPage(ProductPropertyPageReqVO pageReqVO) {
|
||||
return productPropertyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductPropertyDO> getPropertyList(ProductPropertyExportReqVO exportReqVO) {
|
||||
return productPropertyMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.service.property;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyExportReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.PropertyUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.convert.property.PropertyConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.property.PropertyDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.property.PropertyMapper;
|
||||
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_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 规格名称 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PropertyServiceImpl implements PropertyService {
|
||||
|
||||
@Resource
|
||||
private PropertyMapper propertyMapper;
|
||||
|
||||
@Override
|
||||
public Long createProperty(PropertyCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
PropertyDO property = PropertyConvert.INSTANCE.convert(createReqVO);
|
||||
propertyMapper.insert(property);
|
||||
// 返回
|
||||
return property.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProperty(PropertyUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
this.validatePropertyExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PropertyDO updateObj = PropertyConvert.INSTANCE.convert(updateReqVO);
|
||||
propertyMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProperty(Long id) {
|
||||
// 校验存在
|
||||
this.validatePropertyExists(id);
|
||||
// 删除
|
||||
propertyMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePropertyExists(Long id) {
|
||||
if (propertyMapper.selectById(id) == null) {
|
||||
throw exception(PROPERTY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDO getProperty(Long id) {
|
||||
return propertyMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PropertyDO> getPropertyList(Collection<Long> ids) {
|
||||
return propertyMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PropertyDO> getPropertyPage(PropertyPageReqVO pageReqVO) {
|
||||
return propertyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PropertyDO> getPropertyList(PropertyExportReqVO exportReqVO) {
|
||||
return propertyMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user