Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
f172d959
提交
f172d959
authored
3月 04, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
0b22c090
abf1f250
显示空白字符变更
内嵌
并排
正在显示
35 个修改的文件
包含
1267 行增加
和
81 行删除
+1267
-81
MVCConfiguration.java
...coder/mall/admin/application/config/MVCConfiguration.java
+2
-2
AdminsProductCategoryController.java
...on/controller/admins/AdminsProductCategoryController.java
+114
-3
AdminsProductSpuController.java
...ication/controller/admins/AdminsProductSpuController.java
+102
-0
ProductCategoryController.java
...plication/controller/users/ProductCategoryController.java
+2
-2
ProductCategoryConvert.java
...l/product/application/convert/ProductCategoryConvert.java
+10
-3
ProductSpuConvert.java
...r/mall/product/application/convert/ProductSpuConvert.java
+22
-0
ProductCategoryTreeNodeVO.java
...all/product/application/vo/ProductCategoryTreeNodeVO.java
+0
-11
ProductCategoryVO.java
...ocoder/mall/product/application/vo/ProductCategoryVO.java
+0
-4
AdminProductCategoryTreeNodeVO.java
...application/vo/admins/AdminProductCategoryTreeNodeVO.java
+113
-0
AdminsProductCategoryVO.java
...roduct/application/vo/admins/AdminsProductCategoryVO.java
+101
-0
AdminsProductSpuDetailVO.java
...oduct/application/vo/admins/AdminsProductSpuDetailVO.java
+10
-0
AdminsProductSpuPageVO.java
...product/application/vo/admins/AdminsProductSpuPageVO.java
+38
-0
AdminsProductSpuVO.java
...all/product/application/vo/admins/AdminsProductSpuVO.java
+11
-0
UsersProductCategoryVO.java
.../product/application/vo/users/UsersProductCategoryVO.java
+2
-2
ProductCategoryService.java
...a/cn/iocoder/mall/product/api/ProductCategoryService.java
+1
-1
ProductSpuService.java
...n/java/cn/iocoder/mall/product/api/ProductSpuService.java
+8
-0
ProductAttrBO.java
...in/java/cn/iocoder/mall/product/api/bo/ProductAttrBO.java
+62
-0
ProductCategoryBO.java
...ava/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java
+45
-0
ProductSkuDetailBO.java
...va/cn/iocoder/mall/product/api/bo/ProductSkuDetailBO.java
+46
-0
ProductSpuDetailBO.java
...va/cn/iocoder/mall/product/api/bo/ProductSpuDetailBO.java
+66
-0
ProductCategoryConstants.java
...r/mall/product/api/constant/ProductCategoryConstants.java
+1
-1
ProductCategoryAddDTO.java
...n/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java
+1
-1
ProductCategoryUpdateDTO.java
...ocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java
+1
-1
ProductSkuAddDTO.java
...ava/cn/iocoder/mall/product/api/dto/ProductSkuAddDTO.java
+51
-0
ProductSkuUpdateDTO.java
.../cn/iocoder/mall/product/api/dto/ProductSkuUpdateDTO.java
+51
-0
ProductSpuAddDTO.java
...ava/cn/iocoder/mall/product/api/dto/ProductSpuAddDTO.java
+121
-0
ProductSpuUpdateDTO.java
.../cn/iocoder/mall/product/api/dto/ProductSpuUpdateDTO.java
+135
-0
ServiceExceptionConfiguration.java
...er/mall/product/config/ServiceExceptionConfiguration.java
+27
-0
ProductCategoryDO.java
...cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
+1
-0
ProductSkuDO.java
...java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java
+16
-19
ProductSpuDO.java
...java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
+73
-24
ProductStockDO.java
...va/cn/iocoder/mall/product/dataobject/ProductStockDO.java
+1
-0
ProductCategoryServiceImpl.java
...oder/mall/product/service/ProductCategoryServiceImpl.java
+16
-5
ProductSpuServiceImpl.java
...n/iocoder/mall/product/service/ProductSpuServiceImpl.java
+15
-0
ProductCategoryMapper.xml
...-impl/src/main/resources/mapper/ProductCategoryMapper.xml
+2
-2
没有找到文件。
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java
浏览文件 @
f172d959
...
...
@@ -22,8 +22,8 @@ public class MVCConfiguration implements WebMvcConfigurer {
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
registry
.
addInterceptor
(
adminSecurityInterceptor
).
addPathPatterns
(
"/admin/**"
)
.
excludePathPatterns
(
"/admin/passport/login"
);
// 排除登陆接口
registry
.
addInterceptor
(
adminSecurityInterceptor
).
addPathPatterns
(
"/admin
s
/**"
)
.
excludePathPatterns
(
"/admin
s
/passport/login"
);
// 排除登陆接口
}
@Override
...
...
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
cn.iocoder.mall.product.api.ProductCategoryService
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.api.constant.ProductCategoryConstants
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductCategoryUpdateDTO
;
import
cn.iocoder.mall.product.application.convert.ProductCategoryConvert
;
import
cn.iocoder.mall.product.application.vo.admins.AdminProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"admins/
product/
category"
)
@RequestMapping
(
"admins/category"
)
@Api
(
"商品分类"
)
public
class
AdminsProductCategoryController
{
@Reference
(
validation
=
"true"
)
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/tree"
)
@ApiOperation
(
"获得分类树结构"
)
public
CommonResult
<
List
<
AdminProductCategoryTreeNodeVO
>>
tree
()
{
List
<
ProductCategoryBO
>
productCategories
=
productCategoryService
.
getAll
().
getData
();
// 创建 ProductCategoryTreeNodeVO Map
Map
<
Integer
,
AdminProductCategoryTreeNodeVO
>
treeNodeMap
=
productCategories
.
stream
().
collect
(
Collectors
.
toMap
(
ProductCategoryBO:
:
getId
,
ProductCategoryConvert
.
INSTANCE
::
convert
));
// 处理父子关系
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
!
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
forEach
((
childNode
)
->
{
// 获得父节点
AdminProductCategoryTreeNodeVO
parentNode
=
treeNodeMap
.
get
(
childNode
.
getPid
());
if
(
parentNode
.
getChildren
()
==
null
)
{
// 初始化 children 数组
parentNode
.
setChildren
(
new
ArrayList
<>());
}
// 将自己添加到父节点中
parentNode
.
getChildren
().
add
(
childNode
);
});
// 获得到所有的根节点
List
<
AdminProductCategoryTreeNodeVO
>
rootNodes
=
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
sorted
(
Comparator
.
comparing
(
AdminProductCategoryTreeNodeVO:
:
getSort
))
.
collect
(
Collectors
.
toList
());
return
CommonResult
.
success
(
rootNodes
);
}
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"创建商品分类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父级分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"分类名字(标识)"
,
required
=
true
,
example
=
"admin/info"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"描述"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"分类图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
AdminsProductCategoryVO
>
add
(
@RequestParam
(
"pid"
)
Integer
pid
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
value
=
"picUrl"
,
required
=
false
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
)
{
// 创建 ProductCategoryAddDTO 对象
ProductCategoryAddDTO
productCategoryAddDTO
=
new
ProductCategoryAddDTO
().
setPid
(
pid
).
setName
(
name
)
.
setDescription
(
description
).
setPicUrl
(
picUrl
).
setSort
(
sort
);
// 创建商品分类
CommonResult
<
ProductCategoryBO
>
result
=
productCategoryService
.
addProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productCategoryAddDTO
);
// 返回结果
return
ProductCategoryConvert
.
INSTANCE
.
convert
(
result
);
}
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新商品分类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父级分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"name"
,
value
=
"分类名字(标识)"
,
required
=
true
,
example
=
"admin/info"
),
@ApiImplicitParam
(
name
=
"description"
,
value
=
"描述"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"picUrl"
,
value
=
"分类图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg/"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"排序"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"pid"
)
Integer
pid
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
value
=
"picUrl"
,
required
=
false
)
String
picUrl
,
@RequestParam
(
"sort"
)
Integer
sort
)
{
// 创建 ProductCategoryUpdateDTO 对象
ProductCategoryUpdateDTO
productCategoryAddDTO
=
new
ProductCategoryUpdateDTO
().
setId
(
id
).
setPid
(
pid
).
setName
(
name
)
.
setDescription
(
description
).
setPicUrl
(
picUrl
).
setSort
(
sort
);
// 更新商品分类
return
productCategoryService
.
updateProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productCategoryAddDTO
);
}
@PostMapping
(
"/update_status"
)
@ApiOperation
(
value
=
"更新商品分类状态"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品分类编号"
,
required
=
true
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"status"
,
value
=
"状态。1 - 开启;2 - 禁用"
,
required
=
true
,
example
=
"1"
),
})
public
CommonResult
<
Boolean
>
updateStatus
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
return
productCategoryService
.
updateProductCategoryStatus
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
,
status
);
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除商品分类"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"商品分类编号"
,
required
=
true
,
example
=
"1"
)
public
CommonResult
<
Boolean
>
delete
(
@RequestParam
(
"id"
)
Integer
id
)
{
return
productCategoryService
.
deleteProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
);
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductSpuController.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
cn.iocoder.mall.product.api.ProductSpuService
;
import
cn.iocoder.mall.product.api.bo.ProductSpuDetailBO
;
import
cn.iocoder.mall.product.api.dto.ProductSkuAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductSkuUpdateDTO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO
;
import
cn.iocoder.mall.product.application.convert.ProductSpuConvert
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
@RestController
@RequestMapping
(
"admins"
)
@Api
(
"商品 SPU + SKU"
)
public
class
AdminsProductSpuController
{
@Reference
(
validation
=
"true"
)
private
ProductSpuService
productSpuService
;
@Autowired
private
ObjectMapper
objectMapper
;
// jackson 解析
@PostMapping
(
"/spu/add"
)
@ApiOperation
(
"创建商品"
)
public
CommonResult
<
AdminsProductSpuDetailVO
>
add
(
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"sellPoint"
)
String
sellPoint
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
"cid"
)
Integer
cid
,
@RequestParam
(
"picURLs"
)
List
<
String
>
picUrls
,
@RequestParam
(
"visible"
)
Boolean
visible
,
@RequestParam
(
"skuStr"
)
String
skuStr
)
{
// TODO 芋艿,因为考虑不使用 json 接受参数,所以这里手动转。
// 创建 ProductSpuAddDTO 对象
ProductSpuAddDTO
productSpuAddDTO
=
new
ProductSpuAddDTO
().
setName
(
name
).
setSellPoint
(
sellPoint
)
.
setDescription
(
description
).
setCid
(
cid
).
setPicUrls
(
picUrls
).
setVisible
(
visible
)
.
setSkus
(
parseSkus
(
skuStr
,
ProductSkuAddDTO
.
class
));
// 保存商品
CommonResult
<
ProductSpuDetailBO
>
result
=
productSpuService
.
addProductSpu
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productSpuAddDTO
);
// 返回结果
return
ProductSpuConvert
.
INSTANCE
.
convert
(
result
);
}
@PostMapping
(
"/spu/update"
)
@ApiOperation
(
"更新商品"
)
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"sellPoint"
)
String
sellPoint
,
@RequestParam
(
"description"
)
String
description
,
@RequestParam
(
"cid"
)
Integer
cid
,
@RequestParam
(
"picURLs"
)
List
<
String
>
picUrls
,
@RequestParam
(
"visible"
)
Boolean
visible
,
@RequestParam
(
"skuStr"
)
String
skuStr
)
{
// TODO 芋艿,因为考虑不使用 json 接受参数,所以这里手动转。
// 创建 ProductSpuUpdateDTO 对象
ProductSpuUpdateDTO
productSpuUpdateDTO
=
new
ProductSpuUpdateDTO
().
setId
(
id
).
setName
(
name
).
setSellPoint
(
sellPoint
)
.
setDescription
(
description
).
setCid
(
cid
).
setPicUrls
(
picUrls
).
setVisible
(
visible
)
.
setSkus
(
parseSkus
(
skuStr
,
ProductSkuUpdateDTO
.
class
));
// 更新商品
return
productSpuService
.
updateProductSpu
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productSpuUpdateDTO
);
}
@PostMapping
(
"/spu/update_sort"
)
@ApiOperation
(
"更新商品的排序"
)
public
CommonResult
<
Boolean
>
updateSort
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"sort"
)
Integer
sort
)
{
return
null
;
}
@GetMapping
(
"/spu/page"
)
@ApiOperation
(
"商品 SPU 分页列表"
)
public
CommonResult
<
AdminsProductSpuPageVO
>
spuPage
()
{
return
null
;
}
@GetMapping
(
"/spu/info"
)
@ApiOperation
(
"商品 SPU 明细"
)
public
CommonResult
<
AdminsProductSpuDetailVO
>
info
()
{
return
null
;
}
private
<
T
>
List
<
T
>
parseSkus
(
String
skuStr
,
Class
<
T
>
clazz
)
{
JavaType
type
=
objectMapper
.
getTypeFactory
().
constructParametricType
(
List
.
class
,
clazz
);
try
{
return
objectMapper
.
readValue
(
skuStr
,
type
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/ProductCategoryController.java
浏览文件 @
f172d959
...
...
@@ -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.
ProductCategorySimple
VO
;
import
cn.iocoder.mall.product.application.vo.
users.UsersProductCategory
VO
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -26,7 +26,7 @@ public class ProductCategoryController {
@GetMapping
@ApiOperation
(
"获得指定编号下的子分类的数组"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"指定分类编号"
,
required
=
true
,
example
=
"0"
)
public
List
<
ProductCategorySimple
VO
>
list
(
@RequestParam
(
"pid"
)
Integer
pid
)
{
public
List
<
UsersProductCategory
VO
>
list
(
@RequestParam
(
"pid"
)
Integer
pid
)
{
List
<
ProductCategoryBO
>
result
=
productCategoryService
.
getListByPid
(
pid
);
return
ProductCategoryConvert
.
INSTANCE
.
convertToVO
(
result
);
}
...
...
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.application.vo.ProductCategorySimpleVO
;
import
cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
...
...
@@ -14,9 +17,12 @@ public interface ProductCategoryConvert {
ProductCategoryConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductCategoryConvert
.
class
);
@Mappings
({})
ProductCategorySimple
VO
convertToVO
(
ProductCategoryBO
category
);
UsersProductCategory
VO
convertToVO
(
ProductCategoryBO
category
);
List
<
ProductCategorySimple
VO
>
convertToVO
(
List
<
ProductCategoryBO
>
categoryList
);
List
<
UsersProductCategory
VO
>
convertToVO
(
List
<
ProductCategoryBO
>
categoryList
);
AdminProductCategoryTreeNodeVO
convert
(
ProductCategoryBO
category
);
CommonResult
<
AdminsProductCategoryVO
>
convert
(
CommonResult
<
ProductCategoryBO
>
result
);
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.bo.ProductSpuDetailBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductSpuConvert
{
ProductSpuConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductSpuConvert
.
class
);
@Mappings
({})
AdminsProductSpuDetailVO
convert
(
ProductSpuDetailBO
productSpuDetailBO
);
@Mappings
({})
CommonResult
<
AdminsProductSpuDetailVO
>
convert
(
CommonResult
<
ProductSpuDetailBO
>
result
);
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/ProductCategoryTreeNodeVO.java
deleted
100644 → 0
浏览文件 @
0b22c090
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
;
import
io.swagger.annotations.ApiModel
;
@ApiModel
(
"产品分类树节点 VO"
)
public
class
ProductCategoryTreeNodeVO
{
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/ProductCategoryVO.java
deleted
100644 → 0
浏览文件 @
0b22c090
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
;
public
class
ProductCategoryVO
{
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminProductCategoryTreeNodeVO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
import
java.util.List
;
@ApiModel
(
"产品分类树节点 VO"
)
public
class
AdminProductCategoryTreeNodeVO
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"子节点数组"
)
private
List
<
AdminProductCategoryTreeNodeVO
>
children
;
public
Integer
getId
()
{
return
id
;
}
public
AdminProductCategoryTreeNodeVO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
Integer
getPid
()
{
return
pid
;
}
public
AdminProductCategoryTreeNodeVO
setPid
(
Integer
pid
)
{
this
.
pid
=
pid
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
AdminProductCategoryTreeNodeVO
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
AdminProductCategoryTreeNodeVO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
String
getPicUrl
()
{
return
picUrl
;
}
public
AdminProductCategoryTreeNodeVO
setPicUrl
(
String
picUrl
)
{
this
.
picUrl
=
picUrl
;
return
this
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
AdminProductCategoryTreeNodeVO
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
AdminProductCategoryTreeNodeVO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
AdminProductCategoryTreeNodeVO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
public
List
<
AdminProductCategoryTreeNodeVO
>
getChildren
()
{
return
children
;
}
public
AdminProductCategoryTreeNodeVO
setChildren
(
List
<
AdminProductCategoryTreeNodeVO
>
children
)
{
this
.
children
=
children
;
return
this
;
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductCategoryVO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.Date
;
@ApiModel
(
"产品分类 VO"
)
public
class
AdminsProductCategoryVO
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"父分类编号"
,
required
=
true
,
example
=
"0"
)
private
Integer
pid
;
@ApiModelProperty
(
value
=
"分类名"
,
required
=
true
,
example
=
"手机"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
,
required
=
true
,
example
=
"这个商品很吊"
)
private
String
description
;
@ApiModelProperty
(
value
=
"分类图片"
,
notes
=
"一般情况下,只有根分类才有图片"
,
example
=
"http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg"
)
private
String
picUrl
;
@ApiModelProperty
(
value
=
"排序值"
,
required
=
true
,
example
=
"10"
)
private
Integer
sort
;
@ApiModelProperty
(
value
=
"状态"
,
required
=
true
,
notes
=
"1-开启;2-关闭"
,
example
=
"1"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
true
,
example
=
"时间戳"
)
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
AdminsProductCategoryVO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
public
Integer
getPid
()
{
return
pid
;
}
public
AdminsProductCategoryVO
setPid
(
Integer
pid
)
{
this
.
pid
=
pid
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
AdminsProductCategoryVO
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
AdminsProductCategoryVO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
String
getPicUrl
()
{
return
picUrl
;
}
public
AdminsProductCategoryVO
setPicUrl
(
String
picUrl
)
{
this
.
picUrl
=
picUrl
;
return
this
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
AdminsProductCategoryVO
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
AdminsProductCategoryVO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
AdminsProductCategoryVO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductSpuDetailVO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
@ApiModel
(
value
=
"商品 SPU 详细 VO"
,
description
=
"包括 SKU 信息 VO"
)
public
class
AdminsProductSpuDetailVO
{
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductSpuPageVO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
import
java.util.List
;
@ApiModel
(
"商品 SPU 分页 VO"
)
public
class
AdminsProductSpuPageVO
{
/**
* spu 数组
*/
private
List
<
AdminsProductSpuVO
>
spus
;
/**
* 总数
*/
private
Integer
count
;
public
List
<
AdminsProductSpuVO
>
getSpus
()
{
return
spus
;
}
public
AdminsProductSpuPageVO
setSpus
(
List
<
AdminsProductSpuVO
>
spus
)
{
this
.
spus
=
spus
;
return
this
;
}
public
Integer
getCount
()
{
return
count
;
}
public
AdminsProductSpuPageVO
setCount
(
Integer
count
)
{
this
.
count
=
count
;
return
this
;
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/admins/AdminsProductSpuVO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
admins
;
import
io.swagger.annotations.ApiModel
;
@ApiModel
(
value
=
"商品 SPU VO"
,
description
=
"不包括 SKU 信息 VO"
)
public
class
AdminsProductSpuVO
{
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/
ProductCategorySimple
VO.java
→
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/
users/UsersProductCategory
VO.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
;
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
users
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
(
"商品分类(简单)"
)
public
class
ProductCategorySimple
VO
{
public
class
UsersProductCategory
VO
{
@ApiModelProperty
(
value
=
"分类编号"
,
required
=
true
,
example
=
"1"
)
private
Integer
id
;
...
...
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductCategoryService.java
浏览文件 @
f172d959
...
...
@@ -18,7 +18,7 @@ public interface ProductCategoryService {
/**
* @return 返回所有产品分类们
*/
List
<
ProductCategoryBO
>
getAll
();
CommonResult
<
List
<
ProductCategoryBO
>
>
getAll
();
CommonResult
<
ProductCategoryBO
>
addProductCategory
(
Integer
adminId
,
ProductCategoryAddDTO
productCategoryAddDTO
);
...
...
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/ProductSpuService.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.api.bo.ProductSpuDetailBO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO
;
public
interface
ProductSpuService
{
ProductSpuBO
getProductSpu
(
Integer
id
);
CommonResult
<
ProductSpuDetailBO
>
addProductSpu
(
Integer
adminId
,
ProductSpuAddDTO
productSpuAddDTO
);
CommonResult
<
Boolean
>
updateProductSpu
(
Integer
adminId
,
ProductSpuUpdateDTO
productSpuUpdateDTO
);
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductAttrBO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
/**
* 商品规格 BO
*/
public
class
ProductAttrBO
{
/**
* 规格编号
*/
private
Integer
attrId
;
/**
* 规格名
*/
private
String
attrName
;
/**
* 规格值
*/
private
Integer
attrValueId
;
/**
* 规格值名
*/
private
String
attrValueName
;
public
Integer
getAttrId
()
{
return
attrId
;
}
public
ProductAttrBO
setAttrId
(
Integer
attrId
)
{
this
.
attrId
=
attrId
;
return
this
;
}
public
String
getAttrName
()
{
return
attrName
;
}
public
ProductAttrBO
setAttrName
(
String
attrName
)
{
this
.
attrName
=
attrName
;
return
this
;
}
public
Integer
getAttrValueId
()
{
return
attrValueId
;
}
public
ProductAttrBO
setAttrValueId
(
Integer
attrValueId
)
{
this
.
attrValueId
=
attrValueId
;
return
this
;
}
public
String
getAttrValueName
()
{
return
attrValueName
;
}
public
ProductAttrBO
setAttrValueName
(
String
attrValueName
)
{
this
.
attrValueName
=
attrValueName
;
return
this
;
}
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductCategoryBO.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
import
java.util.Date
;
/**
* 商品分类 BO
*/
...
...
@@ -19,6 +21,10 @@ public class ProductCategoryBO {
* 名称
*/
private
String
name
;
/**
* 描述
*/
private
String
description
;
/**
* 分类图片
*/
...
...
@@ -27,6 +33,17 @@ public class ProductCategoryBO {
* 排序值
*/
private
Integer
sort
;
/**
* 状态
*
* 1-开启
* 2-关闭
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
...
...
@@ -67,4 +84,32 @@ public class ProductCategoryBO {
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
public
String
getDescription
()
{
return
description
;
}
public
ProductCategoryBO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
ProductCategoryBO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
ProductCategoryBO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
}
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductSkuDetailBO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
import
java.util.List
;
/**
* 商品 Sku 明细 BO
*/
public
class
ProductSkuDetailBO
{
/**
* sku 编号
*/
private
Integer
id
;
/**
* 商品编号
*/
private
Integer
itemId
;
// TODO 店铺编号
/**
* 状态
*
* 1-正常
* 2-禁用
*/
private
Integer
status
;
/**
* 图片地址
*/
private
String
picURL
;
/**
* 规格值数组
*/
private
List
<
ProductAttrBO
>
attrs
;
/**
* 价格,单位:分
*/
private
Integer
price
;
/**
* 库存数量
*/
private
Integer
quantity
;
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/bo/ProductSpuDetailBO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
bo
;
import
cn.iocoder.mall.product.api.dto.ProductSkuAddDTO
;
import
java.util.List
;
/**
* 商品 Spu 明细 BO(包括 Sku 明细)
*/
public
class
ProductSpuDetailBO
{
/**
* SPU 编号
*/
private
Integer
id
;
// ========== 基本信息 =========
/**
* SPU 名字
*/
private
String
name
;
/**
* 卖点
*/
private
String
sellPoint
;
/**
* 描述
*/
private
String
description
;
/**
* 分类编号
*/
private
Integer
cid
;
/**
* 商品主图地址
*
* 数组,以逗号分隔
*
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
*/
private
List
<
String
>
picUrls
;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
private
Boolean
visible
;
/**
* 排序字段
*/
private
Integer
order
;
//
// ========== SKU =========
/**
* SKU 数组
*/
private
List
<
ProductSkuAddDTO
>
skus
;
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/constant/ProductCategoryConstants.java
浏览文件 @
f172d959
...
...
@@ -9,7 +9,7 @@ public class ProductCategoryConstants {
/**
* 状态 - 关闭
*/
public
static
final
Integer
STATUS_DISABLE
=
1
;
public
static
final
Integer
STATUS_DISABLE
=
2
;
/**
* 父分类编号 - 根节点
...
...
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryAddDTO.java
浏览文件 @
f172d959
...
...
@@ -25,7 +25,7 @@ public class ProductCategoryAddDTO {
/**
* 分类图片
*/
@NotNull
(
message
=
"分类图片不能为空"
)
//
@NotNull(message = "分类图片不能为空")
private
String
picUrl
;
/**
* 排序值
...
...
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductCategoryUpdateDTO.java
浏览文件 @
f172d959
...
...
@@ -30,7 +30,7 @@ public class ProductCategoryUpdateDTO {
/**
* 分类图片
*/
@NotNull
(
message
=
"分类图片不能为空"
)
//
@NotNull(message = "分类图片不能为空")
private
String
picUrl
;
/**
* 排序值
...
...
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductSkuAddDTO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
java.util.List
;
/**
* 商品 Sku 添加 DTO
*/
public
class
ProductSkuAddDTO
{
/**
* 规格值数组
*/
private
List
<
Integer
>
attrs
;
/**
* 价格,单位:分
*/
private
Integer
price
;
/**
* 库存数量
*/
private
Integer
quantity
;
public
List
<
Integer
>
getAttrs
()
{
return
attrs
;
}
public
ProductSkuAddDTO
setAttrs
(
List
<
Integer
>
attrs
)
{
this
.
attrs
=
attrs
;
return
this
;
}
public
Integer
getPrice
()
{
return
price
;
}
public
ProductSkuAddDTO
setPrice
(
Integer
price
)
{
this
.
price
=
price
;
return
this
;
}
public
Integer
getQuantity
()
{
return
quantity
;
}
public
ProductSkuAddDTO
setQuantity
(
Integer
quantity
)
{
this
.
quantity
=
quantity
;
return
this
;
}
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductSkuUpdateDTO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
java.util.List
;
/**
* 商品 Sku 更新 DTO
*/
public
class
ProductSkuUpdateDTO
{
/**
* 规格值数组
*/
private
List
<
Integer
>
attrs
;
/**
* 价格,单位:分
*/
private
Integer
price
;
/**
* 库存数量
*/
private
Integer
quantity
;
public
List
<
Integer
>
getAttrs
()
{
return
attrs
;
}
public
ProductSkuUpdateDTO
setAttrs
(
List
<
Integer
>
attrs
)
{
this
.
attrs
=
attrs
;
return
this
;
}
public
Integer
getPrice
()
{
return
price
;
}
public
ProductSkuUpdateDTO
setPrice
(
Integer
price
)
{
this
.
price
=
price
;
return
this
;
}
public
Integer
getQuantity
()
{
return
quantity
;
}
public
ProductSkuUpdateDTO
setQuantity
(
Integer
quantity
)
{
this
.
quantity
=
quantity
;
return
this
;
}
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductSpuAddDTO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/**
* 商品 SPU + SKU 添加 DTO
*/
public
class
ProductSpuAddDTO
{
// ========== 基本信息 =========
/**
* SPU 名字
*/
@NotEmpty
(
message
=
"SPU 名字不能为空"
)
private
String
name
;
/**
* 卖点
*/
@NotEmpty
(
message
=
"卖点不能为空"
)
private
String
sellPoint
;
/**
* 描述
*/
@NotEmpty
(
message
=
"描述不能为空"
)
private
String
description
;
/**
* 分类编号
*/
@NotEmpty
(
message
=
"分类不能为空"
)
private
Integer
cid
;
/**
* 商品主图地址
*/
@NotNull
(
message
=
"商品主图不能为空"
)
private
List
<
String
>
picUrls
;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
@NotNull
(
message
=
"是否上架不能为空"
)
private
Boolean
visible
;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull
(
message
=
"SKU 不能为空"
)
private
List
<
ProductSkuAddDTO
>
skus
;
public
String
getName
()
{
return
name
;
}
public
ProductSpuAddDTO
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getSellPoint
()
{
return
sellPoint
;
}
public
ProductSpuAddDTO
setSellPoint
(
String
sellPoint
)
{
this
.
sellPoint
=
sellPoint
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
ProductSpuAddDTO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getCid
()
{
return
cid
;
}
public
ProductSpuAddDTO
setCid
(
Integer
cid
)
{
this
.
cid
=
cid
;
return
this
;
}
public
List
<
String
>
getPicUrls
()
{
return
picUrls
;
}
public
ProductSpuAddDTO
setPicUrls
(
List
<
String
>
picUrls
)
{
this
.
picUrls
=
picUrls
;
return
this
;
}
public
Boolean
getVisible
()
{
return
visible
;
}
public
ProductSpuAddDTO
setVisible
(
Boolean
visible
)
{
this
.
visible
=
visible
;
return
this
;
}
public
List
<
ProductSkuAddDTO
>
getSkus
()
{
return
skus
;
}
public
ProductSpuAddDTO
setSkus
(
List
<
ProductSkuAddDTO
>
skus
)
{
this
.
skus
=
skus
;
return
this
;
}
}
\ No newline at end of file
product/product-service-api/src/main/java/cn/iocoder/mall/product/api/dto/ProductSpuUpdateDTO.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
api
.
dto
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/**
* 商品 SPU + SKU 更新 DTO
*/
public
class
ProductSpuUpdateDTO
{
/**
* Spu 编号
*/
@NotNull
(
message
=
"SPU 编号不能为空"
)
private
Integer
id
;
// ========== 基本信息 =========
/**
* SPU 名字
*/
@NotEmpty
(
message
=
"SPU 名字不能为空"
)
private
String
name
;
/**
* 卖点
*/
@NotEmpty
(
message
=
"卖点不能为空"
)
private
String
sellPoint
;
/**
* 描述
*/
@NotEmpty
(
message
=
"描述不能为空"
)
private
String
description
;
/**
* 分类编号
*/
@NotEmpty
(
message
=
"分类不能为空"
)
private
Integer
cid
;
/**
* 商品主图地址
*/
@NotNull
(
message
=
"商品主图不能为空"
)
private
List
<
String
>
picUrls
;
// ========== 其他信息 =========
/**
* 是否上架商品(是否可见)。
*
* true 为已上架
* false 为已下架
*/
@NotNull
(
message
=
"是否上架不能为空"
)
private
Boolean
visible
;
// ========== SKU =========
/**
* SKU 数组
*/
@NotNull
(
message
=
"SKU 不能为空"
)
private
List
<
ProductSkuUpdateDTO
>
skus
;
public
String
getName
()
{
return
name
;
}
public
ProductSpuUpdateDTO
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getSellPoint
()
{
return
sellPoint
;
}
public
ProductSpuUpdateDTO
setSellPoint
(
String
sellPoint
)
{
this
.
sellPoint
=
sellPoint
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
ProductSpuUpdateDTO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getCid
()
{
return
cid
;
}
public
ProductSpuUpdateDTO
setCid
(
Integer
cid
)
{
this
.
cid
=
cid
;
return
this
;
}
public
List
<
String
>
getPicUrls
()
{
return
picUrls
;
}
public
ProductSpuUpdateDTO
setPicUrls
(
List
<
String
>
picUrls
)
{
this
.
picUrls
=
picUrls
;
return
this
;
}
public
Boolean
getVisible
()
{
return
visible
;
}
public
ProductSpuUpdateDTO
setVisible
(
Boolean
visible
)
{
this
.
visible
=
visible
;
return
this
;
}
public
List
<
ProductSkuUpdateDTO
>
getSkus
()
{
return
skus
;
}
public
ProductSpuUpdateDTO
setSkus
(
List
<
ProductSkuUpdateDTO
>
skus
)
{
this
.
skus
=
skus
;
return
this
;
}
public
Integer
getId
()
{
return
id
;
}
public
ProductSpuUpdateDTO
setId
(
Integer
id
)
{
this
.
id
=
id
;
return
this
;
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/config/ServiceExceptionConfiguration.java
0 → 100644
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
config
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.EventListener
;
@Configuration
public
class
ServiceExceptionConfiguration
{
@EventListener
(
ApplicationReadyEvent
.
class
)
// 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html
public
void
initMessages
()
{
// 从 service_exception_message.properties 加载错误码的方案
// Properties properties;
// try {
// properties = PropertiesLoaderUtils.loadAllProperties("classpath:service_exception_message.properties");
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
for
(
ProductErrorCodeEnum
item
:
ProductErrorCodeEnum
.
values
())
{
ServiceExceptionUtil
.
put
(
item
.
getCode
(),
item
.
getMessage
());
}
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductCategoryDO.java
浏览文件 @
f172d959
...
...
@@ -7,6 +7,7 @@ import cn.iocoder.common.framework.dataobject.BaseDO;
*/
public
class
ProductCategoryDO
extends
BaseDO
{
@Deprecated
public
static
final
Integer
STATUS_ENABLE
=
1
;
/**
...
...
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSkuDO.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
dataobject
;
import
java.util.Date
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
/**
* 商品 SKU
*/
public
class
ProductSkuDO
{
public
class
ProductSkuDO
extends
BaseDO
{
/**
* sku 编号
...
...
@@ -22,7 +22,7 @@ public class ProductSkuDO {
* 状态
*
* 1-正常
* 2-
删除
* 2-
禁用
*/
private
Integer
status
;
/**
...
...
@@ -36,24 +36,20 @@ public class ProductSkuDO {
*/
private
String
attrs
;
/**
* 价格,单位分
* 价格,单位
:
分
*/
private
Integer
price
;
/**
* 商品在付款减库存的状态下,该Sku上未付款的订单数量
*/
private
Integer
withHoldQuantity
;
/**
* 销量
*/
private
Integer
soldNum
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
* 库存数量
*/
private
Integer
quantity
;
// /**
// * 商品在付款减库存的状态下,该Sku上未付款的订单数量
// */
// private Integer withHoldQuantity;
// /**
// * 销量
// */
// private Integer soldNum;
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductSpuDO.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
dataobject
;
import
java.util.Date
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
/**
* 商品 SPU
*/
public
class
ProductSpuDO
{
// ========== 基础字段 =========
public
class
ProductSpuDO
extends
BaseDO
{
/**
* SPU 编号
*/
private
Integer
id
;
// TODO 店铺编号
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 最后更新时间
*/
private
Date
updateTime
;
/**
* 状态
*
* 1-正常
* 2-删除
*/
private
Integer
status
;
// TODO 店铺编号 先不考虑,因为第一个版本,不做 B2B2C
// ========== 基本信息 =========
/**
...
...
@@ -38,9 +20,13 @@ public class ProductSpuDO {
*/
private
String
name
;
/**
*
SPU 描述
*
卖点
*/
private
String
descrption
;
private
String
sellPoint
;
/**
* 描述
*/
private
String
description
;
/**
* 分类编号
*/
...
...
@@ -52,7 +38,7 @@ public class ProductSpuDO {
*
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
*/
private
String
picU
RL
s
;
private
String
picU
rl
s
;
// TODO 价格库存
...
...
@@ -79,4 +65,66 @@ public class ProductSpuDO {
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
ProductSpuDO
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getSellPoint
()
{
return
sellPoint
;
}
public
ProductSpuDO
setSellPoint
(
String
sellPoint
)
{
this
.
sellPoint
=
sellPoint
;
return
this
;
}
public
String
getDescription
()
{
return
description
;
}
public
ProductSpuDO
setDescription
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
public
Integer
getCid
()
{
return
cid
;
}
public
ProductSpuDO
setCid
(
Integer
cid
)
{
this
.
cid
=
cid
;
return
this
;
}
public
String
getPicUrls
()
{
return
picUrls
;
}
public
ProductSpuDO
setPicUrls
(
String
picUrls
)
{
this
.
picUrls
=
picUrls
;
return
this
;
}
public
Boolean
getVisible
()
{
return
visible
;
}
public
ProductSpuDO
setVisible
(
Boolean
visible
)
{
this
.
visible
=
visible
;
return
this
;
}
public
Integer
getOrder
()
{
return
order
;
}
public
ProductSpuDO
setOrder
(
Integer
order
)
{
this
.
order
=
order
;
return
this
;
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java
浏览文件 @
f172d959
...
...
@@ -5,6 +5,7 @@ import java.util.Date;
/**
* Product 库存
*/
@Deprecated
// TODO 芋艿,咱暂时不加库存表和库存服务
public
class
ProductStockDO
{
/**
...
...
product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
service
;
import
cn.iocoder.common.framework.constant.SysErrorCodeEnum
;
import
cn.iocoder.common.framework.dataobject.BaseDO
;
import
cn.iocoder.common.framework.util.ServiceExceptionUtil
;
import
cn.iocoder.common.framework.vo.CommonResult
;
...
...
@@ -32,15 +33,15 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
}
@Override
public
List
<
ProductCategoryBO
>
getAll
()
{
public
CommonResult
<
List
<
ProductCategoryBO
>
>
getAll
()
{
List
<
ProductCategoryDO
>
categoryList
=
productCategoryMapper
.
selectList
();
return
ProductCategoryConvert
.
INSTANCE
.
convertToBO
(
categoryList
);
return
CommonResult
.
success
(
ProductCategoryConvert
.
INSTANCE
.
convertToBO
(
categoryList
)
);
}
@Override
public
CommonResult
<
ProductCategoryBO
>
addProductCategory
(
Integer
adminId
,
ProductCategoryAddDTO
productCategoryAddDTO
)
{
// 校验父分类是否存在
if
(
ProductCategoryConstants
.
PID_ROOT
.
equals
(
productCategoryAddDTO
.
getPid
())
if
(
!
ProductCategoryConstants
.
PID_ROOT
.
equals
(
productCategoryAddDTO
.
getPid
())
&&
productCategoryMapper
.
selectById
(
productCategoryAddDTO
.
getPid
())
==
null
)
{
return
ServiceExceptionUtil
.
error
(
ProductErrorCodeEnum
.
PRODUCT_CATEGORY_PARENT_NOT_EXISTS
.
getCode
());
}
...
...
@@ -65,7 +66,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
return
ServiceExceptionUtil
.
error
(
ProductErrorCodeEnum
.
PRODUCT_CATEGORY_PARENT_NOT_SELF
.
getCode
());
}
// 校验父分类是否存在
if
(
ProductCategoryConstants
.
PID_ROOT
.
equals
(
productCategoryUpdateDTO
.
getPid
())
if
(
!
ProductCategoryConstants
.
PID_ROOT
.
equals
(
productCategoryUpdateDTO
.
getPid
())
&&
productCategoryMapper
.
selectById
(
productCategoryUpdateDTO
.
getPid
())
==
null
)
{
return
ServiceExceptionUtil
.
error
(
ProductErrorCodeEnum
.
PRODUCT_CATEGORY_PARENT_NOT_EXISTS
.
getCode
());
}
...
...
@@ -78,6 +79,10 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
@Override
public
CommonResult
<
Boolean
>
updateProductCategoryStatus
(
Integer
adminId
,
Integer
productCategoryId
,
Integer
status
)
{
// 校验参数
if
(!
isValidStatus
(
status
))
{
return
CommonResult
.
error
(
SysErrorCodeEnum
.
VALIDATION_REQUEST_PARAM_ERROR
.
getCode
(),
"变更状态必须是开启(1)或关闭(2)"
);
// TODO 有点搓
}
// 校验分类是否存在
ProductCategoryDO
productCategory
=
productCategoryMapper
.
selectById
(
productCategoryId
);
if
(
productCategory
==
null
)
{
...
...
@@ -107,11 +112,16 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
}
// TODO 芋艿:考虑下,是否需要判断下该分类下是否有商品
// 标记删除商品分类
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
();
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
()
.
setId
(
productCategoryId
)
;
updateProductCategory
.
setDeleted
(
BaseDO
.
DELETED_YES
);
productCategoryMapper
.
update
(
updateProductCategory
);
// TODO 操作日志
return
CommonResult
.
success
(
true
);
}
private
boolean
isValidStatus
(
Integer
status
)
{
return
ProductCategoryConstants
.
STATUS_ENABLE
.
equals
(
status
)
||
ProductCategoryConstants
.
STATUS_DISABLE
.
equals
(
status
);
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java
浏览文件 @
f172d959
package
cn
.
iocoder
.
mall
.
product
.
service
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.product.api.ProductSpuService
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.api.bo.ProductSpuDetailBO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuAddDTO
;
import
cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO
;
import
cn.iocoder.mall.product.convert.ProductSpuConvert
;
import
cn.iocoder.mall.product.dao.ProductSpuMapper
;
import
cn.iocoder.mall.product.dataobject.ProductSpuDO
;
...
...
@@ -22,4 +26,14 @@ public class ProductSpuServiceImpl implements ProductSpuService {
return
ProductSpuConvert
.
INSTANCE
.
convert
(
productSpuDO
);
}
@Override
public
CommonResult
<
ProductSpuDetailBO
>
addProductSpu
(
Integer
adminId
,
ProductSpuAddDTO
productSpuAddDTO
)
{
return
null
;
}
@Override
public
CommonResult
<
Boolean
>
updateProductSpu
(
Integer
adminId
,
ProductSpuUpdateDTO
productSpuUpdateDTO
)
{
return
null
;
}
}
\ No newline at end of file
product/product-service-impl/src/main/resources/mapper/ProductCategoryMapper.xml
浏览文件 @
f172d959
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"cn.iocoder.mall.product.dao.ProductCategoryMapper"
>
<sql
id=
"FIELDS"
>
id, pid, name, descrption, pic_url,
id, pid, name, descr
i
ption, pic_url,
sort, status, create_time
</sql>
...
...
@@ -43,7 +43,7 @@
</insert>
<update
id=
"update"
parameterType=
"ProductCategoryDO"
>
UPDATE
resource
UPDATE
product_category
<set>
<if
test=
"pid != null"
>
pid = #{pid},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论