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
6346898c
Commit
6346898c
authored
Sep 03, 2020
by
luoxj
Browse files
文章伪删除
parent
ce8319ed
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
doc/5.0.0-to-5.1-mysql.sql
View file @
6346898c
This diff is collapsed.
Click to expand it.
doc/mcms-5.1.sql
View file @
6346898c
This diff is collapsed.
Click to expand it.
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
6346898c
...
@@ -27,6 +27,7 @@ import net.mingsoft.base.dao.IBaseDao;
...
@@ -27,6 +27,7 @@ import net.mingsoft.base.dao.IBaseDao;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.dao.ICategoryDao
;
import
net.mingsoft.cms.dao.ICategoryDao
;
import
net.mingsoft.cms.dao.IContentDao
;
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
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -48,6 +49,9 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
...
@@ -48,6 +49,9 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
@Autowired
@Autowired
private
ICategoryDao
categoryDao
;
private
ICategoryDao
categoryDao
;
@Autowired
private
IContentDao
contentDao
;
@Override
@Override
protected
IBaseDao
getDao
()
{
protected
IBaseDao
getDao
()
{
...
@@ -157,7 +161,8 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
...
@@ -157,7 +161,8 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
ids
[
i
]
=
Integer
.
parseInt
(
childrenList
.
get
(
i
).
getId
());
ids
[
i
]
=
Integer
.
parseInt
(
childrenList
.
get
(
i
).
getId
());
}
}
categoryDao
.
delete
(
ids
);
categoryDao
.
delete
(
ids
);
deleteEntity
(
categoryId
);
// 删除文章
contentDao
.
deleteEntityByCategoryIds
(
ids
);
}
}
}
}
}
}
src/main/java/net/mingsoft/cms/dao/IContentDao.java
View file @
6346898c
...
@@ -34,4 +34,10 @@ public interface IContentDao extends IBaseDao {
...
@@ -34,4 +34,10 @@ public interface IContentDao extends IBaseDao {
*/
*/
int
getSearchCount
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"diyList"
)
List
diyList
,
@Param
(
"map"
)
Map
<
String
,
Object
>
map
,
int
getSearchCount
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"diyList"
)
List
diyList
,
@Param
(
"map"
)
Map
<
String
,
Object
>
map
,
@Param
(
"websiteId"
)
int
websiteId
,
@Param
(
"ids"
)
String
ids
);
@Param
(
"websiteId"
)
int
websiteId
,
@Param
(
"ids"
)
String
ids
);
/**
* 分类编号删除文章
* @param ids
*/
void
deleteEntityByCategoryIds
(
@Param
(
"ids"
)
int
[]
ids
);
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
View file @
6346898c
...
@@ -159,13 +159,14 @@
...
@@ -159,13 +159,14 @@
<!--根据id获取-->
<!--根据id获取-->
<select
id=
"getEntity"
resultMap=
"resultMap"
parameterType=
"int"
>
<select
id=
"getEntity"
resultMap=
"resultMap"
parameterType=
"int"
>
select * from cms_content where id=#{id}
select * from cms_content where id=#{id}
and del=0
</select>
</select>
<!--根据实体获取-->
<!--根据实体获取-->
<select
id=
"getByEntity"
resultMap=
"resultMap"
parameterType=
"net.mingsoft.cms.entity.ContentEntity"
>
<select
id=
"getByEntity"
resultMap=
"resultMap"
parameterType=
"net.mingsoft.cms.entity.ContentEntity"
>
select * from cms_content
select * from cms_content
<where>
<where>
del=0
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"contentCategoryId != null and contentCategoryId != ''"
>
and content_category_id=#{contentCategoryId}
</if>
<if
test=
"contentCategoryId != null and contentCategoryId != ''"
>
and content_category_id=#{contentCategoryId}
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type=#{contentType}
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type=#{contentType}
</if>
...
@@ -185,7 +186,6 @@
...
@@ -185,7 +186,6 @@
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateBy > 0"
>
and update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and del=#{del}
</if>
</where>
</where>
limit 0,1
limit 0,1
</select>
</select>
...
@@ -193,12 +193,21 @@
...
@@ -193,12 +193,21 @@
<!--删除-->
<!--删除-->
<delete
id=
"deleteEntity"
parameterType=
"int"
>
<delete
id=
"deleteEntity"
parameterType=
"int"
>
delete from cms_content where id=#{id}
update cms_content set del=1 where id=#{id}
</delete>
<!--删除-->
<delete
id=
"deleteEntityByCategoryIds"
>
update cms_content set del=1
<where>
content_category_id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</where>
</delete>
</delete>
<!--批量删除-->
<!--批量删除-->
<delete
id=
"delete"
>
<delete
id=
"delete"
>
delete from
cms_content
update
cms_content
set del=1
<where>
<where>
id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
...
@@ -206,7 +215,7 @@
...
@@ -206,7 +215,7 @@
</delete>
</delete>
<!--查询全部-->
<!--查询全部-->
<select
id=
"queryAll"
resultMap=
"resultMap"
>
<select
id=
"queryAll"
resultMap=
"resultMap"
>
select * from cms_content order by id desc
select * from cms_content
where del=0
order by id desc
</select>
</select>
<!--条件查询-->
<!--条件查询-->
<select
id=
"query"
resultMap=
"resultContentMap"
>
<select
id=
"query"
resultMap=
"resultContentMap"
>
...
@@ -214,6 +223,7 @@
...
@@ -214,6 +223,7 @@
select ct.*,cc.category_path from cms_content ct
select ct.*,cc.category_path from cms_content ct
join cms_category cc on ct.content_category_id=cc.id
join cms_category cc on ct.content_category_id=cc.id
<where>
<where>
ct.del=0
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"contentTitle != null and contentTitle != ''"
>
and content_title like CONCAT('%',#{contentTitle},'%')
</if>
<if
test=
"contentCategoryId != null and contentCategoryId != ''"
>
and content_category_id=#{contentCategoryId}
</if>
<if
test=
"contentCategoryId != null and contentCategoryId != ''"
>
and content_category_id=#{contentCategoryId}
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type LIKE CONCAT('%',#{contentType},'%')
</if>
<if
test=
"contentType != null and contentType != ''"
>
and content_type LIKE CONCAT('%',#{contentType},'%')
</if>
...
@@ -233,7 +243,6 @@
...
@@ -233,7 +243,6 @@
<if
test=
"createDate != null"
>
and ct.create_date=#{createDate}
</if>
<if
test=
"createDate != null"
>
and ct.create_date=#{createDate}
</if>
<if
test=
"updateBy > 0"
>
and ct.update_by=#{updateBy}
</if>
<if
test=
"updateBy > 0"
>
and ct.update_by=#{updateBy}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"updateDate != null"
>
and update_date=#{updateDate}
</if>
<if
test=
"del != null"
>
and ct.del=#{del}
</if>
</where>
</where>
)ct ORDER BY date_format(ct.content_datetime,'%Y-%m-%d') desc,content_sort desc
)ct ORDER BY date_format(ct.content_datetime,'%Y-%m-%d') desc,content_sort desc
</select>
</select>
...
@@ -254,9 +263,9 @@
...
@@ -254,9 +263,9 @@
cms_content.id article_id,c.*
cms_content.id article_id,c.*
FROM cms_content
FROM cms_content
LEFT JOIN cms_category c ON content_category_id = c.id
LEFT JOIN cms_category c ON content_category_id = c.id
where
where
del=0
<if
test=
"appId > 0"
>
<if
test=
"appId > 0"
>
cms_content.app_id = #{appId}
and
cms_content.app_id = #{appId}
</if>
</if>
<!-- 查询子栏目数据 -->
<!-- 查询子栏目数据 -->
<if
test=
"contentCategoryId > 0"
>
<if
test=
"contentCategoryId > 0"
>
...
@@ -302,7 +311,7 @@
...
@@ -302,7 +311,7 @@
<if
test=
"tableName!=null and tableName!='' and diyMap!=null"
>
left join ${tableName} d on d.link_id=a.id
<if
test=
"tableName!=null and tableName!='' and diyMap!=null"
>
left join ${tableName} d on d.link_id=a.id
</if>
</if>
<where>
<where>
a.app_id = #{websiteId}
a.del=0 and
a.app_id = #{websiteId}
<if
test=
"ids!=null and ids!=''"
>
<if
test=
"ids!=null and ids!=''"
>
and FIND_IN_SET(content_category_id,#{ids})
and FIND_IN_SET(content_category_id,#{ids})
</if>
</if>
...
...
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