product brand
This commit is contained in:
parent
055d204ded
commit
08f3d35573
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.biz.bo.product;
|
||||
package cn.iocoder.mall.product.biz.bo.brand;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.bo.product;
|
||||
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
package cn.iocoder.mall.product.biz.convert.product;
|
||||
package cn.iocoder.mall.product.biz.convert.brand;
|
||||
|
||||
import cn.iocoder.mall.product.biz.bo.product.ProductBrandBO;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO;
|
||||
import cn.iocoder.mall.product.biz.dto.product.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.product.ProductBrandUpdateDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@ -15,6 +18,9 @@ public interface ProductBrandConvert {
|
||||
|
||||
ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class);
|
||||
|
||||
@Mapping(source = "records", target = "list")
|
||||
PageResult<ProductBrandBO> convertPage(IPage<ProductBrandDO> bean);
|
||||
|
||||
@Mappings({})
|
||||
List<ProductBrandBO> convert(List<ProductBrandDO> brands);
|
||||
|
||||
@ -26,5 +32,4 @@ public interface ProductBrandConvert {
|
||||
|
||||
@Mappings({})
|
||||
ProductBrandDO convert(ProductBrandAddDTO brand);
|
||||
|
||||
}
|
@ -1,11 +1,25 @@
|
||||
package cn.iocoder.mall.product.biz.dao.product;
|
||||
|
||||
import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ProductBrandMapper extends BaseMapper<ProductBrandDO> {
|
||||
|
||||
|
||||
default IPage<ProductBrandDO> selectListByParams(ProductBrandPageDTO productBrandPageDTO) {
|
||||
Page<ProductBrandDO> page = new Page<>(productBrandPageDTO.getPageNo(), productBrandPageDTO.getPageSize());
|
||||
LambdaQueryWrapper<ProductBrandDO> queryWrapper = Wrappers.<ProductBrandDO>query().lambda()
|
||||
.like(StringUtils.isNotBlank(productBrandPageDTO.getName()), ProductBrandDO::getName, productBrandPageDTO.getName())
|
||||
.like(StringUtils.isNotBlank(productBrandPageDTO.getDescription()), ProductBrandDO::getName, productBrandPageDTO.getDescription())
|
||||
.eq(null != productBrandPageDTO.getStatus(), ProductBrandDO::getName, productBrandPageDTO.getStatus())
|
||||
.eq(ProductBrandDO::getDeleted, false);
|
||||
return selectPage(page, queryWrapper);
|
||||
}
|
||||
}
|
@ -2,12 +2,14 @@ package cn.iocoder.mall.product.biz.dataobject.product;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Product 品牌
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ProductBrandDO extends DeletableDO {
|
||||
|
||||
@ -32,7 +34,7 @@ public class ProductBrandDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* <p>
|
||||
* 1-开启
|
||||
* 2-禁用
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AdminProductAttrPageDTO extends PageParam {
|
||||
public class ProductAttrPageDTO extends PageParam {
|
||||
/**
|
||||
* 商品规格名字
|
||||
*/
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.biz.dto.product;
|
||||
package cn.iocoder.mall.product.biz.dto.brand;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
@ -1,16 +1,17 @@
|
||||
package cn.iocoder.mall.product.biz.dto.product;
|
||||
package cn.iocoder.mall.product.biz.dto.brand;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 商品品牌分页 DTO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ProductBrandPageDTO {
|
||||
public class ProductBrandPageDTO extends PageParam {
|
||||
|
||||
/**
|
||||
* 名称
|
||||
@ -27,10 +28,4 @@ public class ProductBrandPageDTO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.biz.dto.product;
|
||||
package cn.iocoder.mall.product.biz.dto.brand;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
@ -20,7 +20,7 @@ public interface ProductAttrService {
|
||||
* @param productAttrPageDTO 查询参数
|
||||
* @return 规格分页信息
|
||||
*/
|
||||
PageResult<ProductAttrWithValueBO> getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO);
|
||||
PageResult<ProductAttrWithValueBO> getProductAttrPage(ProductAttrPageDTO productAttrPageDTO);
|
||||
|
||||
/**
|
||||
* 获得规格属性数组
|
||||
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.mall.product.biz.service.product;
|
||||
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO;
|
||||
|
||||
public interface ProductBrandService {
|
||||
|
||||
/**
|
||||
* 获取品牌分页数据
|
||||
*
|
||||
* @param productBrandPageDTO 翻页参数
|
||||
* @return
|
||||
*/
|
||||
PageResult<ProductBrandBO> getProductBrandPage(ProductBrandPageDTO productBrandPageDTO);
|
||||
|
||||
/**
|
||||
* 获取品牌明细
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
ProductBrandBO getProductBrand(Integer id);
|
||||
|
||||
/**
|
||||
* 添加品牌
|
||||
*
|
||||
* @param productBrandAddDTO 添加参数
|
||||
* @return
|
||||
*/
|
||||
ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO);
|
||||
|
||||
/**
|
||||
* 更新品牌
|
||||
*
|
||||
* @param productBrandUpdateDTO 更新参数
|
||||
* @return
|
||||
*/
|
||||
Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO);
|
||||
|
||||
|
||||
}
|
@ -44,7 +44,7 @@ public class ProductAttrServiceImpl implements ProductAttrService {
|
||||
private ProductAttrValueMapper productAttrValueMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<ProductAttrWithValueBO> getProductAttrPage(AdminProductAttrPageDTO productAttrPageDTO) {
|
||||
public PageResult<ProductAttrWithValueBO> getProductAttrPage(ProductAttrPageDTO productAttrPageDTO) {
|
||||
//查询分页
|
||||
Page<ProductAttrDO> page = new Page<>(productAttrPageDTO.getPageNo(), productAttrPageDTO.getPageSize());
|
||||
LambdaQueryWrapper<ProductAttrDO> queryWrapper = Wrappers.<ProductAttrDO>query().lambda()
|
||||
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.mall.product.biz.service.product.impl;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert;
|
||||
import cn.iocoder.mall.product.biz.dao.product.ProductBrandMapper;
|
||||
import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO;
|
||||
import cn.iocoder.mall.product.biz.enums.ProductErrorCodeEnum;
|
||||
import cn.iocoder.mall.product.biz.service.product.ProductBrandService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品规格 Service 实现类
|
||||
*
|
||||
* @see ProductBrandDO
|
||||
*/
|
||||
@Service
|
||||
public class ProductBrandServiceImpl implements ProductBrandService {
|
||||
|
||||
@Autowired
|
||||
private ProductBrandMapper productBrandMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<ProductBrandBO> getProductBrandPage(ProductBrandPageDTO productBrandPageDTO) {
|
||||
IPage<ProductBrandDO> brandPage = productBrandMapper.selectListByParams(productBrandPageDTO);
|
||||
return ProductBrandConvert.INSTANCE.convertPage(brandPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductBrandBO getProductBrand(Integer brandId) {
|
||||
return ProductBrandConvert.INSTANCE.convert(productBrandMapper.selectById(brandId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductBrandBO addProductBrand(Integer adminId, ProductBrandAddDTO productBrandAddDTO) {
|
||||
// 校验品牌名不重复
|
||||
int count = productBrandMapper.selectCount(Wrappers.<ProductBrandDO>query().lambda()
|
||||
.eq(ProductBrandDO::getName, productBrandAddDTO.getName())
|
||||
.eq(ProductBrandDO::getDeleted, false));
|
||||
if (count > 0) {
|
||||
throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_BRAND_EXIST.getCode());
|
||||
}
|
||||
ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandAddDTO);
|
||||
productBrandDO.setCreateTime(new Date());
|
||||
productBrandDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||
productBrandMapper.insert(productBrandDO);
|
||||
return ProductBrandConvert.INSTANCE.convert(productBrandDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateProductBrand(Integer adminId, ProductBrandUpdateDTO productBrandUpdateDTO) {
|
||||
ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(productBrandUpdateDTO);
|
||||
productBrandDO.setUpdateTime(new Date());
|
||||
productBrandMapper.updateById(productBrandDO);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -9,13 +9,13 @@ import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO;
|
||||
import cn.iocoder.mall.product.biz.dto.attr.*;
|
||||
import cn.iocoder.mall.product.biz.service.product.ProductAttrService;
|
||||
import cn.iocoder.mall.product.rest.convert.attr.ProductAttrConvert;
|
||||
import cn.iocoder.mall.product.rest.request.attr.AdminProductAttrPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrAddRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrUpdateRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrValueAddRequest;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrPageResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrSimpleResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrVO;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProdutAttrResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrValueResponse;
|
||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -45,8 +45,8 @@ public class AdminsProductAttrController {
|
||||
|
||||
@GetMapping("/attr/page")
|
||||
@ApiOperation("获得规格分页")
|
||||
public CommonResult<PageResult<AdminsProductAttrPageResponse>> attrPage(AdminProductAttrPageRequest request) {
|
||||
AdminProductAttrPageDTO pageDTO = ProductAttrConvert.INSTANCE.convert(request);
|
||||
public CommonResult<PageResult<AdminsProductAttrPageResponse>> attrPage(ProductAttrPageRequest request) {
|
||||
ProductAttrPageDTO pageDTO = ProductAttrConvert.INSTANCE.convert(request);
|
||||
PageResult<ProductAttrWithValueBO> productAttrPage = productAttrService.getProductAttrPage(pageDTO);
|
||||
PageResult<AdminsProductAttrPageResponse> adminPageResponse = ProductAttrConvert.INSTANCE.convertPage(productAttrPage);
|
||||
return CommonResult.success(adminPageResponse);
|
||||
@ -62,7 +62,7 @@ public class AdminsProductAttrController {
|
||||
|
||||
@PostMapping("/attr/add")
|
||||
@ApiOperation(value = "创建商品规格")
|
||||
public CommonResult<AdminsProductAttrVO> addAttr(@Validated ProductAttrAddRequest addRequest) {
|
||||
public CommonResult<AdminsProdutAttrResponse> addAttr(@Validated ProductAttrAddRequest addRequest) {
|
||||
// 创建 ProductAttrAddDTO 对象
|
||||
ProductAttrAddDTO productAttrAddDTO = new ProductAttrAddDTO().setName(addRequest.getName());
|
||||
// 添加
|
||||
|
@ -0,0 +1,90 @@
|
||||
package cn.iocoder.mall.product.rest.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO;
|
||||
import cn.iocoder.mall.product.biz.service.product.ProductBrandService;
|
||||
import cn.iocoder.mall.product.rest.convert.brand.ProductBrandConvert;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandAddRequest;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandUpdateRequest;
|
||||
import cn.iocoder.mall.product.rest.response.brand.AdminsProductBrandResponse;
|
||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/brand")
|
||||
@Api("商品品牌")
|
||||
public class AdminsProductBrandController {
|
||||
|
||||
private ProductBrandService productBrandService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("创建品牌")
|
||||
public CommonResult<AdminsProductBrandResponse> add(@Validated ProductBrandAddRequest addRequest) {
|
||||
// 创建 ProductBrandAddDTO 对象
|
||||
ProductBrandAddDTO productBrandAddDTO = ProductBrandConvert.INSTANCE.convertAdd(addRequest);
|
||||
// 保存品牌
|
||||
ProductBrandBO result = productBrandService.addProductBrand(AdminSecurityContextHolder.getContext().getAdminId(), productBrandAddDTO);
|
||||
// 返回结果
|
||||
return success(ProductBrandConvert.INSTANCE.convert(result));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "品牌主键", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "name", value = "品牌名称", required = true, example = "安踏"),
|
||||
@ApiImplicitParam(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋"),
|
||||
@ApiImplicitParam(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn"),
|
||||
@ApiImplicitParam(name = "status", value = "状态 1开启 2禁用", required = true, example = "1")
|
||||
})
|
||||
public CommonResult<Boolean> update(@Validated ProductBrandUpdateRequest updateRequest) {
|
||||
// 创建 productBrandUpdateDTO 对象
|
||||
ProductBrandUpdateDTO productBrandUpdateDTO = ProductBrandConvert.INSTANCE.convertUpdate(updateRequest);
|
||||
// 更新商品
|
||||
return success(productBrandService.updateProductBrand(AdminSecurityContextHolder.getContext().getAdminId(), productBrandUpdateDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获取品牌")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "品牌主键", required = true, example = "1")
|
||||
})
|
||||
public CommonResult<AdminsProductBrandResponse> add(@RequestParam("id") Integer id) {
|
||||
// 保存商品
|
||||
ProductBrandBO result = productBrandService.getProductBrand(id);
|
||||
// 返回结果
|
||||
return success(ProductBrandConvert.INSTANCE.convert(result));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得品牌分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "品牌名称", required = true, example = "安踏"),
|
||||
@ApiImplicitParam(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋"),
|
||||
@ApiImplicitParam(name = "status", value = "状态 1开启 2禁用", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页面大小", required = true, example = "10")
|
||||
})
|
||||
public CommonResult<PageResult<AdminsProductBrandResponse>> attrPage(ProductBrandPageRequest pageRequest) {
|
||||
// 创建 ProductBrandPageDTO 对象
|
||||
ProductBrandPageDTO productBrandPageDTO = ProductBrandConvert.INSTANCE.convertPageRequest(pageRequest);
|
||||
// 查询分页
|
||||
PageResult<ProductBrandBO> productBrandPage = productBrandService.getProductBrandPage(productBrandPageDTO);
|
||||
PageResult<AdminsProductBrandResponse> adminPageResponse = ProductBrandConvert.INSTANCE.convertPage(productBrandPage);
|
||||
return CommonResult.success(adminPageResponse);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,13 +5,13 @@ import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrWithValueBO;
|
||||
import cn.iocoder.mall.product.biz.dto.attr.AdminProductAttrPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.attr.ProductAttrPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.attr.ProductAttrUpdateDTO;
|
||||
import cn.iocoder.mall.product.rest.request.attr.AdminProductAttrPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.attr.ProductAttrUpdateRequest;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrPageResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrSimpleResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrVO;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProdutAttrResponse;
|
||||
import cn.iocoder.mall.product.rest.response.attr.AdminsProductAttrValueResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
@ -25,7 +25,7 @@ public interface ProductAttrConvert {
|
||||
ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminProductAttrPageDTO convert(AdminProductAttrPageRequest bean);
|
||||
ProductAttrPageDTO convert(ProductAttrPageRequest bean);
|
||||
|
||||
@Mappings({})
|
||||
PageResult<AdminsProductAttrPageResponse> convertPage(PageResult<ProductAttrWithValueBO> productAttrPage);
|
||||
@ -34,7 +34,7 @@ public interface ProductAttrConvert {
|
||||
List<AdminsProductAttrSimpleResponse> convertSimple(List<ProductAttrSimpleWithValueBO> simpleList);
|
||||
|
||||
@Mappings({})
|
||||
AdminsProductAttrVO convertAttr(ProductAttrBO attrBO);
|
||||
AdminsProdutAttrResponse convertAttr(ProductAttrBO attrBO);
|
||||
|
||||
@Mappings({})
|
||||
ProductAttrUpdateDTO convertUpdate(ProductAttrUpdateRequest updateRequest);
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.mall.product.rest.convert.brand;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandAddDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandPageDTO;
|
||||
import cn.iocoder.mall.product.biz.dto.brand.ProductBrandUpdateDTO;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandAddRequest;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandPageRequest;
|
||||
import cn.iocoder.mall.product.rest.request.brand.ProductBrandUpdateRequest;
|
||||
import cn.iocoder.mall.product.rest.response.brand.AdminsProductBrandResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ProductBrandConvert {
|
||||
|
||||
ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminsProductBrandResponse convert(ProductBrandBO brand);
|
||||
|
||||
@Mappings({})
|
||||
ProductBrandAddDTO convertAdd(ProductBrandAddRequest addRequest);
|
||||
|
||||
@Mappings({})
|
||||
ProductBrandUpdateDTO convertUpdate(ProductBrandUpdateRequest updateRequest);
|
||||
|
||||
@Mappings({})
|
||||
ProductBrandPageDTO convertPageRequest(ProductBrandPageRequest pageRequest);
|
||||
|
||||
@Mappings({})
|
||||
PageResult<AdminsProductBrandResponse> convertPage(PageResult<ProductBrandBO> productBrandPage);
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
package cn.iocoder.mall.product.rest.request.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 规格添加
|
||||
*/
|
||||
@ApiModel("商品 - 规格模块 - 商品规格添加 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductAttrAddRequest {
|
||||
|
@ -11,7 +11,7 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class AdminProductAttrPageRequest extends PageParam {
|
||||
public class ProductAttrPageRequest extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "商品规格名字,模糊匹配", example = "材料")
|
||||
private String name;
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.mall.product.rest.request.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@ -7,9 +8,7 @@ import lombok.experimental.Accessors;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 规格修改
|
||||
*/
|
||||
@ApiModel("商品 - 规格模块 - 商品规格修改 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductAttrUpdateRequest {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.mall.product.rest.request.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@ -7,9 +8,7 @@ import lombok.experimental.Accessors;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Product 规格值添加 DTO
|
||||
*/
|
||||
@ApiModel("商品 - 规格模块 - 商品规格值添加 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductAttrValueAddRequest {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.mall.product.rest.request.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@ -12,6 +13,7 @@ import javax.validation.constraints.NotNull;
|
||||
* <p>
|
||||
* 注意,不允许修改所属规格
|
||||
*/
|
||||
@ApiModel("商品 - 规格模块 - 商品规格值修改 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductAttrValueUpdateRequest {
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.mall.product.rest.request.brand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@ApiModel("商品 - 品牌模块 - 商品品牌新增 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductBrandAddRequest {
|
||||
|
||||
@ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏")
|
||||
@NotEmpty(message = "品牌名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn")
|
||||
private String picUrl;
|
||||
|
||||
@ApiModelProperty(name = "status", value = "状态 1开启 2禁用", required = true, example = "1")
|
||||
private Integer status;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.mall.product.rest.request.brand;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("商品 - 品牌模块 - 品牌分页 Request")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ProductBrandPageRequest extends PageParam {
|
||||
|
||||
@ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "name", value = "品牌描述", required = true, example = "安踏拖鞋")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(name = "name", value = "状态 1开启 2禁用", required = true, example = "1")
|
||||
private String status;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.mall.product.rest.request.brand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("商品 - 品牌模块 - 商品品牌更新 Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductBrandUpdateRequest {
|
||||
|
||||
@ApiModelProperty(name = "id", value = "规格编号", required = true, example = "1")
|
||||
@NotNull(message = "品牌编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏")
|
||||
@NotEmpty(message = "品牌名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn")
|
||||
private String picUrl;
|
||||
|
||||
@ApiModelProperty(name = "status", value = "状态 1开启 2禁用", required = true, example = "1")
|
||||
private Integer status;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package cn.iocoder.mall.product.rest.response.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "商品规格 VO", description = "不带有规格值数组")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProductAttrVO {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -1,4 +1,24 @@
|
||||
package cn.iocoder.mall.product.rest.response.attr;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "商品规格 VO", description = "不带有规格值数组")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProdutAttrResponse {
|
||||
|
||||
@ApiModelProperty(value = "规格编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "规格名", required = true, example = "颜色")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.mall.product.rest.response.brand;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* VO
|
||||
*/
|
||||
@ApiModel(value = "商品品牌", description = "商品品牌")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProductBrandResponse {
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
@ApiModelProperty(value = "品牌编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(name = "name", value = "品牌名称", required = true, example = "安踏")
|
||||
@NotEmpty(message = "品牌名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "description", value = "品牌描述", required = true, example = "安踏拖鞋")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(name = "picUrl", value = "品牌图片", required = true, example = "http://www.iocoder.cn")
|
||||
private String picUrl;
|
||||
|
||||
@ApiModelProperty(name = "status", value = "状态 1开启 2禁用", required = true, example = "1")
|
||||
private Integer status;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user