Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
a4ca7508
提交
a4ca7508
authored
12月 14, 2022
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mall:迁移 product category 模块
上级
954979b5
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
0 行增加
和
340 行删除
+0
-340
AdminsProductCategoryController.java
...on/controller/admins/AdminsProductCategoryController.java
+0
-126
UsersProductCategoryController.java
...tion/controller/users/UsersProductCategoryController.java
+0
-37
UsersProductSpuController.java
...plication/controller/users/UsersProductSpuController.java
+0
-20
ProductAttrConvert.java
.../mall/product/application/convert/ProductAttrConvert.java
+0
-34
ProductBrandConvert.java
...mall/product/application/convert/ProductBrandConvert.java
+0
-22
ProductCategoryConvert.java
...l/product/application/convert/ProductCategoryConvert.java
+0
-41
ProductSpuConvert.java
...r/mall/product/application/convert/ProductSpuConvert.java
+0
-40
UsersProductCategoryVO.java
.../product/application/vo/users/UsersProductCategoryVO.java
+0
-20
没有找到文件。
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/admins/AdminsProductCategoryController.java
deleted
100644 → 0
浏览文件 @
954979b5
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.AdminsProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
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
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"admins/category"
)
@Api
(
"商品分类"
)
public
class
AdminsProductCategoryController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductCategoryService.version}"
)
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/tree"
)
@ApiOperation
(
"获得分类树结构"
)
public
CommonResult
<
List
<
AdminsProductCategoryTreeNodeVO
>>
tree
()
{
List
<
ProductCategoryBO
>
productCategories
=
productCategoryService
.
getAll
();
// 创建 ProductCategoryTreeNodeVO Map
Map
<
Integer
,
AdminsProductCategoryTreeNodeVO
>
treeNodeMap
=
productCategories
.
stream
().
collect
(
Collectors
.
toMap
(
ProductCategoryBO:
:
getId
,
ProductCategoryConvert
.
Admins
.
INSTANCE
::
convert
));
// 处理父子关系
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
!
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
forEach
((
childNode
)
->
{
// 获得父节点
AdminsProductCategoryTreeNodeVO
parentNode
=
treeNodeMap
.
get
(
childNode
.
getPid
());
if
(
parentNode
.
getChildren
()
==
null
)
{
// 初始化 children 数组
parentNode
.
setChildren
(
new
ArrayList
<>());
}
// 将自己添加到父节点中
parentNode
.
getChildren
().
add
(
childNode
);
});
// 获得到所有的根节点
List
<
AdminsProductCategoryTreeNodeVO
>
rootNodes
=
treeNodeMap
.
values
().
stream
()
.
filter
(
node
->
node
.
getPid
().
equals
(
ProductCategoryConstants
.
PID_ROOT
))
.
sorted
(
Comparator
.
comparing
(
AdminsProductCategoryTreeNodeVO:
:
getSort
))
.
collect
(
Collectors
.
toList
());
return
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
);
// 创建商品分类
ProductCategoryBO
result
=
productCategoryService
.
addProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
productCategoryAddDTO
);
// 返回结果
return
success
(
ProductCategoryConvert
.
Admins
.
INSTANCE
.
convert2
(
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
success
(
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
success
(
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
success
(
productCategoryService
.
deleteProductCategory
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
id
));
}
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductCategoryController.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
controller
.
users
;
import
cn.iocoder.common.framework.vo.CommonResult
;
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.users.UsersProductCategoryVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.dubbo.config.annotation.Reference
;
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
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"users/category"
)
@Api
(
"商品分类"
)
public
class
UsersProductCategoryController
{
@Reference
(
validation
=
"true"
,
version
=
"${dubbo.provider.ProductCategoryService.version}"
)
@Autowired
private
ProductCategoryService
productCategoryService
;
@GetMapping
(
"/list"
)
@ApiOperation
(
"获得指定编号下的子分类的数组"
)
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"指定分类编号"
,
required
=
true
,
example
=
"0"
)
public
CommonResult
<
List
<
UsersProductCategoryVO
>>
list
(
@RequestParam
(
"pid"
)
Integer
pid
)
{
List
<
ProductCategoryBO
>
result
=
productCategoryService
.
getListByPid
(
pid
);
return
CommonResult
.
success
(
ProductCategoryConvert
.
Users
.
INSTANCE
.
convertToVO
(
result
));
}
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/controller/users/UsersProductSpuController.java
浏览文件 @
a4ca7508
...
@@ -34,24 +34,4 @@ public class UsersProductSpuController {
...
@@ -34,24 +34,4 @@ public class UsersProductSpuController {
return
success
(
ProductSpuConvert
.
INSTANCE
.
convert4
(
productSpuService
.
getProductSpuDetail
(
id
)));
return
success
(
ProductSpuConvert
.
INSTANCE
.
convert4
(
productSpuService
.
getProductSpuDetail
(
id
)));
}
}
@GetMapping
(
"/page"
)
@ApiOperation
(
"商品 SPU 分页列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"cid"
,
value
=
"分类编号"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageNo"
,
value
=
"页码,从 1 开始"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"每页条数"
,
required
=
true
,
example
=
"10"
),
})
@Deprecated
// 使用商品搜索接口
public
CommonResult
<
UsersProductSpuPageVO
>
page
(
@RequestParam
(
value
=
"cid"
,
required
=
false
)
Integer
cid
,
@RequestParam
(
value
=
"pageNo"
,
defaultValue
=
"0"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
)
{
// 创建 ProductSpuPageDTO 对象
ProductSpuPageDTO
productSpuPageDTO
=
new
ProductSpuPageDTO
().
setCid
(
cid
).
setVisible
(
true
)
.
setPageNo
(
pageNo
).
setPageSize
(
pageSize
);
// 查询分页
ProductSpuPageBO
result
=
productSpuService
.
getProductSpuPage
(
productSpuPageDTO
);
// 返回结果
return
success
(
ProductSpuConvert
.
INSTANCE
.
convert3
(
result
));
}
}
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductAttrConvert.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductAttrBO
;
import
cn.iocoder.mall.product.api.bo.ProductAttrPageBO
;
import
cn.iocoder.mall.product.api.bo.ProductAttrSimpleBO
;
import
cn.iocoder.mall.product.api.bo.ProductAttrValueBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrValueVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductAttrConvert
{
ProductAttrConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductAttrConvert
.
class
);
@Mappings
({})
AdminsProductAttrPageVO
convert2
(
ProductAttrPageBO
result
);
@Mappings
({})
List
<
AdminsProductAttrSimpleVO
>
convert
(
List
<
ProductAttrSimpleBO
>
result
);
@Mappings
({})
AdminsProductAttrVO
convert3
(
ProductAttrBO
productAttrBO
);
@Mappings
({})
AdminsProductAttrValueVO
convert4
(
ProductAttrValueBO
productAttrValueBO
);
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductBrandConvert.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductBrandBO
;
import
cn.iocoder.mall.product.api.bo.ProductBrangPageBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrandVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductBrangPageVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
@Mapper
public
interface
ProductBrandConvert
{
ProductBrandConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductBrandConvert
.
class
);
@Mappings
({})
AdminsProductBrandVO
convert
(
ProductBrandBO
result
);
@Mappings
({})
AdminsProductBrangPageVO
convert
(
ProductBrangPageBO
result
);
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductCategoryConvert.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductCategoryBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryTreeNodeVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductCategoryVO
;
import
cn.iocoder.mall.product.application.vo.users.UsersProductCategoryVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
public
interface
ProductCategoryConvert
{
@Mapper
interface
Users
{
Users
INSTANCE
=
Mappers
.
getMapper
(
Users
.
class
);
@Mappings
({})
UsersProductCategoryVO
convertToVO
(
ProductCategoryBO
category
);
@Mappings
({})
List
<
UsersProductCategoryVO
>
convertToVO
(
List
<
ProductCategoryBO
>
categoryList
);
}
@Mapper
interface
Admins
{
Admins
INSTANCE
=
Mappers
.
getMapper
(
Admins
.
class
);
@Mappings
({})
AdminsProductCategoryTreeNodeVO
convert
(
ProductCategoryBO
category
);
@Mappings
({})
AdminsProductCategoryVO
convert2
(
ProductCategoryBO
result
);
}
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
convert
;
import
cn.iocoder.mall.product.api.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.api.bo.ProductSpuDetailBO
;
import
cn.iocoder.mall.product.api.bo.ProductSpuPageBO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO
;
import
cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuVO
;
import
cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO
;
import
cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.Mappings
;
import
org.mapstruct.factory.Mappers
;
import
java.util.List
;
@Mapper
public
interface
ProductSpuConvert
{
ProductSpuConvert
INSTANCE
=
Mappers
.
getMapper
(
ProductSpuConvert
.
class
);
@Mappings
({})
AdminsProductSpuDetailVO
convert
(
ProductSpuDetailBO
productSpuDetailBO
);
// @Mappings({})
// CommonResult<AdminsProductSpuDetailVO> convert(CommonResult<ProductSpuDetailBO> result);
@Mappings
({})
AdminsProductSpuPageVO
convert2
(
ProductSpuPageBO
result
);
@Mappings
({})
List
<
AdminsProductSpuVO
>
convert3
(
List
<
ProductSpuBO
>
result
);
@Mappings
({})
UsersProductSpuPageVO
convert3
(
ProductSpuPageBO
result
);
@Mappings
({})
UsersProductSpuDetailVO
convert4
(
ProductSpuDetailBO
result
);
}
product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductCategoryVO.java
deleted
100644 → 0
浏览文件 @
954979b5
package
cn
.
iocoder
.
mall
.
product
.
application
.
vo
.
users
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@ApiModel
(
"商品分类(简单)"
)
@Data
@Accessors
(
chain
=
true
)
public
class
UsersProductCategoryVO
{
@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
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论