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
09ee994b
Commit
09ee994b
authored
Nov 14, 2022
by
mingsoft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up::5.2.10
Signed-off-by:
mingsoft
<
killfen@126.com
>
parent
c86c7b92
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1292 additions
and
1326 deletions
+1292
-1326
pom.xml
pom.xml
+6
-6
MSApplication.java
src/main/java/net/mingsoft/MSApplication.java
+0
-6
BaseAction.java
src/main/java/net/mingsoft/cms/action/BaseAction.java
+24
-24
CategoryAction.java
src/main/java/net/mingsoft/cms/action/CategoryAction.java
+1
-1
ContentAction.java
src/main/java/net/mingsoft/cms/action/ContentAction.java
+1
-10
GeneraterAction.java
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
+1
-0
CategoryAction.java
...main/java/net/mingsoft/cms/action/web/CategoryAction.java
+91
-95
ContentAction.java
src/main/java/net/mingsoft/cms/action/web/ContentAction.java
+149
-153
CategoryBean.java
src/main/java/net/mingsoft/cms/bean/CategoryBean.java
+30
-30
ContentBean.java
src/main/java/net/mingsoft/cms/bean/ContentBean.java
+114
-119
ICategoryBiz.java
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
+41
-41
IHistoryLogBiz.java
src/main/java/net/mingsoft/cms/biz/IHistoryLogBiz.java
+16
-16
CategoryBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
+298
-298
HistoryLogBizImpl.java
...ain/java/net/mingsoft/cms/biz/impl/HistoryLogBizImpl.java
+53
-53
Const.java
src/main/java/net/mingsoft/cms/constant/Const.java
+14
-14
ICategoryDao.java
src/main/java/net/mingsoft/cms/dao/ICategoryDao.java
+27
-27
ICmsHistoryLogDao.java
src/main/java/net/mingsoft/cms/dao/ICmsHistoryLogDao.java
+14
-14
IContentDao.xml
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
+10
-10
CategoryEntity.java
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java
+1
-5
ContentEntity.java
src/main/java/net/mingsoft/cms/entity/ContentEntity.java
+291
-292
HistoryLogEntity.java
src/main/java/net/mingsoft/cms/entity/HistoryLogEntity.java
+102
-106
CmsParserUtil.java
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
+0
-1
WebConfig.java
src/main/java/net/mingsoft/config/WebConfig.java
+8
-5
No files found.
pom.xml
View file @
09ee994b
...
...
@@ -10,14 +10,14 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
net.mingsoft
</groupId>
<artifactId>
ms-mcms
</artifactId>
<version>
5.2.
9
</version>
<version>
5.2.
10
</version>
<name>
${project.groupId}:${project.artifactId}
</name>
<!-- 打包war包,注意不启用(resources》resource》excludes的配置并注释掉maven-assembly-plugin 插件配置 -->
<!--<packaging>war</packaging>-->
<properties>
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<log4j.version>
2.1
8
.0
</log4j.version>
<log4j.version>
2.1
9
.0
</log4j.version>
</properties>
<repositories>
<repository>
...
...
@@ -44,24 +44,24 @@
<dependency>
<groupId>
net.mingsoft
</groupId>
<artifactId>
ms-base
</artifactId>
<version>
2.1.1
4.1
</version>
<version>
2.1.1
5
</version>
</dependency>
<dependency>
<groupId>
net.mingsoft
</groupId>
<artifactId>
ms-basic
</artifactId>
<version>
2.1.1
4.1
</version>
<version>
2.1.1
5
</version>
</dependency>
<dependency>
<groupId>
net.mingsoft
</groupId>
<artifactId>
ms-mdiy
</artifactId>
<version>
2.1.1
4.1
</version>
<version>
2.1.1
5
</version>
</dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>
net.mingsoft
</groupId>
<artifactId>
store-client
</artifactId>
<version>
2.1.1
4
</version>
<version>
2.1.1
5
</version>
</dependency>
<dependency>
<groupId>
com.github.oshi
</groupId>
...
...
src/main/java/net/mingsoft/MSApplication.java
View file @
09ee994b
...
...
@@ -25,12 +25,6 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.annotation.ComponentScan
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
java.util.Locale
;
@SpringBootApplication
(
scanBasePackages
=
{
"net.mingsoft"
})
@MapperScan
(
basePackages
={
"**.dao"
,
"com.baomidou.**.mapper"
})
...
...
src/main/java/net/mingsoft/cms/action/BaseAction.java
View file @
09ee994b
...
...
@@ -18,27 +18,27 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
action
;
import
java.util.MissingResourceException
;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:47
*/
public
class
BaseAction
extends
net
.
mingsoft
.
basic
.
action
.
BaseAction
{
@Override
protected
String
getResString
(
String
key
)
{
// TODO Auto-generated method stub
String
str
=
""
;
try
{
str
=
super
.
getResString
(
key
);
}
catch
(
MissingResourceException
e
)
{
str
=
getLocaleString
(
key
,
net
.
mingsoft
.
cms
.
constant
.
Const
.
RESOURCES
);
}
return
str
;
}
}
package
net
.
mingsoft
.
cms
.
action
;
import
java.util.MissingResourceException
;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:47
*/
public
class
BaseAction
extends
net
.
mingsoft
.
basic
.
action
.
BaseAction
{
@Override
protected
String
getResString
(
String
key
)
{
// TODO Auto-generated method stub
String
str
=
""
;
try
{
str
=
super
.
getResString
(
key
);
}
catch
(
MissingResourceException
e
)
{
str
=
getLocaleString
(
key
,
net
.
mingsoft
.
cms
.
constant
.
Const
.
RESOURCES
);
}
return
str
;
}
}
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
09ee994b
...
...
@@ -70,6 +70,7 @@ public class CategoryAction extends BaseAction {
* @return
*/
@GetMapping
(
"/index"
)
@RequiresPermissions
(
"cms:category:view"
)
public
String
index
(){
return
"/cms/category/index"
;
}
...
...
@@ -86,7 +87,6 @@ public class CategoryAction extends BaseAction {
})
@RequestMapping
(
value
=
"/list"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
@ResponseBody
@RequiresPermissions
(
"cms:category:view"
)
public
ResultData
list
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
)
{
BasicUtil
.
startPage
();
List
categoryList
=
categoryBiz
.
query
(
category
);
...
...
src/main/java/net/mingsoft/cms/action/ContentAction.java
View file @
09ee994b
...
...
@@ -27,11 +27,11 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.base.util.SqlInjectionUtil
;
import
net.mingsoft.basic.annotation.LogAnn
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.constant.e.BusinessTypeEnum
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.base.util.SqlInjectionUtil
;
import
net.mingsoft.basic.util.StringUtil
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
...
...
@@ -45,13 +45,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -219,9 +216,6 @@ public class ContentAction extends BaseAction {
if
(
StringUtil
.
isBlank
(
content
.
getContentDatetime
())){
return
ResultData
.
build
().
error
(
getResString
(
"err.empty"
,
this
.
getResString
(
"content.datetime"
)));
}
if
(!
StringUtil
.
checkLength
(
content
.
getContentUrl
()+
""
,
0
,
200
)){
return
ResultData
.
build
().
error
(
getResString
(
"err.length"
,
this
.
getResString
(
"content.url"
),
"0"
,
"200"
));
}
contentBiz
.
save
(
content
);
return
ResultData
.
build
().
success
(
content
);
}
...
...
@@ -307,9 +301,6 @@ public class ContentAction extends BaseAction {
if
(
StringUtil
.
isBlank
(
content
.
getContentDatetime
())){
return
ResultData
.
build
().
error
(
getResString
(
"err.empty"
,
this
.
getResString
(
"content.datetime"
)));
}
if
(!
StringUtil
.
checkLength
(
content
.
getContentUrl
()+
""
,
0
,
200
)){
return
ResultData
.
build
().
error
(
getResString
(
"err.length"
,
this
.
getResString
(
"content.url"
),
"0"
,
"200"
));
}
contentBiz
.
saveOrUpdate
(
content
);
return
ResultData
.
build
().
success
(
content
);
}
...
...
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
09ee994b
...
...
@@ -250,6 +250,7 @@ public class GeneraterAction extends BaseAction {
}
contentBean
.
setCategoryId
(
category
.
getId
());
contentBean
.
setCategoryType
(
category
.
getCategoryType
());
contentBean
.
setOrderBy
(
"date"
);
//将文章列表标签中的中的参数
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParserAndNotCover
(
contentBean
);
// 分类是列表
...
...
src/main/java/net/mingsoft/cms/action/web/CategoryAction.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
action
.
web
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
* 分类管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api
(
tags
={
"前端-内容模块接口"
})
@Controller
(
"WebcmsCategoryAction"
)
@RequestMapping
(
"/cms/category"
)
public
class
CategoryAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
/**
* 注入分类业务层
*/
@Autowired
private
ICategoryBiz
categoryBiz
;
/**
* 查询分类列表
* @param category 分类实体
*/
@ApiOperation
(
value
=
"查询分类列表接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"categoryTitle"
,
value
=
"栏目管理名称"
,
required
=
false
,
paramType
=
"query"
),
})
@PostMapping
(
value
=
"/list"
)
@ResponseBody
public
ResultData
list
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
)
{
BasicUtil
.
startPage
();
List
categoryList
=
categoryBiz
.
query
(
category
);
return
ResultData
.
build
().
success
(
new
EUListBean
(
categoryList
,(
int
)
BasicUtil
.
endPage
(
categoryList
).
getTotal
()));
}
/**
* 获取分类
* @param category 分类实体
*/
@ApiOperation
(
value
=
"获取分类列表接口"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"/get"
)
@ResponseBody
public
ResultData
get
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
){
if
(
category
.
getId
()==
null
)
{
return
ResultData
.
build
().
error
();
}
CategoryEntity
_category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
category
.
getId
());
return
ResultData
.
build
().
success
(
_category
);
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
action
.
web
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.List
;
/**
* 分类管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api
(
tags
={
"前端-内容模块接口"
})
@Controller
(
"WebcmsCategoryAction"
)
@RequestMapping
(
"/cms/category"
)
public
class
CategoryAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
/**
* 注入分类业务层
*/
@Autowired
private
ICategoryBiz
categoryBiz
;
/**
* 查询分类列表
* @param category 分类实体
*/
@ApiOperation
(
value
=
"查询分类列表接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"categoryTitle"
,
value
=
"栏目管理名称"
,
required
=
false
,
paramType
=
"query"
),
})
@PostMapping
(
value
=
"/list"
)
@ResponseBody
public
ResultData
list
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
)
{
BasicUtil
.
startPage
();
List
categoryList
=
categoryBiz
.
query
(
category
);
return
ResultData
.
build
().
success
(
new
EUListBean
(
categoryList
,(
int
)
BasicUtil
.
endPage
(
categoryList
).
getTotal
()));
}
/**
* 获取分类
* @param category 分类实体
*/
@ApiOperation
(
value
=
"获取分类列表接口"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"/get"
)
@ResponseBody
public
ResultData
get
(
@ModelAttribute
@ApiIgnore
CategoryEntity
category
){
if
(
category
.
getId
()==
null
)
{
return
ResultData
.
build
().
error
();
}
CategoryEntity
_category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
category
.
getId
());
return
ResultData
.
build
().
success
(
_category
);
}
}
src/main/java/net/mingsoft/cms/action/web/ContentAction.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
action
.
web
;
import
cn.hutool.core.util.ObjectUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.biz.IHistoryLogBiz
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.entity.HistoryLogEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.List
;
/**
* 文章管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api
(
tags
={
"前端-内容模块接口"
})
@Controller
(
"WebcmsContentAction"
)
@RequestMapping
(
"/cms/content"
)
public
class
ContentAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
/**
* 注入文章业务层
*/
@Autowired
private
IContentBiz
contentBiz
;
@Autowired
private
IHistoryLogBiz
historyLogBiz
;
/**
* 查询文章列表接口
* @param content 文章
* @return
*/
@ApiOperation
(
value
=
"查询文章列表接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"contentTitle"
,
value
=
"文章标题"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"categoryId"
,
value
=
"所属栏目"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentType"
,
value
=
"文章类型"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentDisplay"
,
value
=
"是否显示"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentAuthor"
,
value
=
"文章作者"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentSource"
,
value
=
"文章来源"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentDatetime"
,
value
=
"发布时间"
,
required
=
false
,
paramType
=
"query"
),
})
@PostMapping
(
"/list"
)
@ResponseBody
public
ResultData
list
(
@ModelAttribute
@ApiIgnore
ContentBean
content
)
{
BasicUtil
.
startPage
();
List
contentList
=
contentBiz
.
query
(
content
);
return
ResultData
.
build
().
success
(
new
EUListBean
(
contentList
,(
int
)
BasicUtil
.
endPage
(
contentList
).
getTotal
()));
}
/**
* 获取文章列表接口
* @param content 文章
* @return
*/
@ApiOperation
(
value
=
"获取文章列表接口"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"/get"
)
@ResponseBody
public
ResultData
get
(
@ModelAttribute
@ApiIgnore
ContentEntity
content
){
if
(
content
.
getId
()==
null
)
{
return
ResultData
.
build
().
error
();
}
ContentEntity
_content
=
(
ContentEntity
)
contentBiz
.
getById
(
content
.
getId
());;
return
ResultData
.
build
().
success
(
_content
);
}
/**
* 查看文章点击数
* @param contentId 文章编号
* @return
*/
@ApiOperation
(
value
=
"查看文章点击数"
)
@ApiImplicitParam
(
name
=
"contentId"
,
value
=
"文章编号"
,
required
=
true
,
paramType
=
"path"
)
@GetMapping
(
value
=
"/{contentId}/hit"
)
@ResponseBody
public
String
hit
(
@PathVariable
@ApiIgnore
String
contentId
)
{
if
(
StringUtils
.
isEmpty
(
contentId
)){
return
"document.write(0)"
;
}
//获取ip
String
ip
=
BasicUtil
.
getIp
();
//获取端口(移动/web..)
boolean
isMobileDevice
=
BasicUtil
.
isMobileDevice
();
ContentEntity
content
=
contentBiz
.
getById
(
contentId
);
if
(
content
==
null
){
return
"document.write(0)"
;
}
//浏览数+1
if
(
ObjectUtil
.
isNotEmpty
(
content
.
getContentHit
())){
content
.
setContentHit
(
content
.
getContentHit
()+
1
);
}
else
{
content
.
setContentHit
(
1
);
}
contentBiz
.
updateEntity
(
content
);
// cms_history 增加相应记录
HistoryLogEntity
entity
=
new
HistoryLogEntity
();
entity
.
setHlIsMobile
(
isMobileDevice
);
entity
.
setHlIp
(
ip
);
entity
.
setContentId
(
content
.
getId
());
entity
.
setCreateDate
(
new
Date
());
historyLogBiz
.
saveEntity
(
entity
);
return
"document.write("
+
content
.
getContentHit
()
+
")"
;
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
action
.
web
;
import
cn.hutool.core.util.ObjectUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.bean.ContentBean
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.biz.IHistoryLogBiz
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.entity.HistoryLogEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.Date
;
import
java.util.List
;
/**
* 文章管理控制层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Api
(
tags
={
"前端-内容模块接口"
})
@Controller
(
"WebcmsContentAction"
)
@RequestMapping
(
"/cms/content"
)
public
class
ContentAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
/**
* 注入文章业务层
*/
@Autowired
private
IContentBiz
contentBiz
;
@Autowired
private
IHistoryLogBiz
historyLogBiz
;
/**
* 查询文章列表接口
* @param content 文章
* @return
*/
@ApiOperation
(
value
=
"查询文章列表接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"contentTitle"
,
value
=
"文章标题"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"categoryId"
,
value
=
"所属栏目"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentType"
,
value
=
"文章类型"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentDisplay"
,
value
=
"是否显示"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentAuthor"
,
value
=
"文章作者"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentSource"
,
value
=
"文章来源"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"contentDatetime"
,
value
=
"发布时间"
,
required
=
false
,
paramType
=
"query"
),
})
@PostMapping
(
"/list"
)
@ResponseBody
public
ResultData
list
(
@ModelAttribute
@ApiIgnore
ContentBean
content
)
{
BasicUtil
.
startPage
();
List
contentList
=
contentBiz
.
query
(
content
);
return
ResultData
.
build
().
success
(
new
EUListBean
(
contentList
,(
int
)
BasicUtil
.
endPage
(
contentList
).
getTotal
()));
}
/**
* 获取文章列表接口
* @param content 文章
* @return
*/
@ApiOperation
(
value
=
"获取文章列表接口"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"编号"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"/get"
)
@ResponseBody
public
ResultData
get
(
@ModelAttribute
@ApiIgnore
ContentEntity
content
){
if
(
content
.
getId
()==
null
)
{
return
ResultData
.
build
().
error
();
}
ContentEntity
_content
=
(
ContentEntity
)
contentBiz
.
getById
(
content
.
getId
());;
return
ResultData
.
build
().
success
(
_content
);
}
/**
* 查看文章点击数
* @param contentId 文章编号
* @return
*/
@ApiOperation
(
value
=
"查看文章点击数"
)
@ApiImplicitParam
(
name
=
"contentId"
,
value
=
"文章编号"
,
required
=
true
,
paramType
=
"path"
)
@GetMapping
(
value
=
"/{contentId}/hit"
)
@ResponseBody
public
String
hit
(
@PathVariable
@ApiIgnore
String
contentId
)
{
if
(
StringUtils
.
isEmpty
(
contentId
)){
return
"document.write(0)"
;
}
//获取ip
String
ip
=
BasicUtil
.
getIp
();
//获取端口(移动/web..)
boolean
isMobileDevice
=
BasicUtil
.
isMobileDevice
();
ContentEntity
content
=
contentBiz
.
getById
(
contentId
);
if
(
content
==
null
){
return
"document.write(0)"
;
}
//浏览数+1
if
(
ObjectUtil
.
isNotEmpty
(
content
.
getContentHit
())){
content
.
setContentHit
(
content
.
getContentHit
()+
1
);
}
else
{
content
.
setContentHit
(
1
);
}
contentBiz
.
updateById
(
content
);
// cms_history 增加相应记录
HistoryLogEntity
entity
=
new
HistoryLogEntity
();
entity
.
setHlIsMobile
(
isMobileDevice
);
entity
.
setHlIp
(
ip
);
entity
.
setContentId
(
content
.
getId
());
entity
.
setCreateDate
(
new
Date
());
historyLogBiz
.
saveEntity
(
entity
);
return
"document.write("
+
content
.
getContentHit
()
+
")"
;
}
}
src/main/java/net/mingsoft/cms/bean/CategoryBean.java
View file @
09ee994b
...
...
@@ -18,33 +18,33 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
bean
;
import
net.mingsoft.cms.entity.CategoryEntity
;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public
class
CategoryBean
extends
CategoryEntity
{
/**
* 文章编号
*/
private
String
articleId
;
public
String
getArticleId
()
{
return
articleId
;
}
public
void
setArticleId
(
String
articleId
)
{
this
.
articleId
=
articleId
;
}
}
package
net
.
mingsoft
.
cms
.
bean
;
import
net.mingsoft.cms.entity.CategoryEntity
;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public
class
CategoryBean
extends
CategoryEntity
{
/**
* 文章编号
*/
private
String
articleId
;
public
String
getArticleId
()
{
return
articleId
;
}
public
void
setArticleId
(
String
articleId
)
{
this
.
articleId
=
articleId
;
}
}
src/main/java/net/mingsoft/cms/bean/ContentBean.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
bean
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 文章实体bean
*/
public
class
ContentBean
extends
ContentEntity
{
// /**
// * 静态化地址
// */
// private String staticUrl;
/**
* 开始时间
*/
private
String
beginTime
;
/**
* 结束时间
*/
private
String
endTime
;
/**
* 属性标记
*/
private
String
flag
;
/**
* 不包含属性标记
*/
private
String
noflag
;
/**
* 栏目类型,用于筛选文章列表
*/
private
String
categoryType
;
/**
* 栏目属性,用于筛选文章列表
*/
private
String
categoryFlag
;
public
String
getCategoryType
()
{
return
categoryType
;
}
public
void
setCategoryType
(
String
categoryType
)
{
this
.
categoryType
=
categoryType
;
}
public
String
getCategoryFlag
()
{
return
categoryFlag
;
}
public
void
setCategoryFlag
(
String
categoryFlag
)
{
this
.
categoryFlag
=
categoryFlag
;
}
public
String
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
String
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
String
getNoflag
()
{
return
noflag
;
}
public
void
setNoflag
(
String
noflag
)
{
this
.
noflag
=
noflag
;
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
bean
;
import
net.mingsoft.cms.entity.ContentEntity
;
/**
* 文章实体bean
*/
public
class
ContentBean
extends
ContentEntity
{
// /**
// * 静态化地址
// */
// private String staticUrl;
/**
* 开始时间
*/
private
String
beginTime
;
/**
* 结束时间
*/
private
String
endTime
;
/**
* 属性标记
*/
private
String
flag
;
/**
* 不包含属性标记
*/
private
String
noflag
;
/**
* 栏目类型,用于筛选文章列表
*/
private
String
categoryType
;
/**
* 栏目属性,用于筛选文章列表
*/
private
String
categoryFlag
;
public
String
getCategoryType
()
{
return
categoryType
;
}
public
void
setCategoryType
(
String
categoryType
)
{
this
.
categoryType
=
categoryType
;
}
public
String
getCategoryFlag
()
{
return
categoryFlag
;
}
public
void
setCategoryFlag
(
String
categoryFlag
)
{
this
.
categoryFlag
=
categoryFlag
;
}
public
String
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
String
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
String
getNoflag
()
{
return
noflag
;
}
public
void
setNoflag
(
String
noflag
)
{
this
.
noflag
=
noflag
;
}
}
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
View file @
09ee994b
...
...
@@ -18,44 +18,44 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
biz
;
import
net.mingsoft.base.biz.IBaseBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
java.util.List
;
/**
* 分类业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public
interface
ICategoryBiz
extends
IBaseBiz
<
CategoryEntity
>
{
/**
* 查询当前分类下的所有子分类,包含自身
* @param category 通过setId指定栏目id
* @return
*/
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
);
void
saveEntity
(
CategoryEntity
entity
);
/**更新父级及子集
* @param entity
*/
void
updateEntity
(
CategoryEntity
entity
);
/**只更新自身
* @param entity
*/
void
update
(
CategoryEntity
entity
);
void
delete
(
String
categoryId
);
void
copyCategory
(
CategoryEntity
entity
);
}
package
net
.
mingsoft
.
cms
.
biz
;
import
net.mingsoft.base.biz.IBaseBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
java.util.List
;
/**
* 分类业务
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
public
interface
ICategoryBiz
extends
IBaseBiz
<
CategoryEntity
>
{
/**
* 查询当前分类下的所有子分类,包含自身
* @param category 通过setId指定栏目id
* @return
*/
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
);
void
saveEntity
(
CategoryEntity
entity
);
/**更新父级及子集
* @param entity
*/
void
updateEntity
(
CategoryEntity
entity
);
/**只更新自身
* @param entity
*/
void
update
(
CategoryEntity
entity
);
void
delete
(
String
categoryId
);
void
copyCategory
(
CategoryEntity
entity
);
}
src/main/java/net/mingsoft/cms/biz/IHistoryLogBiz.java
View file @
09ee994b
...
...
@@ -18,19 +18,19 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
biz
;
import
net.mingsoft.base.biz.IBaseBiz
;
/**
* 文章浏览记录业务
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
interface
IHistoryLogBiz
extends
IBaseBiz
{
}
package
net
.
mingsoft
.
cms
.
biz
;
import
net.mingsoft.base.biz.IBaseBiz
;
/**
* 文章浏览记录业务
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
interface
IHistoryLogBiz
extends
IBaseBiz
{
}
src/main/java/net/mingsoft/cms/biz/impl/CategoryBizImpl.java
View file @
09ee994b
...
...
@@ -18,301 +18,301 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
biz
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
net.mingsoft.base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.dao.ICategoryDao
;
import
net.mingsoft.cms.dao.IContentDao
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 分类管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service
(
"cmscategoryBizImpl"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
class
CategoryBizImpl
extends
BaseBizImpl
<
ICategoryDao
,
CategoryEntity
>
implements
ICategoryBiz
{
@Autowired
private
ICategoryDao
categoryDao
;
@Autowired
private
IContentDao
contentDao
;
@Override
protected
IBaseDao
getDao
()
{
// TODO Auto-generated method stub
return
categoryDao
;
}
@Override
public
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
)
{
// TODO Auto-generated method stub
return
categoryDao
.
queryChildren
(
category
);
}
@Override
public
void
saveEntity
(
CategoryEntity
categoryEntity
)
{
// TODO Auto-generated method stub
String
pingYin
=
PinYinUtil
.
getPingYin
(
categoryEntity
.
getCategoryTitle
());
//如果用户自己填入了拼音则使用用户的
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryPinyin
()))
{
pingYin
=
categoryEntity
.
getCategoryPinyin
();
}
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryPinyin
(
pingYin
);
Object
categoryBizEntity
=
getEntity
(
category
);
setParentId
(
categoryEntity
);
categoryEntity
.
setCategoryPinyin
(
pingYin
);
//更新新的父级
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryId
())
&&
!
"0"
.
equals
(
categoryEntity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
categoryEntity
.
getCategoryId
());
//如果之前是叶子节点就更新
if
(
parent
.
getLeaf
())
{
parent
.
setLeaf
(
false
);
updateById
(
parent
);
}
}
categoryEntity
.
setLeaf
(
false
);
//如果是新增栏目一定是叶子节点
if
(
StrUtil
.
isEmpty
(
categoryEntity
.
getId
()))
{
categoryEntity
.
setLeaf
(
true
);
}
super
.
save
(
categoryEntity
);
//拼音存在则拼接id
if
(
categoryBizEntity
!=
null
)
{
categoryEntity
.
setCategoryPinyin
(
pingYin
+
categoryEntity
.
getId
());
}
CategoryEntity
parentCategory
=
null
;
if
(
StringUtils
.
isNotBlank
(
categoryEntity
.
getCategoryId
()))
{
parentCategory
=
(
CategoryEntity
)
getById
(
categoryEntity
.
getCategoryId
());
}
//保存链接地址
String
path
=
ObjectUtil
.
isNotNull
(
parentCategory
)
?
parentCategory
.
getCategoryPath
()
:
""
;
categoryEntity
.
setCategoryPath
(
path
+
"/"
+
categoryEntity
.
getCategoryPinyin
());
setTopId
(
categoryEntity
);
super
.
updateById
(
categoryEntity
);
}
private
void
setParentId
(
CategoryEntity
categoryEntity
)
{
String
path
=
""
;
if
(
StringUtils
.
isNotEmpty
(
categoryEntity
.
getCategoryId
())
&&
Long
.
parseLong
(
categoryEntity
.
getCategoryId
())
>
0
)
{
CategoryEntity
category
=
(
CategoryEntity
)
getById
(
categoryEntity
.
getCategoryId
());
path
=
category
.
getCategoryPath
();
if
(
StringUtils
.
isEmpty
(
category
.
getCategoryParentIds
()))
{
categoryEntity
.
setCategoryParentIds
(
category
.
getId
());
}
else
{
categoryEntity
.
setCategoryParentIds
(
category
.
getCategoryParentIds
()
+
","
+
category
.
getId
());
}
}
else
{
categoryEntity
.
setCategoryParentIds
(
null
);
}
//保存时先保存再修改链接地址,修改时直接修改
if
(
StringUtils
.
isNotBlank
(
categoryEntity
.
getId
()))
{
categoryEntity
.
setCategoryPath
(
path
+
"/"
+
categoryEntity
.
getCategoryPinyin
());
}
}
private
void
setChildParentId
(
CategoryEntity
categoryEntity
,
String
topId
)
{
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryId
(
categoryEntity
.
getId
());
List
<
CategoryEntity
>
list
=
categoryDao
.
query
(
category
);
list
.
forEach
(
x
->
{
if
(
StringUtils
.
isEmpty
(
categoryEntity
.
getCategoryParentIds
()))
{
x
.
setCategoryParentIds
(
categoryEntity
.
getId
());
}
else
{
x
.
setCategoryParentIds
(
categoryEntity
.
getCategoryParentIds
()
+
","
+
categoryEntity
.
getId
());
}
//更新topid
x
.
setTopId
(
topId
);
String
path
=
categoryEntity
.
getCategoryPath
();
//判断是否有parentIds
x
.
setCategoryPath
(
path
+
"/"
+
x
.
getCategoryPinyin
());
//去除多余的/符号
super
.
updateEntity
(
x
);
setChildParentId
(
x
,
topId
);
});
}
@Override
public
void
updateEntity
(
CategoryEntity
entity
)
{
setParentId
(
entity
);
String
pingYin
=
entity
.
getCategoryPinyin
();
if
(
StrUtil
.
isNotBlank
(
pingYin
))
{
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryPinyin
(
pingYin
);
CategoryEntity
categoryBizEntity
=
(
CategoryEntity
)
getEntity
(
category
);
//拼音存在则拼接id
if
(
categoryBizEntity
!=
null
&&
!
categoryBizEntity
.
getId
().
equals
(
entity
.
getId
()))
{
entity
.
setCategoryPinyin
(
pingYin
+
entity
.
getId
());
}
}
setParentLeaf
(
entity
);
setTopId
(
entity
);
//如果父级栏目和父级id为空字符串则转化成null
if
(
StringUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
entity
.
setCategoryId
(
null
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getCategoryParentIds
()))
{
entity
.
setCategoryParentIds
(
null
);
}
categoryDao
.
updateEntity
(
entity
);
//更新子节点所有父节点id和topid
//如果本节点的topid为0(顶级栏目),则把自身的id作为子栏目的topid,非0所有的子栏目和本栏目使用同一个topid
String
topId
=
entity
.
getTopId
();
if
(
topId
.
equals
(
"0"
))
{
topId
=
entity
.
getId
();
}
setChildParentId
(
entity
,
topId
);
}
@Override
public
void
update
(
CategoryEntity
entity
)
{
super
.
updateEntity
(
entity
);
}
@Override
public
void
delete
(
String
categoryId
)
{
// TODO Auto-generated method stub
CategoryEntity
category
=
(
CategoryEntity
)
categoryDao
.
selectById
(
categoryId
);
//删除父类
if
(
category
!=
null
)
{
List
<
CategoryEntity
>
childrenList
=
categoryDao
.
queryChildren
(
category
);
List
<
String
>
ids
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
childrenList
.
size
();
i
++)
{
//删除子类
ids
.
add
(
childrenList
.
get
(
i
).
getId
());
}
categoryDao
.
deleteBatchIds
(
ids
);
// 删除文章
contentDao
.
deleteEntityByCategoryIds
(
ids
.
toArray
(
new
String
[
ids
.
size
()]));
//获取被删节点的父节点
CategoryEntity
parentNode
=
categoryDao
.
selectById
(
category
.
getCategoryId
());
//获取被删节点的所属栏目的其他节点
List
<
CategoryEntity
>
childNode
=
categoryDao
.
queryChildren
(
parentNode
);
//判断删除的是否为主节点
if
(
parentNode
!=
null
)
{
UpdateWrapper
<
CategoryEntity
>
updateWrapper
=
new
UpdateWrapper
<>();
//如果没有子节点进行更新代码
if
(
childNode
.
size
()
==
1
)
{
updateWrapper
.
eq
(
"id"
,
parentNode
.
getId
()).
set
(
"leaf"
,
1
);
categoryDao
.
update
(
null
,
updateWrapper
);
}
}
}
}
/**
* 设置父级叶子节点
* @param entity
*/
private
void
setParentLeaf
(
CategoryEntity
entity
)
{
CategoryEntity
categoryEntity
=
getById
(
entity
.
getId
());
//如果父级不为空并且修改了父级则需要更新父级
if
(
entity
.
getCategoryId
()
!=
null
&&
!
entity
.
getCategoryId
().
equals
(
categoryEntity
.
getCategoryId
()))
{
//更新旧的父级
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryId
())
&&
!
"0"
.
equals
(
categoryEntity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
categoryEntity
.
getCategoryId
());
//如果修改了父级则需要判断父级是否还有子节点
boolean
leaf
=
parent
.
getLeaf
();
//查找不等于当前更新的分类子集,有则不是叶子节点
QueryWrapper
<
CategoryEntity
>
queryWrapper
=
new
QueryWrapper
<>();
parent
.
setLeaf
(
count
(
queryWrapper
.
eq
(
"category_id"
,
parent
.
getId
()).
ne
(
"id"
,
entity
.
getId
()))
==
0
);
if
(
leaf
!=
parent
.
getLeaf
())
{
updateById
(
parent
);
}
}
//更新新的父级
if
(
StrUtil
.
isNotBlank
(
entity
.
getCategoryId
())
&&
!
"0"
.
equals
(
entity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
entity
.
getCategoryId
());
//如果之前是叶子节点就更新
if
(
parent
.
getLeaf
())
{
parent
.
setLeaf
(
false
);
updateById
(
parent
);
}
}
}
}
/**
* 设置顶级id
* @param entity
*/
private
void
setTopId
(
CategoryEntity
entity
)
{
String
categoryParentId
=
entity
.
getCategoryParentIds
();
if
(
StrUtil
.
isNotBlank
(
categoryParentId
))
{
String
[]
ids
=
categoryParentId
.
split
(
","
);
//如果有ParentId就取第一个
if
(
ids
.
length
>
0
)
{
entity
.
setTopId
(
ids
[
0
]);
return
;
}
}
entity
.
setTopId
(
"0"
);
}
@Override
public
void
copyCategory
(
CategoryEntity
category
)
{
String
oldId
=
category
.
getId
();
//先保存被复制第一层栏目,因为第一层栏目不需要变更父级栏目
category
=
getById
(
oldId
);
//id、拼音和路径按照原来的业务逻辑生成
category
.
setId
(
null
);
category
.
setCategoryPinyin
(
null
);
category
.
setCategoryPath
(
null
);
saveEntity
(
category
);
//传入简要被复制子栏目的id和复制后的生成的id,复制的子栏目全部使用
recursionCopyChilds
(
oldId
,
category
.
getId
());
}
/*
* 递归复制子栏目
* @param oldParentId:被复制的父级栏目id(需要数据库原来存在该数据)
* @param newParentId:复制栏目后新父级的id(新插入数据的id)
* */
private
void
recursionCopyChilds
(
String
oldParentId
,
String
newParentId
)
{
CategoryEntity
_category
=
new
CategoryEntity
();
_category
.
setCategoryId
(
oldParentId
);
List
<
CategoryEntity
>
childs
=
query
(
_category
);
for
(
CategoryEntity
child
:
childs
)
{
String
childId
=
child
.
getId
();
//id、拼音和路径按照原来的业务逻辑生成
child
.
setId
(
null
);
child
.
setCategoryPinyin
(
null
);
child
.
setCategoryPath
(
null
);
child
.
setCategoryId
(
newParentId
);
saveEntity
(
child
);
//如果该栏目下还有子栏目则继续复制该栏目里的子栏目
recursionCopyChilds
(
childId
,
child
.
getId
());
}
}
}
package
net
.
mingsoft
.
cms
.
biz
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
net.mingsoft.base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.basic.util.PinYinUtil
;
import
net.mingsoft.cms.biz.ICategoryBiz
;
import
net.mingsoft.cms.dao.ICategoryDao
;
import
net.mingsoft.cms.dao.IContentDao
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 分类管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Service
(
"cmscategoryBizImpl"
)
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
class
CategoryBizImpl
extends
BaseBizImpl
<
ICategoryDao
,
CategoryEntity
>
implements
ICategoryBiz
{
@Autowired
private
ICategoryDao
categoryDao
;
@Autowired
private
IContentDao
contentDao
;
@Override
protected
IBaseDao
getDao
()
{
// TODO Auto-generated method stub
return
categoryDao
;
}
@Override
public
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
)
{
// TODO Auto-generated method stub
return
categoryDao
.
queryChildren
(
category
);
}
@Override
public
void
saveEntity
(
CategoryEntity
categoryEntity
)
{
// TODO Auto-generated method stub
String
pingYin
=
PinYinUtil
.
getPingYin
(
categoryEntity
.
getCategoryTitle
());
//如果用户自己填入了拼音则使用用户的
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryPinyin
()))
{
pingYin
=
categoryEntity
.
getCategoryPinyin
();
}
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryPinyin
(
pingYin
);
Object
categoryBizEntity
=
getEntity
(
category
);
setParentId
(
categoryEntity
);
categoryEntity
.
setCategoryPinyin
(
pingYin
);
//更新新的父级
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryId
())
&&
!
"0"
.
equals
(
categoryEntity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
categoryEntity
.
getCategoryId
());
//如果之前是叶子节点就更新
if
(
parent
.
getLeaf
())
{
parent
.
setLeaf
(
false
);
updateById
(
parent
);
}
}
categoryEntity
.
setLeaf
(
false
);
//如果是新增栏目一定是叶子节点
if
(
StrUtil
.
isEmpty
(
categoryEntity
.
getId
()))
{
categoryEntity
.
setLeaf
(
true
);
}
super
.
save
(
categoryEntity
);
//拼音存在则拼接id
if
(
categoryBizEntity
!=
null
)
{
categoryEntity
.
setCategoryPinyin
(
pingYin
+
categoryEntity
.
getId
());
}
CategoryEntity
parentCategory
=
null
;
if
(
StringUtils
.
isNotBlank
(
categoryEntity
.
getCategoryId
()))
{
parentCategory
=
(
CategoryEntity
)
getById
(
categoryEntity
.
getCategoryId
());
}
//保存链接地址
String
path
=
ObjectUtil
.
isNotNull
(
parentCategory
)
?
parentCategory
.
getCategoryPath
()
:
""
;
categoryEntity
.
setCategoryPath
(
path
+
"/"
+
categoryEntity
.
getCategoryPinyin
());
setTopId
(
categoryEntity
);
super
.
updateById
(
categoryEntity
);
}
private
void
setParentId
(
CategoryEntity
categoryEntity
)
{
String
path
=
""
;
if
(
StringUtils
.
isNotEmpty
(
categoryEntity
.
getCategoryId
())
&&
Long
.
parseLong
(
categoryEntity
.
getCategoryId
())
>
0
)
{
CategoryEntity
category
=
(
CategoryEntity
)
getById
(
categoryEntity
.
getCategoryId
());
path
=
category
.
getCategoryPath
();
if
(
StringUtils
.
isEmpty
(
category
.
getCategoryParentIds
()))
{
categoryEntity
.
setCategoryParentIds
(
category
.
getId
());
}
else
{
categoryEntity
.
setCategoryParentIds
(
category
.
getCategoryParentIds
()
+
","
+
category
.
getId
());
}
}
else
{
categoryEntity
.
setCategoryParentIds
(
null
);
}
//保存时先保存再修改链接地址,修改时直接修改
if
(
StringUtils
.
isNotBlank
(
categoryEntity
.
getId
()))
{
categoryEntity
.
setCategoryPath
(
path
+
"/"
+
categoryEntity
.
getCategoryPinyin
());
}
}
private
void
setChildParentId
(
CategoryEntity
categoryEntity
,
String
topId
)
{
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryId
(
categoryEntity
.
getId
());
List
<
CategoryEntity
>
list
=
categoryDao
.
query
(
category
);
list
.
forEach
(
x
->
{
if
(
StringUtils
.
isEmpty
(
categoryEntity
.
getCategoryParentIds
()))
{
x
.
setCategoryParentIds
(
categoryEntity
.
getId
());
}
else
{
x
.
setCategoryParentIds
(
categoryEntity
.
getCategoryParentIds
()
+
","
+
categoryEntity
.
getId
());
}
//更新topid
x
.
setTopId
(
topId
);
String
path
=
categoryEntity
.
getCategoryPath
();
//判断是否有parentIds
x
.
setCategoryPath
(
path
+
"/"
+
x
.
getCategoryPinyin
());
//去除多余的/符号
super
.
updateEntity
(
x
);
setChildParentId
(
x
,
topId
);
});
}
@Override
public
void
updateEntity
(
CategoryEntity
entity
)
{
setParentId
(
entity
);
String
pingYin
=
entity
.
getCategoryPinyin
();
if
(
StrUtil
.
isNotBlank
(
pingYin
))
{
CategoryEntity
category
=
new
CategoryEntity
();
category
.
setCategoryPinyin
(
pingYin
);
CategoryEntity
categoryBizEntity
=
(
CategoryEntity
)
getEntity
(
category
);
//拼音存在则拼接id
if
(
categoryBizEntity
!=
null
&&
!
categoryBizEntity
.
getId
().
equals
(
entity
.
getId
()))
{
entity
.
setCategoryPinyin
(
pingYin
+
entity
.
getId
());
}
}
setParentLeaf
(
entity
);
setTopId
(
entity
);
//如果父级栏目和父级id为空字符串则转化成null
if
(
StringUtils
.
isEmpty
(
entity
.
getCategoryId
()))
{
entity
.
setCategoryId
(
null
);
}
if
(
StringUtils
.
isEmpty
(
entity
.
getCategoryParentIds
()))
{
entity
.
setCategoryParentIds
(
null
);
}
categoryDao
.
updateEntity
(
entity
);
//更新子节点所有父节点id和topid
//如果本节点的topid为0(顶级栏目),则把自身的id作为子栏目的topid,非0所有的子栏目和本栏目使用同一个topid
String
topId
=
entity
.
getTopId
();
if
(
topId
.
equals
(
"0"
))
{
topId
=
entity
.
getId
();
}
setChildParentId
(
entity
,
topId
);
}
@Override
public
void
update
(
CategoryEntity
entity
)
{
super
.
updateEntity
(
entity
);
}
@Override
public
void
delete
(
String
categoryId
)
{
// TODO Auto-generated method stub
CategoryEntity
category
=
(
CategoryEntity
)
categoryDao
.
selectById
(
categoryId
);
//删除父类
if
(
category
!=
null
)
{
List
<
CategoryEntity
>
childrenList
=
categoryDao
.
queryChildren
(
category
);
List
<
String
>
ids
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
childrenList
.
size
();
i
++)
{
//删除子类
ids
.
add
(
childrenList
.
get
(
i
).
getId
());
}
categoryDao
.
deleteBatchIds
(
ids
);
// 删除文章
contentDao
.
deleteEntityByCategoryIds
(
ids
.
toArray
(
new
String
[
ids
.
size
()]));
//获取被删节点的父节点
CategoryEntity
parentNode
=
categoryDao
.
selectById
(
category
.
getCategoryId
());
//获取被删节点的所属栏目的其他节点
List
<
CategoryEntity
>
childNode
=
categoryDao
.
queryChildren
(
parentNode
);
//判断删除的是否为主节点
if
(
parentNode
!=
null
)
{
UpdateWrapper
<
CategoryEntity
>
updateWrapper
=
new
UpdateWrapper
<>();
//如果没有子节点进行更新代码
if
(
childNode
.
size
()
==
1
)
{
updateWrapper
.
eq
(
"id"
,
parentNode
.
getId
()).
set
(
"leaf"
,
1
);
categoryDao
.
update
(
null
,
updateWrapper
);
}
}
}
}
/**
* 设置父级叶子节点
* @param entity
*/
private
void
setParentLeaf
(
CategoryEntity
entity
)
{
CategoryEntity
categoryEntity
=
getById
(
entity
.
getId
());
//如果父级不为空并且修改了父级则需要更新父级
if
(
entity
.
getCategoryId
()
!=
null
&&
!
entity
.
getCategoryId
().
equals
(
categoryEntity
.
getCategoryId
()))
{
//更新旧的父级
if
(
StrUtil
.
isNotBlank
(
categoryEntity
.
getCategoryId
())
&&
!
"0"
.
equals
(
categoryEntity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
categoryEntity
.
getCategoryId
());
//如果修改了父级则需要判断父级是否还有子节点
boolean
leaf
=
parent
.
getLeaf
();
//查找不等于当前更新的分类子集,有则不是叶子节点
QueryWrapper
<
CategoryEntity
>
queryWrapper
=
new
QueryWrapper
<>();
parent
.
setLeaf
(
count
(
queryWrapper
.
eq
(
"category_id"
,
parent
.
getId
()).
ne
(
"id"
,
entity
.
getId
()))
==
0
);
if
(
leaf
!=
parent
.
getLeaf
())
{
updateById
(
parent
);
}
}
//更新新的父级
if
(
StrUtil
.
isNotBlank
(
entity
.
getCategoryId
())
&&
!
"0"
.
equals
(
entity
.
getCategoryId
()))
{
CategoryEntity
parent
=
getById
(
entity
.
getCategoryId
());
//如果之前是叶子节点就更新
if
(
parent
.
getLeaf
())
{
parent
.
setLeaf
(
false
);
updateById
(
parent
);
}
}
}
}
/**
* 设置顶级id
* @param entity
*/
private
void
setTopId
(
CategoryEntity
entity
)
{
String
categoryParentId
=
entity
.
getCategoryParentIds
();
if
(
StrUtil
.
isNotBlank
(
categoryParentId
))
{
String
[]
ids
=
categoryParentId
.
split
(
","
);
//如果有ParentId就取第一个
if
(
ids
.
length
>
0
)
{
entity
.
setTopId
(
ids
[
0
]);
return
;
}
}
entity
.
setTopId
(
"0"
);
}
@Override
public
void
copyCategory
(
CategoryEntity
category
)
{
String
oldId
=
category
.
getId
();
//先保存被复制第一层栏目,因为第一层栏目不需要变更父级栏目
category
=
getById
(
oldId
);
//id、拼音和路径按照原来的业务逻辑生成
category
.
setId
(
null
);
category
.
setCategoryPinyin
(
null
);
category
.
setCategoryPath
(
null
);
saveEntity
(
category
);
//传入简要被复制子栏目的id和复制后的生成的id,复制的子栏目全部使用
recursionCopyChilds
(
oldId
,
category
.
getId
());
}
/*
* 递归复制子栏目
* @param oldParentId:被复制的父级栏目id(需要数据库原来存在该数据)
* @param newParentId:复制栏目后新父级的id(新插入数据的id)
* */
private
void
recursionCopyChilds
(
String
oldParentId
,
String
newParentId
)
{
CategoryEntity
_category
=
new
CategoryEntity
();
_category
.
setCategoryId
(
oldParentId
);
List
<
CategoryEntity
>
childs
=
query
(
_category
);
for
(
CategoryEntity
child
:
childs
)
{
String
childId
=
child
.
getId
();
//id、拼音和路径按照原来的业务逻辑生成
child
.
setId
(
null
);
child
.
setCategoryPinyin
(
null
);
child
.
setCategoryPath
(
null
);
child
.
setCategoryId
(
newParentId
);
saveEntity
(
child
);
//如果该栏目下还有子栏目则继续复制该栏目里的子栏目
recursionCopyChilds
(
childId
,
child
.
getId
());
}
}
}
src/main/java/net/mingsoft/cms/biz/impl/HistoryLogBizImpl.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
biz
.
impl
;
import
net.mingsoft.
cms.biz.IHistoryLogBiz
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
net.mingsoft.
base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.cms.dao.ICmsHistoryLogDao
;
/**
* 文章浏览记录管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
@Service
(
"cmshistoryLogBizImpl"
)
public
class
HistoryLogBizImpl
extends
BaseBizImpl
implements
IHistoryLogBiz
{
@Autowired
private
ICmsHistoryLogDao
historyLogDao
;
@Override
protected
IBaseDao
getDao
()
{
// TODO Auto-generated method stub
return
historyLogDao
;
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
biz
.
impl
;
import
net.mingsoft.
base.biz.impl.BaseBizImpl
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.cms.biz.IHistoryLogBiz
;
import
net.mingsoft.
cms.dao.ICmsHistoryLogDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 文章浏览记录管理持久化层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
@Service
(
"cmshistoryLogBizImpl"
)
public
class
HistoryLogBizImpl
extends
BaseBizImpl
implements
IHistoryLogBiz
{
@Autowired
private
ICmsHistoryLogDao
historyLogDao
;
@Override
protected
IBaseDao
getDao
()
{
// TODO Auto-generated method stub
return
historyLogDao
;
}
}
src/main/java/net/mingsoft/cms/constant/Const.java
View file @
09ee994b
...
...
@@ -18,17 +18,17 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
constant
;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:51
*/
public
class
Const
{
/**
* 资源文件
*/
public
final
static
String
RESOURCES
=
"net.mingsoft.cms.resources.resources"
;
}
package
net
.
mingsoft
.
cms
.
constant
;
/**
* @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:51
*/
public
class
Const
{
/**
* 资源文件
*/
public
final
static
String
RESOURCES
=
"net.mingsoft.cms.resources.resources"
;
}
src/main/java/net/mingsoft/cms/dao/ICategoryDao.java
View file @
09ee994b
...
...
@@ -18,30 +18,30 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
dao
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component
(
"cmsCategoryDao"
)
public
interface
ICategoryDao
extends
IBaseDao
<
CategoryEntity
>
{
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
);
}
package
net
.
mingsoft
.
cms
.
dao
;
import
net.mingsoft.base.dao.IBaseDao
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 分类持久层
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@Component
(
"cmsCategoryDao"
)
public
interface
ICategoryDao
extends
IBaseDao
<
CategoryEntity
>
{
/**
* 查询当前分类下面的所有子分类
* @param category 必须存在categoryId categoryParentId
* @return
*/
public
List
<
CategoryEntity
>
queryChildren
(
CategoryEntity
category
);
}
src/main/java/net/mingsoft/cms/dao/ICmsHistoryLogDao.java
View file @
09ee994b
...
...
@@ -18,17 +18,17 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
dao
;
import
net.mingsoft.base.dao.IBaseDao
;
/**
* 文章浏览记录持久层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
interface
ICmsHistoryLogDao
extends
IBaseDao
{
}
package
net
.
mingsoft
.
cms
.
dao
;
import
net.mingsoft.base.dao.IBaseDao
;
/**
* 文章浏览记录持久层
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
interface
ICmsHistoryLogDao
extends
IBaseDao
{
}
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
View file @
09ee994b
...
...
@@ -16,7 +16,7 @@
<result
column=
"content_description"
property=
"contentDescription"
/>
<!--描述 -->
<result
column=
"content_keyword"
property=
"contentKeyword"
/>
<!--关键字 -->
<result
column=
"content_details"
property=
"contentDetails"
/>
<!--文章内容 -->
<result
column=
"content_
url"
property=
"contentUrl
"
/>
<!--文章跳转链接地址 -->
<result
column=
"content_
out_link"
property=
"contentOutLink
"
/>
<!--文章跳转链接地址 -->
<result
column=
"content_hit"
property=
"contentHit"
/>
<!--点击次数 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
<result
column=
"create_date"
property=
"createDate"
/>
<!--创建时间 -->
...
...
@@ -39,7 +39,7 @@
<result
column=
"content_description"
property=
"contentDescription"
/>
<!--描述 -->
<result
column=
"content_keyword"
property=
"contentKeyword"
/>
<!--关键字 -->
<result
column=
"content_details"
property=
"contentDetails"
/>
<!--文章内容 -->
<result
column=
"content_
url"
property=
"contentUrl
"
/>
<!--文章跳转链接地址 -->
<result
column=
"content_
out_link"
property=
"contentOutLink
"
/>
<!--文章跳转链接地址 -->
<!-- <result column="static_url" property="staticUrl" /><!–静态地址 –>-->
<result
column=
"content_hit"
property=
"contentHit"
/>
<!--点击次数 -->
<result
column=
"create_by"
property=
"createBy"
/>
<!--创建人 -->
...
...
@@ -91,7 +91,7 @@
<if
test=
"contentDescription != null and contentDescription != ''"
>
content_description,
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
content_keyword,
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
content_details,
</if>
<if
test=
"content
Url != null and contentUrl != ''"
>
content_url
,
</if>
<if
test=
"content
OutLink != null and contentOutLink != ''"
>
content_out_link
,
</if>
<if
test=
"contentHit != null"
>
content_hit,
</if>
<if
test=
"createBy > 0"
>
create_by,
</if>
<if
test=
"createDate != null"
>
create_date,
</if>
...
...
@@ -138,7 +138,7 @@
<if
test=
"contentDescription != null "
>
content_description=#{contentDescription},
</if>
<if
test=
"contentKeyword != null "
>
content_keyword=#{contentKeyword},
</if>
<if
test=
"contentDetails != null "
>
content_details=#{contentDetails},
</if>
<if
test=
"content
Url != null and contentUrl != ''"
>
content_url=#{contentUrl
},
</if>
<if
test=
"content
OutLink != null and contentOutLink != ''"
>
content_out_link=#{contentOutLink
},
</if>
<if
test=
"contentHit != null"
>
content_hit=#{contentHit},
</if>
<if
test=
"createBy > 0"
>
create_by=#{createBy},
</if>
<if
test=
"createDate != null"
>
create_date=#{createDate},
</if>
...
...
@@ -171,7 +171,7 @@
<if
test=
"contentDescription != null and contentDescription != ''"
>
and content_description=#{contentDescription}
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
and content_keyword=#{contentKeyword}
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
and content_details=#{contentDetails}
</if>
<if
test=
"content
Url != null and contentUrl != ''"
>
and content_url=#{contentUrl
}
</if>
<if
test=
"content
OutLink != null and contentOutLink != ''"
>
and content_out_link=#{contentOutLink
}
</if>
<if
test=
"contentHit != null"
>
and content_hit=#{contentHit}
</if>
<if
test=
"createBy > 0"
>
and create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and create_date=#{createDate}
</if>
...
...
@@ -236,7 +236,7 @@
<if
test=
"contentDescription != null and contentDescription != ''"
>
and content_description=#{contentDescription}
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
and content_keyword=#{contentKeyword}
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
and content_details=#{contentDetails}
</if>
<if
test=
"content
Url != null and contentUrl != ''"
>
and content_url=#{contentUrl
}
</if>
<if
test=
"content
OutLink != null and contentOutLink != ''"
>
and content_out_link=#{contentOutLink
}
</if>
<if
test=
"contentHit != null"
>
and content_hit=#{contentHit}
</if>
<if
test=
"createBy > 0"
>
and ct.create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and ct.create_date=#{createDate}
</if>
...
...
@@ -273,7 +273,7 @@
<if
test=
"contentDescription != null and contentDescription != ''"
>
and content_description=#{contentDescription}
</if>
<if
test=
"contentKeyword != null and contentKeyword != ''"
>
and content_keyword=#{contentKeyword}
</if>
<if
test=
"contentDetails != null and contentDetails != ''"
>
and content_details=#{contentDetails}
</if>
<if
test=
"content
Url != null and contentUrl != ''"
>
and content_url=#{contentUrl
}
</if>
<if
test=
"content
OutLink != null and contentOutLink != ''"
>
and content_out_link=#{contentOutLink
}
</if>
<if
test=
"contentHit != null"
>
and content_hit=#{contentHit}
</if>
<if
test=
"createBy > 0"
>
and ct.create_by=#{createBy}
</if>
<if
test=
"createDate != null"
>
and ct.create_date=#{createDate}
</if>
...
...
@@ -287,10 +287,10 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select
id=
"queryIdsByCategoryIdForParser"
resultMap=
"resultBean"
>
select
ct.id article_id,c.*
ct.id article_id,c
t.content_img litpic,c
.*
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0
where ct.del=0
and ct.content_display=0
<!-- 查询子栏目数据 -->
<if
test=
"categoryId!=null and categoryId!='' and categoryType==1"
>
...
...
@@ -345,7 +345,7 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合,不包括单篇 -->
<select
id=
"queryIdsByCategoryIdForParserAndNotCover"
resultMap=
"resultBean"
>
select
ct.id article_id,c.*
ct.id article_id,c
t.content_img litpic,c
.*
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0
...
...
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java
View file @
09ee994b
...
...
@@ -22,11 +22,7 @@
package
net
.
mingsoft
.
cms
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldStrategy
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.*
;
import
net.mingsoft.base.entity.BaseEntity
;
/**
...
...
src/main/java/net/mingsoft/cms/entity/ContentEntity.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@TableName
(
"cms_content"
)
public
class
ContentEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1574925152617L
;
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* 文章标题
*/
private
String
contentTitle
;
/**
* 所属栏目
*/
private
String
categoryId
;
/**
* 文章类型
*/
private
String
contentType
;
/**
* 是否显示
*/
private
String
contentDisplay
;
/**
* 文章作者
*/
private
String
contentAuthor
;
/**
* 文章来源
*/
private
String
contentSource
;
/**
* 发布时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
contentDatetime
;
/**
* 自定义顺序
*/
private
Integer
contentSort
;
/**
* 文章缩略图
*/
private
String
contentImg
;
/**
* 描述
*/
private
String
contentDescription
;
/**
* 关键字
*/
private
String
contentKeyword
;
/**
* 文章内容
*/
private
String
contentDetails
;
/**
* 文章跳转链接地址
*/
private
String
contentUrl
;
/**
* 点击次数
*/
private
Integer
contentHit
;
public
Integer
getContentHit
()
{
return
contentHit
;
}
public
void
setContentHit
(
Integer
contentHit
)
{
this
.
contentHit
=
contentHit
;
}
/**
* 设置文章标题
*/
public
void
setContentTitle
(
String
contentTitle
)
{
this
.
contentTitle
=
contentTitle
;
}
/**
* 获取文章标题
*/
public
String
getContentTitle
()
{
return
this
.
contentTitle
;
}
public
String
getCategoryId
()
{
return
categoryId
;
}
public
void
setCategoryId
(
String
categoryId
)
{
this
.
categoryId
=
categoryId
;
}
/**
* 设置文章类型
*/
public
void
setContentType
(
String
contentType
)
{
this
.
contentType
=
contentType
;
}
/**
* 获取文章类型
*/
public
String
getContentType
()
{
return
this
.
contentType
;
}
/**
* 设置是否显示
*/
public
void
setContentDisplay
(
String
contentDisplay
)
{
this
.
contentDisplay
=
contentDisplay
;
}
/**
* 获取是否显示
*/
public
String
getContentDisplay
()
{
return
this
.
contentDisplay
;
}
/**
* 设置文章作者
*/
public
void
setContentAuthor
(
String
contentAuthor
)
{
this
.
contentAuthor
=
contentAuthor
;
}
/**
* 获取文章作者
*/
public
String
getContentAuthor
()
{
return
this
.
contentAuthor
;
}
/**
* 设置文章来源
*/
public
void
setContentSource
(
String
contentSource
)
{
this
.
contentSource
=
contentSource
;
}
/**
* 获取文章来源
*/
public
String
getContentSource
()
{
return
this
.
contentSource
;
}
/**
* 设置发布时间
*/
public
void
setContentDatetime
(
Date
contentDatetime
)
{
this
.
contentDatetime
=
contentDatetime
;
}
/**
* 获取发布时间
*/
public
Date
getContentDatetime
()
{
return
this
.
contentDatetime
;
}
/**
* 设置自定义顺序
*/
public
void
setContentSort
(
Integer
contentSort
)
{
this
.
contentSort
=
contentSort
;
}
/**
* 获取自定义顺序
*/
public
Integer
getContentSort
()
{
return
this
.
contentSort
;
}
/**
* 设置文章缩略图
*/
public
void
setContentImg
(
String
contentImg
)
{
this
.
contentImg
=
contentImg
;
}
/**
* 获取文章缩略图
*/
public
String
getContentImg
()
{
return
this
.
contentImg
;
}
/**
* 设置描述
*/
public
void
setContentDescription
(
String
contentDescription
)
{
this
.
contentDescription
=
contentDescription
;
}
/**
* 获取描述
*/
public
String
getContentDescription
()
{
return
this
.
contentDescription
;
}
/**
* 设置关键字
*/
public
void
setContentKeyword
(
String
contentKeyword
)
{
this
.
contentKeyword
=
contentKeyword
;
}
/**
* 获取关键字
*/
public
String
getContentKeyword
()
{
return
this
.
contentKeyword
;
}
/**
* 设置文章内容
*/
public
void
setContentDetails
(
String
contentDetails
)
{
this
.
contentDetails
=
contentDetails
;
}
/**
* 获取文章内容
*/
public
String
getContentDetails
()
{
return
this
.
contentDetails
;
}
/**
* 设置文章跳转链接地址
*/
public
void
setContentUrl
(
String
contentUrl
)
{
this
.
contentUrl
=
contentUrl
;
}
/**
* 获取文章跳转链接地址
*/
public
String
getContentUrl
()
{
return
this
.
contentUrl
;
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 文章实体
* @author 铭飞开发团队
* 创建日期:2019-11-28 15:12:32<br/>
* 历史修订:<br/>
*/
@TableName
(
"cms_content"
)
public
class
ContentEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1574925152617L
;
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* 文章标题
*/
private
String
contentTitle
;
/**
* 所属栏目
*/
private
String
categoryId
;
/**
* 文章类型
*/
private
String
contentType
;
/**
* 是否显示
*/
private
String
contentDisplay
;
/**
* 文章作者
*/
private
String
contentAuthor
;
/**
* 文章来源
*/
private
String
contentSource
;
/**
* 发布时间
*/
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
contentDatetime
;
/**
* 自定义顺序
*/
private
Integer
contentSort
;
/**
* 文章缩略图
*/
private
String
contentImg
;
/**
* 描述
*/
private
String
contentDescription
;
/**
* 关键字
*/
private
String
contentKeyword
;
/**
* 文章内容
*/
private
String
contentDetails
;
/**
* 文章跳转链接地址
*/
private
String
contentOutLink
;
/**
* 点击次数
*/
private
Integer
contentHit
;
public
Integer
getContentHit
()
{
return
contentHit
;
}
public
void
setContentHit
(
Integer
contentHit
)
{
this
.
contentHit
=
contentHit
;
}
/**
* 设置文章标题
*/
public
void
setContentTitle
(
String
contentTitle
)
{
this
.
contentTitle
=
contentTitle
;
}
/**
* 获取文章标题
*/
public
String
getContentTitle
()
{
return
this
.
contentTitle
;
}
public
String
getCategoryId
()
{
return
categoryId
;
}
public
void
setCategoryId
(
String
categoryId
)
{
this
.
categoryId
=
categoryId
;
}
/**
* 设置文章类型
*/
public
void
setContentType
(
String
contentType
)
{
this
.
contentType
=
contentType
;
}
/**
* 获取文章类型
*/
public
String
getContentType
()
{
return
this
.
contentType
;
}
/**
* 设置是否显示
*/
public
void
setContentDisplay
(
String
contentDisplay
)
{
this
.
contentDisplay
=
contentDisplay
;
}
/**
* 获取是否显示
*/
public
String
getContentDisplay
()
{
return
this
.
contentDisplay
;
}
/**
* 设置文章作者
*/
public
void
setContentAuthor
(
String
contentAuthor
)
{
this
.
contentAuthor
=
contentAuthor
;
}
/**
* 获取文章作者
*/
public
String
getContentAuthor
()
{
return
this
.
contentAuthor
;
}
/**
* 设置文章来源
*/
public
void
setContentSource
(
String
contentSource
)
{
this
.
contentSource
=
contentSource
;
}
/**
* 获取文章来源
*/
public
String
getContentSource
()
{
return
this
.
contentSource
;
}
/**
* 设置发布时间
*/
public
void
setContentDatetime
(
Date
contentDatetime
)
{
this
.
contentDatetime
=
contentDatetime
;
}
/**
* 获取发布时间
*/
public
Date
getContentDatetime
()
{
return
this
.
contentDatetime
;
}
/**
* 设置自定义顺序
*/
public
void
setContentSort
(
Integer
contentSort
)
{
this
.
contentSort
=
contentSort
;
}
/**
* 获取自定义顺序
*/
public
Integer
getContentSort
()
{
return
this
.
contentSort
;
}
/**
* 设置文章缩略图
*/
public
void
setContentImg
(
String
contentImg
)
{
this
.
contentImg
=
contentImg
;
}
/**
* 获取文章缩略图
*/
public
String
getContentImg
()
{
return
this
.
contentImg
;
}
/**
* 设置描述
*/
public
void
setContentDescription
(
String
contentDescription
)
{
this
.
contentDescription
=
contentDescription
;
}
/**
* 获取描述
*/
public
String
getContentDescription
()
{
return
this
.
contentDescription
;
}
/**
* 设置关键字
*/
public
void
setContentKeyword
(
String
contentKeyword
)
{
this
.
contentKeyword
=
contentKeyword
;
}
/**
* 获取关键字
*/
public
String
getContentKeyword
()
{
return
this
.
contentKeyword
;
}
/**
* 设置文章内容
*/
public
void
setContentDetails
(
String
contentDetails
)
{
this
.
contentDetails
=
contentDetails
;
}
/**
* 获取文章内容
*/
public
String
getContentDetails
()
{
return
this
.
contentDetails
;
}
/**
* 设置文章跳转链接地址
*/
public
void
setContentOutLink
(
String
contentOutLink
)
{
this
.
contentOutLink
=
contentOutLink
;
}
/**
* 获取文章跳转链接地址
*/
public
String
getContentOutLink
()
{
return
this
.
contentOutLink
;
}
}
src/main/java/net/mingsoft/cms/entity/HistoryLogEntity.java
View file @
09ee994b
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
net.mingsoft.base.entity.BaseEntity
;
import
java.util.Date
;
/**
* 文章浏览记录实体
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
class
HistoryLogEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1577064243576L
;
/**
* 文章编号
*/
private
String
contentId
;
/**
* 浏览ip
*/
private
String
hlIp
;
/**
* 用户idp
*/
private
String
peopleId
;
/**
* 是否为移动端
*/
private
Boolean
hlIsMobile
;
/**
* 设置文章编号
*/
public
void
setContentId
(
String
contentId
)
{
this
.
contentId
=
contentId
;
}
/**
* 获取文章编号
*/
public
String
getContentId
()
{
return
this
.
contentId
;
}
/**
* 设置浏览ip
*/
public
void
setHlIp
(
String
hlIp
)
{
this
.
hlIp
=
hlIp
;
}
/**
* 获取浏览ip
*/
public
String
getHlIp
()
{
return
this
.
hlIp
;
}
public
String
getPeopleId
()
{
return
peopleId
;
}
public
void
setPeopleId
(
String
peopleId
)
{
this
.
peopleId
=
peopleId
;
}
/**
* 设置是否为移动端
*/
public
void
setHlIsMobile
(
Boolean
hlIsMobile
)
{
this
.
hlIsMobile
=
hlIsMobile
;
}
/**
* 获取是否为移动端
*/
public
Boolean
getHlIsMobile
()
{
return
this
.
hlIsMobile
;
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net
.
mingsoft
.
cms
.
entity
;
import
net.mingsoft.base.entity.BaseEntity
;
/**
* 文章浏览记录实体
* @author 铭飞开发团队
* 创建日期:2019-12-23 9:24:03<br/>
* 历史修订:<br/>
*/
public
class
HistoryLogEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1577064243576L
;
/**
* 文章编号
*/
private
String
contentId
;
/**
* 浏览ip
*/
private
String
hlIp
;
/**
* 用户idp
*/
private
String
peopleId
;
/**
* 是否为移动端
*/
private
Boolean
hlIsMobile
;
/**
* 设置文章编号
*/
public
void
setContentId
(
String
contentId
)
{
this
.
contentId
=
contentId
;
}
/**
* 获取文章编号
*/
public
String
getContentId
()
{
return
this
.
contentId
;
}
/**
* 设置浏览ip
*/
public
void
setHlIp
(
String
hlIp
)
{
this
.
hlIp
=
hlIp
;
}
/**
* 获取浏览ip
*/
public
String
getHlIp
()
{
return
this
.
hlIp
;
}
public
String
getPeopleId
()
{
return
peopleId
;
}
public
void
setPeopleId
(
String
peopleId
)
{
this
.
peopleId
=
peopleId
;
}
/**
* 设置是否为移动端
*/
public
void
setHlIsMobile
(
Boolean
hlIsMobile
)
{
this
.
hlIsMobile
=
hlIsMobile
;
}
/**
* 获取是否为移动端
*/
public
Boolean
getHlIsMobile
()
{
return
this
.
hlIsMobile
;
}
}
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
09ee994b
...
...
@@ -22,7 +22,6 @@
package
net
.
mingsoft
.
cms
.
util
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.PageUtil
;
...
...
src/main/java/net/mingsoft/config/WebConfig.java
View file @
09ee994b
...
...
@@ -40,7 +40,10 @@ import org.springframework.core.Ordered;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.web.context.request.RequestContextListener
;
import
org.springframework.web.servlet.config.annotation.*
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.ViewControllerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
javax.annotation.Resource
;
import
java.io.File
;
...
...
@@ -95,7 +98,7 @@ public class WebConfig implements WebMvcConfigurer {
String
uploadMapping
=
MSProperties
.
upload
.
mapping
;
String
uploadFolderPath
=
MSProperties
.
upload
.
path
;
String
template
=
MSProperties
.
upload
.
template
;
String
htmlDir
=
MSProperties
.
DiyProperties
.
htmlDir
;
String
htmlDir
=
MSProperties
.
diy
.
htmlDir
;
// 上传路径映射 这里的映射不能使用File.separator Windows会存在映射问题
registry
.
addResourceHandler
(
uploadMapping
).
addResourceLocations
(
"/"
+
uploadFolderPath
+
"/"
,
"file:"
+
uploadFolderPath
+
"/"
);
registry
.
addResourceHandler
(
"/"
+
template
+
"/**"
).
addResourceLocations
(
"/"
+
template
+
"/"
,
"file:"
+
template
+
"/"
);
...
...
@@ -127,9 +130,9 @@ public class WebConfig implements WebMvcConfigurer {
//XSS过滤器
@Bean
public
FilterRegistrationBean
xssFilterRegistration
(
@Value
(
"${ms.xss.enable:
fals
e}"
)
boolean
xssEnable
,
@Value
(
"${ms.xss.filter-url}
:''
"
)
String
filterUrl
,
@Value
(
"${ms.xss.exclude-url}
:''
"
)
String
excludeUrl
)
{
public
FilterRegistrationBean
xssFilterRegistration
(
@Value
(
"${ms.xss.enable:
tru
e}"
)
boolean
xssEnable
,
@Value
(
"${ms.xss.filter-url}"
)
String
filterUrl
,
@Value
(
"${ms.xss.exclude-url}"
)
String
excludeUrl
)
{
XSSEscapeFilter
xssFilter
=
new
XSSEscapeFilter
();
Map
<
String
,
String
>
initParameters
=
new
HashMap
();
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
...
...
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