Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
c8488fc2
提交
c8488fc2
authored
3月 15, 2019
作者:
sin
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
70b5ea48
fd1d1d30
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
76 行增加
和
47 行删除
+76
-47
productCategoryList.js
admin-web/src/models/product/productCategoryList.js
+17
-9
ProductCategoryList.js
admin-web/src/pages/Product/ProductCategoryList.js
+41
-30
product.js
admin-web/src/services/product.js
+14
-6
ProductCategoryServiceImpl.java
...oder/mall/product/service/ProductCategoryServiceImpl.java
+4
-2
没有找到文件。
admin-web/src/models/product/productCategoryList.js
浏览文件 @
c8488fc2
import
{
message
}
from
'antd'
;
import
{
message
}
from
'antd'
;
import
{
addResource
,
updateResource
,
deleteResource
,
resourceTree
}
from
'../../services/admin'
;
import
{
productCategoryTree
,
productCategoryAdd
,
productCategoryUpdate
,
productCategoryUpdateStatus
,
productCategoryDelete
}
from
'../../services/product'
;
import
{
productCategoryTree
}
from
'../../services/product'
;
export
default
{
export
default
{
namespace
:
'productCategoryList'
,
namespace
:
'productCategoryList'
,
...
@@ -12,7 +11,7 @@ export default {
...
@@ -12,7 +11,7 @@ export default {
effects
:
{
effects
:
{
*
add
({
payload
},
{
call
,
put
})
{
*
add
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
addResource
,
body
);
const
response
=
yield
call
(
productCategoryAdd
,
body
);
if
(
callback
)
{
if
(
callback
)
{
callback
(
response
);
callback
(
response
);
}
}
...
@@ -23,7 +22,18 @@ export default {
...
@@ -23,7 +22,18 @@ export default {
},
},
*
update
({
payload
},
{
call
,
put
})
{
*
update
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
updateResource
,
body
);
const
response
=
yield
call
(
productCategoryUpdate
,
body
);
if
(
callback
)
{
callback
(
response
);
}
yield
put
({
type
:
'tree'
,
payload
:
{},
});
},
*
updateStatus
({
payload
},
{
call
,
put
})
{
const
{
callback
,
body
}
=
payload
;
const
response
=
yield
call
(
productCategoryUpdateStatus
,
body
);
if
(
callback
)
{
if
(
callback
)
{
callback
(
response
);
callback
(
response
);
}
}
...
@@ -33,13 +43,11 @@ export default {
...
@@ -33,13 +43,11 @@ export default {
});
});
},
},
*
delete
({
payload
},
{
call
,
put
})
{
*
delete
({
payload
},
{
call
,
put
})
{
const
response
=
yield
call
(
deleteResourc
e
,
payload
);
const
response
=
yield
call
(
productCategoryDelet
e
,
payload
);
message
.
info
(
'删除成功!'
);
message
.
info
(
'删除成功!'
);
yield
put
({
yield
put
({
type
:
'treeSuccess'
,
type
:
'tree'
,
payload
:
{
payload
:
{},
list
:
response
.
data
,
},
});
});
},
},
*
tree
({
payload
},
{
call
,
put
})
{
*
tree
({
payload
},
{
call
,
put
})
{
...
...
admin-web/src/pages/Product/ProductCategoryList.js
浏览文件 @
c8488fc2
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
React
,
{
PureComponent
,
Fragment
}
from
'react'
;
import
React
,
{
PureComponent
,
Fragment
}
from
'react'
;
import
{
connect
}
from
'dva'
;
import
{
connect
}
from
'dva'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
Card
,
Form
,
Input
,
Select
,
Button
,
Modal
,
message
,
Table
,
Divider
}
from
'antd'
;
import
{
Card
,
Form
,
Input
,
Select
,
Button
,
Modal
,
message
,
Table
,
Divider
,
InputNumber
}
from
'antd'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
styles
from
'./ProductCategoryList.less'
;
import
styles
from
'./ProductCategoryList.less'
;
...
@@ -43,46 +43,34 @@ const CreateForm = Form.create()(props => {
...
@@ -43,46 +43,34 @@ const CreateForm = Form.create()(props => {
okText
=
{
okText
}
okText
=
{
okText
}
onCancel
=
{()
=>
handleModalVisible
()}
onCancel
=
{()
=>
handleModalVisible
()}
>
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"
菜单展示
名"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"
分类
名"
>
{
form
.
getFieldDecorator
(
'
displayN
ame'
,
{
{
form
.
getFieldDecorator
(
'
n
ame'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入
菜单展示名字
!'
,
min
:
2
}],
rules
:
[{
required
:
true
,
message
:
'请输入
分类名
!'
,
min
:
2
}],
initialValue
:
initValues
.
displayN
ame
,
initialValue
:
initValues
.
n
ame
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"
操作
"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"
分类图片
"
>
{
form
.
getFieldDecorator
(
'
handler
'
,
{
{
form
.
getFieldDecorator
(
'
picUrl
'
,
{
initialValue
:
initValues
.
handler
,
initialValue
:
initValues
.
handler
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"资源名字"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"父分类编号"
>
{
form
.
getFieldDecorator
(
'name'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入资源名字!'
}],
initialValue
:
initValues
.
name
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"父级资源编号"
>
{
form
.
getFieldDecorator
(
'pid'
,
{
{
form
.
getFieldDecorator
(
'pid'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入父
级
编号!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入父
分类
编号!'
}],
initialValue
:
initValues
.
pid
,
initialValue
:
initValues
.
pid
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
span
>
根节点为
0
<
/span
>
<
/FormItem
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"排序"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"排序
值
"
>
{
form
.
getFieldDecorator
(
'sort'
,
{
{
form
.
getFieldDecorator
(
'sort'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入
菜单排序
!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入
排序值
!'
}],
initialValue
:
initValues
.
sort
,
initialValue
:
initValues
.
sort
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
})(
<
Input
Number
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"资源类型"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"描述"
>
{
form
.
getFieldDecorator
(
'type'
,
{
{
form
.
getFieldDecorator
(
'description'
,
{
rules
:
[{
required
:
true
,
message
:
'请选择资源类型!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入描述!'
}],
initialValue
:
1
,
initialValue
:
initValues
.
description
,
})(
})(
<
Input
.
TextArea
placeholder
=
"请输入"
/>
)}
<
Select
showSearch
style
=
{
selectStyle
}
placeholder
=
"请选择"
>
<
Option
value
=
{
1
}
>
菜单
<
/Option
>
<
Option
value
=
{
2
}
>
Url
<
/Option
>
<
/Select
>
)}
<
/FormItem
>
<
/FormItem
>
<
/Modal
>
<
/Modal
>
);
);
...
@@ -149,6 +137,30 @@ class ProductCategoryList extends PureComponent {
...
@@ -149,6 +137,30 @@ class ProductCategoryList extends PureComponent {
}
}
};
};
handleStatus
(
row
)
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
title
=
row
.
status
===
1
?
'确认禁用?'
:
'确认开启?'
;
const
updateStatus
=
row
.
status
===
1
?
2
:
1
;
Modal
.
confirm
({
title
:
`
${
title
}
`
,
content
:
`
${
row
.
name
}
`
,
onOk
()
{
dispatch
({
type
:
'productCategoryList/updateStatus'
,
payload
:
{
body
:
{
id
:
row
.
id
,
status
:
updateStatus
,
}
},
});
},
onCancel
()
{},
});
}
handleDelete
(
row
)
{
handleDelete
(
row
)
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
Modal
.
confirm
({
Modal
.
confirm
({
...
@@ -223,7 +235,6 @@ class ProductCategoryList extends PureComponent {
...
@@ -223,7 +235,6 @@ class ProductCategoryList extends PureComponent {
<
Fragment
>
<
Fragment
>
<
a
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'update'
,
record
)}
>
更新
<
/a
>
<
a
onClick
=
{()
=>
this
.
handleModalVisible
(
true
,
'update'
,
record
)}
>
更新
<
/a
>
<
Divider
type
=
"vertical"
/>
<
Divider
type
=
"vertical"
/>
<
Divider
type
=
"vertical"
/>
<
a
className
=
{
styles
.
tableDelete
}
onClick
=
{()
=>
this
.
handleStatus
(
record
)}
>
<
a
className
=
{
styles
.
tableDelete
}
onClick
=
{()
=>
this
.
handleStatus
(
record
)}
>
{
statusText
}
{
statusText
}
<
/a
>
<
/a
>
...
...
admin-web/src/services/product.js
浏览文件 @
c8488fc2
...
@@ -9,22 +9,29 @@ export async function productCategoryTree(params) {
...
@@ -9,22 +9,29 @@ export async function productCategoryTree(params) {
});
});
}
}
export
async
function
dictiona
ryAdd
(
params
)
{
export
async
function
productCatego
ryAdd
(
params
)
{
return
request
(
`/
admin-api/admins/data_dict
/add?
${
stringify
(
params
)}
`
,
{
return
request
(
`/
product-api/admins/category
/add?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
method
:
'POST'
,
body
:
{},
body
:
{},
});
});
}
}
export
async
function
dictiona
ryUpdate
(
params
)
{
export
async
function
productCatego
ryUpdate
(
params
)
{
return
request
(
`/
admin-api/admins/data_dict
/update?
${
stringify
(
params
)}
`
,
{
return
request
(
`/
product-api/admins/category
/update?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
method
:
'POST'
,
body
:
{},
body
:
{},
});
});
}
}
export
async
function
dictionaryDelete
(
params
)
{
export
async
function
productCategoryUpdateStatus
(
params
)
{
return
request
(
`/admin-api/admins/data_dict/delete?
${
stringify
(
params
)}
`
,
{
return
request
(
`/product-api/admins/category/update_status?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
body
:
{},
});
}
export
async
function
productCategoryDelete
(
params
)
{
return
request
(
`/product-api/admins/category/delete?
${
stringify
(
params
)}
`
,
{
method
:
'POST'
,
method
:
'POST'
,
});
});
}
}
\ No newline at end of file
product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductCategoryServiceImpl.java
浏览文件 @
c8488fc2
...
@@ -93,7 +93,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
...
@@ -93,7 +93,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
return
ServiceExceptionUtil
.
error
(
ProductErrorCodeEnum
.
PRODUCT_CATEGORY_STATUS_EQUALS
.
getCode
());
return
ServiceExceptionUtil
.
error
(
ProductErrorCodeEnum
.
PRODUCT_CATEGORY_STATUS_EQUALS
.
getCode
());
}
}
// 更新商品分类
// 更新商品分类
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
().
setStatus
(
status
);
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
()
.
setId
(
productCategoryId
).
setStatus
(
status
);
productCategoryMapper
.
update
(
updateProductCategory
);
productCategoryMapper
.
update
(
updateProductCategory
);
// TODO 操作日志
// TODO 操作日志
return
CommonResult
.
success
(
true
);
return
CommonResult
.
success
(
true
);
...
@@ -113,7 +114,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
...
@@ -113,7 +114,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
// TODO 芋艿:考虑下,是否需要判断下该分类下是否有商品
// TODO 芋艿:考虑下,是否需要判断下该分类下是否有商品
// TODO 芋艿,需要补充下,还有子分类
// TODO 芋艿,需要补充下,还有子分类
// 标记删除商品分类
// 标记删除商品分类
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
().
setId
(
productCategoryId
);
ProductCategoryDO
updateProductCategory
=
new
ProductCategoryDO
()
.
setId
(
productCategoryId
);
updateProductCategory
.
setDeleted
(
BaseDO
.
DELETED_YES
);
updateProductCategory
.
setDeleted
(
BaseDO
.
DELETED_YES
);
productCategoryMapper
.
update
(
updateProductCategory
);
productCategoryMapper
.
update
(
updateProductCategory
);
// TODO 操作日志
// TODO 操作日志
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论