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
26deb589
Commit
26deb589
authored
Dec 12, 2019
by
tianbj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
链接地址
parent
c31868dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
ICategoryBiz.java
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
+2
-1
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+26
-4
No files found.
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
View file @
26deb589
...
@@ -21,7 +21,7 @@ public interface ICategoryBiz extends IBaseBiz {
...
@@ -21,7 +21,7 @@ public interface ICategoryBiz extends IBaseBiz {
*/
*/
List
<
CategoryEntity
>
queryChilds
(
CategoryEntity
category
);
List
<
CategoryEntity
>
queryChilds
(
CategoryEntity
category
);
int
saveEntity
(
CategoryEntity
entity
);
void
saveEntity
(
CategoryEntity
entity
);
void
updateEntity
(
CategoryEntity
entity
);
void
updateEntity
(
CategoryEntity
entity
);
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
26deb589
...
@@ -62,10 +62,19 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
...
@@ -62,10 +62,19 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
return
categoryDao
.
queryChildren
(
category
);
return
categoryDao
.
queryChildren
(
category
);
}
}
@Override
@Override
public
int
saveEntity
(
CategoryEntity
categoryEntity
)
{
public
void
saveEntity
(
CategoryEntity
categoryEntity
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
setParentId
(
categoryEntity
);
setParentId
(
categoryEntity
);
return
super
.
saveEntity
(
categoryEntity
);
super
.
saveEntity
(
categoryEntity
);
//保存链接地址
String
path
=
ObjectUtil
.
isNotNull
(
categoryEntity
.
getCategoryParentId
())?
categoryEntity
.
getCategoryParentId
():
""
;
//判断是否有parentIds
if
(
StringUtils
.
isNotBlank
(
path
)){
categoryEntity
.
setCategoryPath
(
"/"
+
path
.
replaceAll
(
","
,
"/"
)
+
"/"
+
categoryEntity
.
getId
());
}
else
{
categoryEntity
.
setCategoryPath
(
"/"
+
categoryEntity
.
getId
());
}
super
.
updateEntity
(
categoryEntity
);
}
}
private
void
setParentId
(
CategoryEntity
categoryEntity
)
{
private
void
setParentId
(
CategoryEntity
categoryEntity
)
{
...
@@ -79,8 +88,16 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
...
@@ -79,8 +88,16 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
}
else
{
}
else
{
categoryEntity
.
setCategoryParentId
(
null
);
categoryEntity
.
setCategoryParentId
(
null
);
}
}
String
path
=
ObjectUtil
.
isNotNull
(
categoryEntity
.
getCategoryParentId
())?
categoryEntity
.
getCategoryParentId
():
""
;
//保存时先保存再修改链接地址,修改时直接修改
categoryEntity
.
setCategoryPath
(
"/"
+
path
.
replaceAll
(
","
,
"/"
)+
"/"
+
categoryEntity
.
getId
());
if
(
StringUtils
.
isNotBlank
(
categoryEntity
.
getId
()))
{
String
path
=
ObjectUtil
.
isNotNull
(
categoryEntity
.
getCategoryParentId
())
?
categoryEntity
.
getCategoryParentId
()
:
""
;
//判断是否有parentIds
if
(
StringUtils
.
isNotBlank
(
path
)){
categoryEntity
.
setCategoryPath
(
"/"
+
path
.
replaceAll
(
","
,
"/"
)
+
"/"
+
categoryEntity
.
getId
());
}
else
{
categoryEntity
.
setCategoryPath
(
"/"
+
categoryEntity
.
getId
());
}
}
}
}
private
void
setChildParentId
(
CategoryEntity
categoryEntity
)
{
private
void
setChildParentId
(
CategoryEntity
categoryEntity
)
{
...
@@ -94,7 +111,12 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
...
@@ -94,7 +111,12 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
x
.
setCategoryParentId
(
categoryEntity
.
getCategoryParentId
()+
","
+
categoryEntity
.
getId
());
x
.
setCategoryParentId
(
categoryEntity
.
getCategoryParentId
()+
","
+
categoryEntity
.
getId
());
}
}
String
path
=
ObjectUtil
.
isNotNull
(
x
.
getCategoryParentId
())?
x
.
getCategoryParentId
():
""
;
String
path
=
ObjectUtil
.
isNotNull
(
x
.
getCategoryParentId
())?
x
.
getCategoryParentId
():
""
;
//判断是否有parentIds
if
(
StringUtils
.
isNotBlank
(
path
)){
x
.
setCategoryPath
(
"/"
+
path
.
replaceAll
(
","
,
"/"
)+
"/"
+
x
.
getId
());
x
.
setCategoryPath
(
"/"
+
path
.
replaceAll
(
","
,
"/"
)+
"/"
+
x
.
getId
());
}
else
{
x
.
setCategoryPath
(
"/"
+
x
.
getId
());
}
super
.
updateEntity
(
x
);
super
.
updateEntity
(
x
);
setChildParentId
(
x
);
setChildParentId
(
x
);
});
});
...
...
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