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
4748d53a
Commit
4748d53a
authored
Oct 31, 2020
by
sgjj
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/5.2' into 5.2
parents
3d34aa59
2f2f9ddf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
27 deletions
+47
-27
CategoryAction.java
src/main/java/net/mingsoft/cms/action/CategoryAction.java
+1
-1
ICategoryBiz.java
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
+1
-1
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+7
-6
IContentDao.java
src/main/java/net/mingsoft/cms/dao/IContentDao.java
+2
-1
Upgrade.java
src/main/java/net/mingsoft/cms/upgrade/Upgrade.java
+34
-16
AppHandler.java
src/main/java/net/mingsoft/handler/AppHandler.java
+2
-2
No files found.
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
4748d53a
...
@@ -182,7 +182,7 @@ public class CategoryAction extends BaseAction {
...
@@ -182,7 +182,7 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions
(
"cms:category:del"
)
@RequiresPermissions
(
"cms:category:del"
)
public
ResultData
delete
(
@RequestBody
List
<
CategoryEntity
>
categorys
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
public
ResultData
delete
(
@RequestBody
List
<
CategoryEntity
>
categorys
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
for
(
int
i
=
0
;
i
<
categorys
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
categorys
.
size
();
i
++){
categoryBiz
.
delete
(
Integer
.
parseInt
(
categorys
.
get
(
i
).
getId
()
));
categoryBiz
.
delete
(
categorys
.
get
(
i
).
getId
(
));
}
}
return
ResultData
.
build
().
success
();
return
ResultData
.
build
().
success
();
}
}
...
...
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
View file @
4748d53a
...
@@ -33,5 +33,5 @@ public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
...
@@ -33,5 +33,5 @@ public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
*/
*/
void
update
(
CategoryEntity
entity
);
void
update
(
CategoryEntity
entity
);
void
delete
(
int
categoryId
);
void
delete
(
String
categoryId
);
}
}
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
4748d53a
...
@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -163,21 +164,21 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
...
@@ -163,21 +164,21 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
}
}
@Override
@Override
public
void
delete
(
int
categoryId
)
{
public
void
delete
(
String
categoryId
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
CategoryEntity
category
=
(
CategoryEntity
)
categoryDao
.
getEntity
(
categoryId
);
CategoryEntity
category
=
(
CategoryEntity
)
categoryDao
.
selectById
(
categoryId
);
//删除父类
//删除父类
if
(
category
!=
null
){
if
(
category
!=
null
){
category
.
setCategoryParentId
(
null
);
category
.
setCategoryParentId
(
null
);
List
<
CategoryEntity
>
childrenList
=
categoryDao
.
queryChildren
(
category
);
List
<
CategoryEntity
>
childrenList
=
categoryDao
.
queryChildren
(
category
);
int
[]
ids
=
new
int
[
childrenList
.
size
()]
;
List
<
String
>
ids
=
new
ArrayList
<>()
;
for
(
int
i
=
0
;
i
<
childrenList
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
childrenList
.
size
();
i
++){
//删除子类
//删除子类
ids
[
i
]
=
Integer
.
parseInt
(
childrenList
.
get
(
i
).
getId
());
ids
.
add
(
childrenList
.
get
(
i
).
getId
());
}
}
categoryDao
.
delete
(
ids
);
categoryDao
.
delete
BatchIds
(
ids
);
// 删除文章
// 删除文章
contentDao
.
deleteEntityByCategoryIds
(
ids
);
contentDao
.
deleteEntityByCategoryIds
(
ids
.
toArray
(
new
String
[
ids
.
size
()])
);
}
}
}
}
...
...
src/main/java/net/mingsoft/cms/dao/IContentDao.java
View file @
4748d53a
...
@@ -41,5 +41,5 @@ public interface IContentDao extends IBaseDao<ContentEntity> {
...
@@ -41,5 +41,5 @@ public interface IContentDao extends IBaseDao<ContentEntity> {
* 分类编号删除文章
* 分类编号删除文章
* @param ids
* @param ids
*/
*/
void
deleteEntityByCategoryIds
(
@Param
(
"ids"
)
int
[]
ids
);
void
deleteEntityByCategoryIds
(
@Param
(
"ids"
)
String
[]
ids
);
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/upgrade/Upgrade.java
View file @
4748d53a
package
net
.
mingsoft
.
cms
.
upgrade
;
package
net
.
mingsoft
.
cms
.
upgrade
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
io.swagger.models.auth.In
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author by 铭飞开源团队
* @author by 铭飞开源团队
...
@@ -17,29 +20,44 @@ import java.util.List;
...
@@ -17,29 +20,44 @@ import java.util.List;
public
class
Upgrade
{
public
class
Upgrade
{
/**
/**
*
菜单拼音升级
*
更新栏目分类的顶级节点和叶子节点
*/
*/
public
void
upgrade
(){
public
void
upgrade
(){
ICategoryBiz
categoryBiz
=
SpringUtil
.
getBean
(
ICategoryBiz
.
class
);
ICategoryBiz
categoryBiz
=
SpringUtil
.
getBean
(
ICategoryBiz
.
class
);
List
<
CategoryEntity
>
list
=
categoryBiz
.
queryAll
();
List
<
CategoryEntity
>
list
=
categoryBiz
.
queryAll
();
//先更新所有栏目的拼音
list
.
forEach
(
x
->{
list
.
forEach
(
x
->{
String
pingYin
=
PinYinUtil
.
getPingYin
(
x
.
getCategoryTitle
());
CategoryEntity
category
=
new
CategoryEntity
();
//将parentId第一行设为顶级节点
category
.
setCategoryPinyin
(
pingYin
);
String
topId
=
"0"
;
CategoryEntity
categoryBizEntity
=
(
CategoryEntity
)
categoryBiz
.
getEntity
(
category
);
String
parentId
=
x
.
getParentid
();
x
.
setCategoryPinyin
(
pingYin
);
if
(
parentId
!=
null
)
{
//拼音存在则拼接id
topId
=
parentId
.
split
(
","
)[
0
];
if
(
categoryBizEntity
!=
null
&&!
categoryBizEntity
.
getId
().
equals
(
x
.
getId
())){
x
.
setCategoryPinyin
(
pingYin
+
x
.
getId
());
}
}
categoryBiz
.
update
(
x
);
x
.
setTopId
(
topId
);
});
//再更新路径
String
id
=
x
.
getId
();
list
.
forEach
(
x
->{
boolean
leaf
=
true
;
if
(
StrUtil
.
isBlank
(
x
.
getCategoryId
())||
x
.
getCategoryId
().
equals
(
"0"
)){
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
categoryBiz
.
updateEntity
(
x
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
String
pId
=
list
.
get
(
i
).
getParentid
();
if
(
pId
==
null
)
{
continue
;
}
leaf
=
!
pId
.
contains
(
id
);
//如果不是叶子就跳出循环,不需要再判断了
if
(!
leaf
)
{
break
;
}
}
}
x
.
setLeaf
(
leaf
);
//更新
Map
<
String
,
String
>
fields
=
new
HashMap
<>();
fields
.
put
(
"leaf"
,
x
.
getLeaf
()?
"1"
:
"0"
);
fields
.
put
(
"top_id"
,
x
.
getTopId
());
Map
<
String
,
String
>
where
=
new
HashMap
<>();
where
.
put
(
"id"
,
x
.
getId
());
categoryBiz
.
updateBySQL
(
"cms_category"
,
fields
,
where
);
});
});
}
}
...
...
src/main/java/net/mingsoft/handler/AppHandler.java
View file @
4748d53a
...
@@ -24,12 +24,12 @@ public class AppHandler implements TenantLineHandler {
...
@@ -24,12 +24,12 @@ public class AppHandler implements TenantLineHandler {
if
(
localPage
!=
null
&&
localPage
.
getTotal
()==
0
){
if
(
localPage
!=
null
&&
localPage
.
getTotal
()==
0
){
PageHelper
.
clearPage
();
PageHelper
.
clearPage
();
}
}
int
appId
=
BasicUtil
.
getAppId
();
//
int appId = BasicUtil.getAppId();
if
(
localPage
!=
null
&&
localPage
.
getTotal
()==
0
){
if
(
localPage
!=
null
&&
localPage
.
getTotal
()==
0
){
PageHelper
.
startPage
(
localPage
.
getPageNum
(),
localPage
.
getPageSize
(),
localPage
.
isCount
());
PageHelper
.
startPage
(
localPage
.
getPageNum
(),
localPage
.
getPageSize
(),
localPage
.
isCount
());
PageHelper
.
orderBy
(
localPage
.
getOrderBy
());
PageHelper
.
orderBy
(
localPage
.
getOrderBy
());
}
}
return
new
LongValue
(
appId
);
return
new
LongValue
(
1
);
}
}
@Override
@Override
...
...
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