商品系统项目结构整理
This commit is contained in:
@@ -3,7 +3,7 @@ package cn.iocoder.mall.product;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.product"})
|
||||
public class ProductApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.config;
|
||||
package cn.iocoder.mall.product.application.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.config;
|
||||
package cn.iocoder.mall.product.application.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -19,7 +19,7 @@ public class SwaggerConfiguration {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("cn.iocoder.mall.product.controller"))
|
||||
.apis(RequestHandlerSelectors.basePackage("cn.iocoder.mall.product.application.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package cn.iocoder.mall.product.controller.user;
|
||||
package cn.iocoder.mall.product.application.controller.users;
|
||||
|
||||
import cn.iocoder.mall.product.convert.ProductCategoryConvert;
|
||||
import cn.iocoder.mall.product.service.ProductCategoryService;
|
||||
import cn.iocoder.mall.product.vo.ProductCategoryVO;
|
||||
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 com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -19,16 +20,15 @@ import java.util.List;
|
||||
@Api("商品分类")
|
||||
public class ProductCategoryController {
|
||||
|
||||
@Autowired
|
||||
@Reference(validation = "true")
|
||||
private ProductCategoryService productCategoryService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("获得指定编号下的子分类的数组")
|
||||
@ApiImplicitParam(name = "pid", value = "指定分类编号", required = true, example = "0")
|
||||
public List<ProductCategoryVO> list(@RequestParam("pid") Integer pid) {
|
||||
return ProductCategoryConvert.INSTANCE.convertToVO(
|
||||
productCategoryService.getListByPid(pid)
|
||||
);
|
||||
List<ProductCategoryBO> result = productCategoryService.getListByPid(pid);
|
||||
return ProductCategoryConvert.INSTANCE.convertToVO(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package cn.iocoder.mall.product.controller.user;
|
||||
package cn.iocoder.mall.product.application.controller.users;
|
||||
|
||||
import cn.iocoder.mall.product.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.product.service.ProductSpuService;
|
||||
import cn.iocoder.mall.product.vo.ProductSpuListVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductSpuListVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("user/product/spu")
|
||||
public class ProductSpuController {
|
||||
|
||||
@Autowired
|
||||
@Reference(validation = "true")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
// TODO 详情
|
||||
@@ -1,8 +1,7 @@
|
||||
package cn.iocoder.mall.product.convert;
|
||||
package cn.iocoder.mall.product.application.convert;
|
||||
|
||||
import cn.iocoder.mall.product.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.dataobject.ProductCategoryDO;
|
||||
import cn.iocoder.mall.product.vo.ProductCategoryVO;
|
||||
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.application.vo.ProductCategoryVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
@@ -14,14 +13,10 @@ public interface ProductCategoryConvert {
|
||||
|
||||
ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
ProductCategoryBO convertToBO(ProductCategoryDO category);
|
||||
|
||||
List<ProductCategoryBO> convertToBO(List<ProductCategoryDO> categoryList);
|
||||
|
||||
@Mappings({})
|
||||
ProductCategoryVO convertToVO(ProductCategoryBO category);
|
||||
|
||||
List<ProductCategoryVO> convertToVO(List<ProductCategoryBO> categoryList);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.vo;
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.product.vo;
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package cn.iocoder.mall.product.application.vo;
|
||||
|
||||
public class ProductSpuVO {
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package cn.iocoder.mall.product.bo;
|
||||
|
||||
/**
|
||||
* 商品分类 BO
|
||||
*/
|
||||
public class ProductCategoryBO {
|
||||
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 父分类编号
|
||||
*
|
||||
* 如果不存在父级,则 pid = 0 。
|
||||
*/
|
||||
private Integer pid;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 分类图片
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.mall.product.bo;
|
||||
|
||||
public class ProductSkuBO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.mall.product.bo;
|
||||
|
||||
public class ProductSpuBO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package cn.iocoder.mall.product.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@Configuration
|
||||
@MapperScan("cn.iocoder.mall.product.dao") // 扫描对应的 Mapper 接口
|
||||
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600
|
||||
public class DatabaseConfiguration {
|
||||
|
||||
// 数据源,使用 HikariCP
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package cn.iocoder.mall.product.convert;
|
||||
|
||||
import cn.iocoder.mall.product.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.product.dataobject.ProductSpuDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ProductSpuConvert {
|
||||
|
||||
ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
ProductSpuBO convert(ProductSpuDO spu);
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package cn.iocoder.mall.product.dao;
|
||||
|
||||
import cn.iocoder.mall.product.dataobject.ProductCategoryDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ProductCategoryMapper {
|
||||
|
||||
List<ProductCategoryDO> selectListByPidAndStatusOrderBySort(@Param("pid") Integer pid,
|
||||
@Param("status") Integer status);
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package cn.iocoder.mall.product.dao;
|
||||
|
||||
import cn.iocoder.mall.product.dataobject.ProductSpuDO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ProductSpuMapper {
|
||||
|
||||
ProductSpuDO selectById(Integer id);
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Product 规格
|
||||
*/
|
||||
public class ProductAttrDO {
|
||||
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Product 规格值
|
||||
*/
|
||||
public class ProductAttrValueDO {
|
||||
|
||||
/**
|
||||
* 规格值编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 规格编号
|
||||
*/
|
||||
private Integer attrId;
|
||||
/**
|
||||
* 规格值
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
public class ProductCategoryDO {
|
||||
|
||||
public static final Integer STATUS_ENABLE = 1;
|
||||
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 父分类编号
|
||||
*
|
||||
* 如果不存在父级,则 pid = 0 。
|
||||
*/
|
||||
private Integer pid;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 分类图片
|
||||
*/
|
||||
private String picUrl;
|
||||
/**
|
||||
* 排序值
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(Integer pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品 SKU
|
||||
*/
|
||||
public class ProductSkuDO {
|
||||
|
||||
/**
|
||||
* sku 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
private Integer itemId;
|
||||
|
||||
// TODO 店铺编号
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String picURL;
|
||||
/**
|
||||
* 规格值({@link ProductAttrDO})数组
|
||||
*
|
||||
* 数组,以逗号分隔
|
||||
*/
|
||||
private String attrs;
|
||||
/**
|
||||
* 价格,单位分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 商品在付款减库存的状态下,该Sku上未付款的订单数量
|
||||
*/
|
||||
private Integer withHoldQuantity;
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
private Integer soldNum;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品 SPU
|
||||
*/
|
||||
public class ProductSpuDO {
|
||||
|
||||
// ========== 基础字段 =========
|
||||
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
// TODO 店铺编号
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
/**
|
||||
* SPU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* SPU 描述
|
||||
*/
|
||||
private String descrption;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 商品主图地址
|
||||
*
|
||||
* 数组,以逗号分隔
|
||||
*
|
||||
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
|
||||
*/
|
||||
private String picURLs;
|
||||
|
||||
// TODO 价格库存
|
||||
|
||||
// TODO 运费信息
|
||||
|
||||
// ========== 其他信息 =========
|
||||
/**
|
||||
* 是否上架商品(是否可见)。
|
||||
*
|
||||
* true 为已上架
|
||||
* false 为已下架
|
||||
*/
|
||||
private Boolean visible;
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
private Integer order;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Product 库存
|
||||
*/
|
||||
public class ProductStockDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* SKU 编号
|
||||
*/
|
||||
private Integer skuId;
|
||||
/**
|
||||
* 库存数
|
||||
*/
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 1-正常
|
||||
* 2-删除
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.mall.product.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.convert.ProductCategoryConvert;
|
||||
import cn.iocoder.mall.product.dao.ProductCategoryMapper;
|
||||
import cn.iocoder.mall.product.dataobject.ProductCategoryDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||
//@com.alibaba.dubbo.config.annotation.Service
|
||||
public class ProductCategoryService {
|
||||
|
||||
@Autowired
|
||||
private ProductCategoryMapper productCategoryMapper;
|
||||
|
||||
public List<ProductCategoryBO> getListByPid(Integer pid) {
|
||||
List<ProductCategoryDO> categoryList = productCategoryMapper.selectListByPidAndStatusOrderBySort(pid, ProductCategoryDO.STATUS_ENABLE);
|
||||
return ProductCategoryConvert.INSTANCE.convertToBO(categoryList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.mall.product.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.product.convert.ProductSpuConvert;
|
||||
import cn.iocoder.mall.product.dao.ProductSpuMapper;
|
||||
import cn.iocoder.mall.product.dataobject.ProductSpuDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||
@com.alibaba.dubbo.config.annotation.Service
|
||||
public class ProductSpuService implements cn.iocoder.mall.product.service.api.ProductSpuService {
|
||||
|
||||
@Autowired
|
||||
private ProductSpuMapper productSpuDAO;
|
||||
|
||||
public ProductSpuBO getProductSpu(Integer id) {
|
||||
ProductSpuDO productSpuDO = productSpuDAO.selectById(id);
|
||||
// 转换成 BO
|
||||
return ProductSpuConvert.INSTANCE.convert(productSpuDO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package cn.iocoder.mall.product.vo;
|
||||
|
||||
public class ProductSpuVO {
|
||||
}
|
||||
@@ -1,32 +1,9 @@
|
||||
spring:
|
||||
application:
|
||||
name: product-application
|
||||
# datasource
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:33061/mall_product?useSSL=false
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
# server
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
# mybatis
|
||||
mybatis:
|
||||
config-location: classpath:mybatis-config.xml
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: cn.iocoder.mall.product.dataobject
|
||||
|
||||
# dubbo
|
||||
dubbo:
|
||||
registry:
|
||||
address: zookeeper://127.0.0.1:2181
|
||||
protocol:
|
||||
port: -1
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.product.service
|
||||
demo:
|
||||
service:
|
||||
version: 1.0.0
|
||||
port: 18081
|
||||
servlet:
|
||||
context-path: /product-api/
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.iocoder.mall.product.dao.ProductCategoryMapper">
|
||||
|
||||
<select id="selectListByPidAndStatusOrderBySort" resultType="ProductCategoryDO">
|
||||
SELECT
|
||||
id, name, pic_url, sort
|
||||
FROM product_category
|
||||
WHERE pid = #{pid}
|
||||
AND status = #{status}
|
||||
ORDER BY sort ASC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.product.dao.ProductSpuMapper">
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="ProductSpuDO">
|
||||
SELECT
|
||||
id
|
||||
FROM product_spu
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<settings>
|
||||
<!-- 使用驼峰命名法转换字段。 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
</settings>
|
||||
|
||||
<typeAliases>
|
||||
<typeAlias alias="Integer" type="java.lang.Integer"/>
|
||||
<typeAlias alias="Long" type="java.lang.Long"/>
|
||||
<typeAlias alias="HashMap" type="java.util.HashMap"/>
|
||||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/>
|
||||
<typeAlias alias="ArrayList" type="java.util.ArrayList"/>
|
||||
<typeAlias alias="LinkedList" type="java.util.LinkedList"/>
|
||||
</typeAliases>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user