商品分类部分提交
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package cn.iocoder.mall.product.application.config;
|
||||
|
||||
import cn.iocoder.common.framework.config.GlobalExceptionHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
@@ -8,7 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@EnableWebMvc
|
||||
@Configuration
|
||||
//@Import(value = {GlobalExceptionHandler.class}) // 统一全局返回
|
||||
@Import(value = {GlobalExceptionHandler.class}) // 统一全局返回
|
||||
public class MVCConfiguration implements WebMvcConfigurer {
|
||||
|
||||
// @Autowired
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.mall.product.application.controller.admins;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/product/category")
|
||||
@Api("商品分类")
|
||||
public class AdminsProductCategoryController {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package cn.iocoder.mall.product.application.controller.users;
|
||||
import cn.iocoder.mall.product.api.ProductCategoryService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.application.convert.ProductCategoryConvert;
|
||||
import cn.iocoder.mall.product.application.vo.ProductCategoryVO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductCategorySimpleVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("user/product/category")
|
||||
@RestController("productCategoryController_users")
|
||||
@RequestMapping("users/product/category")
|
||||
@Api("商品分类")
|
||||
public class ProductCategoryController {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ProductCategoryController {
|
||||
@GetMapping
|
||||
@ApiOperation("获得指定编号下的子分类的数组")
|
||||
@ApiImplicitParam(name = "pid", value = "指定分类编号", required = true, example = "0")
|
||||
public List<ProductCategoryVO> list(@RequestParam("pid") Integer pid) {
|
||||
public List<ProductCategorySimpleVO> list(@RequestParam("pid") Integer pid) {
|
||||
List<ProductCategoryBO> result = productCategoryService.getListByPid(pid);
|
||||
return ProductCategoryConvert.INSTANCE.convertToVO(result);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.application.convert;
|
||||
|
||||
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductCategoryVO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductCategorySimpleVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -14,9 +14,9 @@ public interface ProductCategoryConvert {
|
||||
ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
ProductCategoryVO convertToVO(ProductCategoryBO category);
|
||||
ProductCategorySimpleVO convertToVO(ProductCategoryBO category);
|
||||
|
||||
List<ProductCategoryVO> convertToVO(List<ProductCategoryBO> categoryList);
|
||||
List<ProductCategorySimpleVO> convertToVO(List<ProductCategoryBO> categoryList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("商品分类(简单)")
|
||||
public class ProductCategorySimpleVO {
|
||||
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "分类名", required = true, example = "手机")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg")
|
||||
private String picUrl;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
@ApiModel("产品分类树节点 VO")
|
||||
public class ProductCategoryTreeNodeVO {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,40 +1,4 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel("商品分类")
|
||||
public class ProductCategoryVO {
|
||||
|
||||
@ApiModelProperty(value = "分类编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "分类名", required = true, example = "手机")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg")
|
||||
private String picUrl;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user