Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
25cfb727
Commit
25cfb727
authored
Nov 23, 2020
by
xierz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用子栏目模板
parent
3582314e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
8 deletions
+42
-8
CategoryAction.java
src/main/java/net/mingsoft/cms/action/CategoryAction.java
+14
-7
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+1
-1
index.ftl
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
+27
-0
No files found.
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
25cfb727
...
...
@@ -27,6 +27,7 @@ import springfox.documentation.annotations.ApiIgnore;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Optional
;
/**
* 分类管理控制层
...
...
@@ -180,7 +181,7 @@ public class CategoryAction extends BaseAction {
}
/**
* @param category 分类实体
* @param category
s
分类实体
*/
@ApiOperation
(
value
=
"批量删除分类列表接口"
)
@PostMapping
(
"/delete"
)
...
...
@@ -295,12 +296,18 @@ public class CategoryAction extends BaseAction {
@ApiOperation
(
value
=
"批量更新模版"
)
@GetMapping
(
"/updateTemplate"
)
@ResponseBody
public
ResultData
updateTemplate
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
,
HttpServletResponse
response
,
HttpServletRequest
request
,
@ApiIgnore
ModelMap
model
){
//父栏目是列表
//父栏目是封面
public
ResultData
updateTemplate
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
){
category
=
categoryBiz
.
getById
(
category
.
getId
());
List
<
CategoryEntity
>
childs
=
categoryBiz
.
queryChilds
(
category
);
//更新与父节点相同类型的子栏目的模板内容
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
if
(
childs
.
get
(
i
).
getCategoryType
().
equals
(
category
.
getCategoryType
()))
{
childs
.
get
(
i
).
setCategoryUrl
(
category
.
getCategoryUrl
());
childs
.
get
(
i
).
setCategoryListUrl
(
category
.
getCategoryListUrl
());
categoryBiz
.
updateEntity
(
childs
.
get
(
i
));
}
}
return
ResultData
.
build
().
success
();
}
}
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
25cfb727
...
...
@@ -202,7 +202,7 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
Assert
.
notNull
(
entity
);
CategoryEntity
categoryEntity
=
getById
(
entity
.
getId
());
//如果父级不为空并且修改了父级则需要更新父级
if
(!
entity
.
getCategoryId
().
equals
(
categoryEntity
.
getCategoryId
())){
if
(
entity
.
getCategoryId
()
!=
null
&&
!
entity
.
getCategoryId
().
equals
(
categoryEntity
.
getCategoryId
())){
//更新旧的父级
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryId
())&&!
"0"
.
equals
(
categoryEntity
.
getCategoryId
())){
CategoryEntity
parent
=
getById
(
categoryEntity
.
getCategoryId
());
...
...
src/main/webapp/WEB-INF/manager/cms/category/index.ftl
View file @
25cfb727
...
...
@@ -75,6 +75,9 @@
<
@
shiro
.
hasPermission
name=
"cms:category:save"
>
<el-link
type=
"primary"
:underline=
"false"
@
click=
"save(scope.row.id, scope.row.id)"
><i
class=
"el-icon-plus"
></i>
子栏目
</el-link>
</
@
shiro
.hasPermission
>
<
@
shiro
.
hasPermission
name=
"cms:category:update"
>
<el-link
type=
"primary"
:underline=
"false"
v-if=
"scope.row.categoryType == '1' || scope.row.categoryType == '2'"
@
click=
"updateTemplate(scope.row)"
>
应用子栏目
</el-link>
</
@
shiro
.hasPermission
>
<
@
shiro
.
hasPermission
name=
"cms:category:update"
>
<el-link
type=
"primary"
:underline=
"false"
@
click=
"save(scope.row.id)"
>
编辑
</el-link>
</
@
shiro
.hasPermission
>
...
...
@@ -143,6 +146,30 @@
}
},
methods
:
{
//应用子栏目模板
updateTemplate
:
function
(
row
)
{
var
that
=
this
;
ms
.
http
.
get
(
ms
.
manager
+
"/cms/category/updateTemplate.do"
,
{
id
:
row
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
result
)
{
that
.
$notify
({
title
:
'成功'
,
message
:
'应用成功'
,
type
:
'success'
});
that
.
list
();
}
else
{
that
.
$notify
({
title
:
'失败'
,
message
:
res
.
msg
,
type
:
'warning'
});
}
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
//根据字典数据值获取字典标签名
getDictLabel
:
function
(
v
)
{
var
that
=
this
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment