Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
2f2f9ddf
Commit
2f2f9ddf
authored
Oct 31, 2020
by
xierz
Browse files
栏目删除更改id类型
parent
8db9504a
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
2f2f9ddf
...
@@ -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 @
2f2f9ddf
...
@@ -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
(
in
t
categoryId
);
void
delete
(
Str
in
g
categoryId
);
}
}
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
2f2f9ddf
...
@@ -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
(
in
t
categoryId
)
{
public
void
delete
(
Str
in
g
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 @
2f2f9ddf
...
@@ -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"
)
in
t
[]
ids
);
void
deleteEntityByCategoryIds
(
@Param
(
"ids"
)
Str
in
g
[]
ids
);
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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