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
ca13da45
Commit
ca13da45
authored
Jan 04, 2020
by
铭飞
Committed by
Gitee
Jan 04, 2020
Browse files
Options
Browse Files
Download
Plain Diff
!205 修复问题
Merge pull request !205 from 灰色DT/5.0.0
parents
18c092cd
ff9987b9
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
198 additions
and
302 deletions
+198
-302
pom.xml
pom.xml
+6
-0
MCmsAction.java
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
+148
-238
IContentBiz.java
src/main/java/net/mingsoft/cms/biz/IContentBiz.java
+2
-1
ContentBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
+4
-3
IContentDao.java
src/main/java/net/mingsoft/cms/dao/IContentDao.java
+2
-1
IContentDao.xml
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
+26
-53
CmsParserUtil.java
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
+1
-1
SwaggerConfig.java
src/main/java/net/mingsoft/config/SwaggerConfig.java
+2
-0
application.yml
src/main/resources/application.yml
+4
-3
main.ftl
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
+3
-2
No files found.
pom.xml
View file @
ca13da45
...
...
@@ -35,6 +35,12 @@
</repository>
</repositories>
<dependencies>
<!-- 8.0数据库取消下面注解-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>8.0.11</version>-->
<!-- </dependency>-->
<dependency>
<groupId>
net.mingsoft
</groupId>
<artifactId>
ms-mpeople
</artifactId>
...
...
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
View file @
ca13da45
...
...
@@ -312,254 +312,164 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
// /**
// * 实现前端页面的文章搜索
// *
// * @param request
// * 搜索id
// * @param response
// */
// @RequestMapping(value = "search")
// @ResponseBody
// public void search(HttpServletRequest request, HttpServletResponse response) {
//
// Map<String, Object> map = new HashMap<>();
// // 读取请求字段
// Map<String, String[]> field = request.getParameterMap();
// Map<String, String> basicField = getMapByProperties(net.mingsoft.mdiy.constant.Const.BASIC_FIELD);
// // 文章字段集合
// Map<String, Object> articleFieldName = new HashMap<String, Object>();
// // 自定义字段集合
// Map<String, String> diyFieldName = new HashMap<String, String>();
// CategoryEntity column = null; // 当前栏目
// ModelEntity contentModel = null; // 栏目对应模型
// List<DiyModelMap> fieldValueList = new ArrayList<DiyModelMap>(); // 栏目对应字段的值
// int typeId = 0;
// String categoryIds = BasicUtil.getString("categoryId");
// //当传递了栏目编号,但不是栏目集合
// if(!StringUtil.isBlank(categoryIds) && !categoryIds.contains(",")){
// typeId = Integer.parseInt(categoryIds);
// }
// //记录自定义模型字段名
// List filedStr = new ArrayList<>();
// //根据栏目确定自定义模型
// if(typeId>0){
// column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+""));
// // 获取表单类型的id
// if (column != null&&ObjectUtil.isNotNull(column.getMdiyModelId())) {
// contentModel = (ModelEntity) modelBiz.getEntity(Integer.parseInt(column.getMdiyModelId()));
// if (contentModel != null) {
// Map<String,String> fieldMap = contentModel.getFieldMap();
// for (String s : fieldMap.keySet()) {
// filedStr.add(fieldMap.get(s));
// }
// map.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
// }
// }
// map.put(ParserUtil.COLUMN, column);
// //设置栏目编号
//// map.put(ParserUtil.TYPE_ID, typeId);
// }
//
// // 遍历取字段集合
// if (field != null) {
// for (Map.Entry<String, String[]> entry : field.entrySet()) {
// if (entry != null) {
// String value = entry.getValue()[0]; // 处理由get方法请求中文乱码问题
// if (ObjectUtil.isNull(value)) {
// continue;
// }
// if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转吗
// try {
// value = new String(value.getBytes("ISO-8859-1"), Const.UTF8);
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// }
// // 若为文章字段,则保存至文章字段集合;否则保存至自定义字段集合
// if (ObjectUtil.isNotNull(basicField.get(entry.getKey())) && ObjectUtil.isNotNull(value)) {
// articleFieldName.put(entry.getKey(), value);
// } else {
// if (!StringUtil.isBlank(value)) {
// diyFieldName.put(entry.getKey(), value);
// //判断请求中的是否是自定义模型中的字段
// if(filedStr.contains(entry.getKey())){
// //设置自定义模型字段和值
// DiyModelMap diyMap = new DiyModelMap();
// diyMap.setKey(entry.getKey());
// diyMap.setValue(value);
// fieldValueList.add(diyMap);
// }
// }
// }
// }
// }
// }
// //添加自定义模型的字段和值
// if(fieldValueList.size()>0){
// map.put("diyModel", fieldValueList);
// }
// //组织where查询条件
// Map whereMap = ObjectUtil.isNotNull(contentModel)?
// this.searchMap(articleFieldName, diyFieldName, JSONArray.parseArray(contentModel.getModelField())):
// new HashMap();
//
// // 获取符合条件的文章总数
// int count = contentBiz.getSearchCount(contentModel, whereMap, BasicUtil.getAppId(), categoryIds);
// //设置分页类
// PageBean page = new PageBean();
// //读取模板的分页数量
// int size = BasicUtil.getInt(ParserUtil.SIZE,10);
// try {
// size = TagParser.getPageSize(ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,false ));
// } catch (TemplateNotFoundException e1) {
// e1.printStackTrace();
// } catch (MalformedTemplateNameException e1) {
// e1.printStackTrace();
// } catch (ParseException e1) {
// e1.printStackTrace();
// } catch (IOException e1) {
// e1.printStackTrace();
// }
// int total = PageUtil.totalPage(count, size);
//
// int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1);
// if(pageNo >= total && total!=0) {
// pageNo = total;
// }
// //获取总数
// page.setTotal(total);
// //设置页面显示数量
// page.setSize(size);
// //设置列表当前页
//
// page.setPageNo(pageNo);
//
// String str = ParserUtil.PAGE_NO+","+ParserUtil.SIZE;
// //设置分页的统一链接
// String url = BasicUtil.getUrl()+request.getServletPath() +"?" + BasicUtil.assemblyRequestUrlParams(str.split(","));
// String pageNoStr = "&"+ParserUtil.SIZE+"="+size+"&"+ParserUtil.PAGE_NO+"=";
// //下一页
// String nextUrl = url + pageNoStr+((pageNo+1 > total)?total:pageNo+1);
// //首页
// String indexUrl = url + pageNoStr + 1;
// //尾页
// String lastUrl = url + pageNoStr + total;
// //上一页 当前页为1时,上一页就是1
// String preUrl = url + pageNoStr + ((pageNo==1) ? 1:pageNo-1);
//
// page.setIndexUrl(indexUrl);
// page.setNextUrl(nextUrl);
// page.setPreUrl(preUrl);
// page.setLastUrl(lastUrl);
// map.put(ParserUtil.URL, BasicUtil.getUrl());
// Map<String, Object> searchMap = BasicUtil.assemblyRequestMap();
// searchMap.put(ParserUtil.PAGE_NO, pageNo);
// map.put(SEARCH, searchMap);
// map.put(ParserUtil.PAGE, page);
// //动态解析
// map.put(ParserUtil.IS_DO,false);
// //设置动态请求的模块路径
// map.put(ParserUtil.MODEL_NAME, "mcms");
// //解析后的内容
// String content = "";
// try {
// //根据模板路径,参数生成
// content = CmsParserUtil.generate(SEARCH+ParserUtil.HTM_SUFFIX,map, isMobileDevice(request));
// } catch (TemplateNotFoundException e) {
// e.printStackTrace();
// } catch (MalformedTemplateNameException e) {
// e.printStackTrace();
// } catch (ParseException e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
// this.outString(response, content);
// }
/**
* 动态组织查询where条件 获取查询条件的Map key:字段名 value:List 字段的各种判断值 list[0]:是否为自定义字段
* list[1]:是否为整形 list[2]:是否是等值查询 list[3]:字段的值
* 实现前端页面的文章搜索
*
* @param articleField
* 文章字段
* @param diyFieldName
* 动态字段
* @param fields
* 模型对应的字段类型
* @return
* @param request
* 搜索id
* @param response
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
private
Map
<
String
,
List
>
searchMap
(
Map
<
String
,
Object
>
articleField
,
Map
<
String
,
String
>
diyFieldName
,
List
fields
)
{
Map
<
String
,
List
>
map
=
new
HashMap
<
String
,
List
>();
// 遍历文章中的字段
for
(
Iterator
iter
=
articleField
.
keySet
().
iterator
();
iter
.
hasNext
();)
{
String
key
=
iter
.
next
().
toString
();
String
fieldValue
=
articleField
.
get
(
key
).
toString
();
List
list
=
new
ArrayList
();
List
listValue
=
new
ArrayList
();
// 是否为自定义字段
list
.
add
(
false
);
// 是否是数字类型,true:不是
list
.
add
(
true
);
// 是否是模糊查询3
list
.
add
(
true
);
// 字段值
listValue
.
add
(
articleField
.
get
(
key
));
list
.
add
(
listValue
);
map
.
put
(
key
,
list
);
}
// 遍历字段自定义字段
for
(
Iterator
iter
=
diyFieldName
.
keySet
().
iterator
();
iter
.
hasNext
();)
{
String
key
=
iter
.
next
().
toString
();
String
fieldValue
=
diyFieldName
.
get
(
key
);
// 获取字段实体
Map
field
=
get
(
key
,
fields
);
@RequestMapping
(
value
=
"search"
)
@ResponseBody
public
void
search
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
// 读取请求字段
Map
<
String
,
String
[]>
field
=
request
.
getParameterMap
();
// 文章字段集合
Map
<
String
,
Object
>
articleFieldName
=
new
HashMap
<
String
,
Object
>();
// 自定义字段集合
Map
<
String
,
String
>
diyFieldName
=
new
HashMap
<
String
,
String
>();
CategoryEntity
column
=
null
;
// 当前栏目
ModelEntity
contentModel
=
null
;
// 栏目对应模型
List
<
DiyModelMap
>
fieldValueList
=
new
ArrayList
<
DiyModelMap
>();
// 栏目对应字段的值
int
typeId
=
0
;
String
categoryIds
=
BasicUtil
.
getString
(
"categoryId"
);
//当传递了栏目编号,但不是栏目集合
if
(!
StringUtil
.
isBlank
(
categoryIds
)
&&
!
categoryIds
.
contains
(
","
)){
typeId
=
Integer
.
parseInt
(
categoryIds
);
}
//记录自定义模型字段名
List
filedStr
=
new
ArrayList
<>();
//根据栏目确定自定义模型
if
(
typeId
>
0
){
column
=
(
CategoryEntity
)
categoryBiz
.
getEntity
(
Integer
.
parseInt
(
typeId
+
""
));
// 获取表单类型的id
if
(
column
!=
null
&&
ObjectUtil
.
isNotNull
(
column
.
getMdiyModelId
()))
{
contentModel
=
(
ModelEntity
)
modelBiz
.
getEntity
(
Integer
.
parseInt
(
column
.
getMdiyModelId
()));
if
(
contentModel
!=
null
)
{
Map
<
String
,
String
>
fieldMap
=
contentModel
.
getFieldMap
();
for
(
String
s
:
fieldMap
.
keySet
())
{
filedStr
.
add
(
fieldMap
.
get
(
s
));
}
map
.
put
(
ParserUtil
.
TABLE_NAME
,
contentModel
.
getModelTableName
());
}
}
map
.
put
(
ParserUtil
.
COLUMN
,
column
);
}
// 遍历取字段集合
if
(
field
!=
null
)
{
List
list
=
new
ArrayList
();
// 是否为自定义字段0
list
.
add
(
0
,
true
);
List
listValue
=
new
ArrayList
();
// 字段的值
if
(
"int"
.
equals
(
field
.
get
(
"javaType"
)
)
||
"float"
.
equals
(
field
.
get
(
"javaType"
)
)||
"Double"
.
equals
(
field
.
get
(
"javaType"
))
)
{
// 判断是否为区间查询
if
(
diyFieldName
.
get
(
key
).
toString
().
indexOf
(
"-"
)
>
0
)
{
String
[]
values
=
fieldValue
.
toString
().
split
(
"-"
);
// 是否是数字类型,false:是
list
.
add
(
false
);
// 是否是区间比较 false:是
list
.
add
(
false
);
// 字段值1
listValue
.
add
(
values
[
0
]);
listValue
.
add
(
values
[
1
]);
}
else
{
// 是否是数字类型,false:是2
list
.
add
(
false
);
// 是否是区间比较 true:不是3
list
.
add
(
true
);
// 字段值 1
listValue
.
add
(
fieldValue
);
for
(
Map
.
Entry
<
String
,
String
[]>
entry
:
field
.
entrySet
())
{
if
(
entry
!=
null
)
{
String
value
=
entry
.
getValue
()[
0
];
// 处理由get方法请求中文乱码问题
if
(
ObjectUtil
.
isNull
(
value
))
{
continue
;
}
}
else
{
// 是否是数字类型,true:不是2
list
.
add
(
true
);
list
.
add
(
false
);
// 字段值 1
listValue
.
add
(
fieldValue
);
if
(
request
.
getMethod
().
equals
(
RequestMethod
.
GET
))
{
// 如果是get方法需要将请求地址参数转码
try
{
value
=
new
String
(
value
.
getBytes
(
"ISO-8859-1"
),
Const
.
UTF8
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
}
// 保存至自定义字段集合
if
(!
StringUtil
.
isBlank
(
value
))
{
diyFieldName
.
put
(
entry
.
getKey
(),
value
);
//判断请求中的是否是自定义模型中的字段
if
(
filedStr
.
contains
(
entry
.
getKey
())){
//设置自定义模型字段和值
DiyModelMap
diyMap
=
new
DiyModelMap
();
diyMap
.
setKey
(
entry
.
getKey
());
diyMap
.
setValue
(
value
);
fieldValueList
.
add
(
diyMap
);
}
}
}
list
.
add
(
listValue
);
map
.
put
(
key
,
list
);
}
}
return
map
;
//添加自定义模型的字段和值
if
(
fieldValueList
.
size
()>
0
){
map
.
put
(
"diyModel"
,
fieldValueList
);
}
//设置分页类
PageBean
page
=
new
PageBean
();
//读取模板的分页数量
int
size
=
BasicUtil
.
getInt
(
ParserUtil
.
SIZE
,
10
);
try
{
size
=
TagParser
.
getPageSize
(
ParserUtil
.
read
(
SEARCH
+
ParserUtil
.
HTM_SUFFIX
,
false
));
}
catch
(
TemplateNotFoundException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
MalformedTemplateNameException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
ParseException
e1
)
{
e1
.
printStackTrace
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
}
//查询数量
int
count
=
contentBiz
.
getSearchCount
(
contentModel
,
fieldValueList
,
BasicUtil
.
assemblyRequestMap
(),
BasicUtil
.
getAppId
(),
categoryIds
);
int
total
=
PageUtil
.
totalPage
(
count
,
size
);
int
pageNo
=
BasicUtil
.
getInt
(
ParserUtil
.
PAGE_NO
,
1
);
if
(
pageNo
>=
total
&&
total
!=
0
)
{
pageNo
=
total
;
}
//获取总数
page
.
setTotal
(
total
);
//设置页面显示数量
page
.
setSize
(
size
);
//设置列表当前页
page
.
setPageNo
(
pageNo
);
String
str
=
ParserUtil
.
PAGE_NO
+
","
+
ParserUtil
.
SIZE
;
//设置分页的统一链接
String
url
=
BasicUtil
.
getUrl
()+
request
.
getServletPath
()
+
"?"
+
BasicUtil
.
assemblyRequestUrlParams
(
str
.
split
(
","
));
String
pageNoStr
=
"&"
+
ParserUtil
.
SIZE
+
"="
+
size
+
"&"
+
ParserUtil
.
PAGE_NO
+
"="
;
//下一页
String
nextUrl
=
url
+
pageNoStr
+((
pageNo
+
1
>
total
)?
total:
pageNo
+
1
);
//首页
String
indexUrl
=
url
+
pageNoStr
+
1
;
//尾页
String
lastUrl
=
url
+
pageNoStr
+
total
;
//上一页 当前页为1时,上一页就是1
String
preUrl
=
url
+
pageNoStr
+
((
pageNo
==
1
)
?
1
:
pageNo
-
1
);
page
.
setIndexUrl
(
indexUrl
);
page
.
setNextUrl
(
nextUrl
);
page
.
setPreUrl
(
preUrl
);
page
.
setLastUrl
(
lastUrl
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
Map
<
String
,
Object
>
searchMap
=
BasicUtil
.
assemblyRequestMap
();
searchMap
.
put
(
ParserUtil
.
PAGE_NO
,
pageNo
);
map
.
put
(
SEARCH
,
searchMap
);
map
.
put
(
ParserUtil
.
PAGE
,
page
);
//动态解析
map
.
put
(
ParserUtil
.
IS_DO
,
false
);
//设置动态请求的模块路径
map
.
put
(
ParserUtil
.
MODEL_NAME
,
"mcms"
);
//解析后的内容
String
content
=
""
;
try
{
//根据模板路径,参数生成
content
=
CmsParserUtil
.
generate
(
SEARCH
+
ParserUtil
.
HTM_SUFFIX
,
map
,
isMobileDevice
(
request
));
}
catch
(
TemplateNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
MalformedTemplateNameException
e
)
{
e
.
printStackTrace
();
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
this
.
outString
(
response
,
content
);
}
private
Map
get
(
String
key
,
List
<
Map
>
fields
)
{
for
(
Map
field
:
fields
)
{
if
(
key
.
equals
(
field
.
get
(
"key"
))){
...
...
src/main/java/net/mingsoft/cms/biz/IContentBiz.java
View file @
ca13da45
...
...
@@ -20,5 +20,5 @@ public interface IContentBiz extends IBaseBiz {
List
<
ContentBean
>
queryIdsByCategoryIdForParser
(
String
categoryId
,
String
beginTime
,
String
endTime
,
String
orderBy
,
String
order
);
int
getSearchCount
(
ModelEntity
contentModel
,
Map
whereMap
,
int
appId
,
String
categoryIds
);
int
getSearchCount
(
ModelEntity
contentModel
,
List
diyList
,
Map
whereMap
,
int
appId
,
String
categoryIds
);
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
View file @
ca13da45
...
...
@@ -63,10 +63,10 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
}
@Override
public
int
getSearchCount
(
ModelEntity
contentModel
,
Map
whereMap
,
int
appId
,
String
categoryIds
)
{
public
int
getSearchCount
(
ModelEntity
contentModel
,
List
diyList
,
Map
whereMap
,
int
appId
,
String
categoryIds
)
{
if
(
contentModel
!=
null
)
{
return
contentDao
.
getSearchCount
(
contentModel
.
getModelTableName
(),
whereMap
,
appId
,
categoryIds
);
return
contentDao
.
getSearchCount
(
contentModel
.
getModelTableName
(),
diyList
,
whereMap
,
appId
,
categoryIds
);
}
return
contentDao
.
getSearchCount
(
null
,
whereMap
,
appId
,
categoryIds
);
return
contentDao
.
getSearchCount
(
null
,
null
,
whereMap
,
appId
,
categoryIds
);
}
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/IContentDao.java
View file @
ca13da45
...
...
@@ -34,6 +34,6 @@ public interface IContentDao extends IBaseDao {
* list[2]:是否是等值查询 list[3]:字段的值
* @return 文章实体总数
*/
int
getSearchCount
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"
map"
)
Map
<
String
,
Lis
t
>
map
,
int
getSearchCount
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"
diyList"
)
List
diyList
,
@Param
(
"map"
)
Map
<
String
,
Objec
t
>
map
,
@Param
(
"websiteId"
)
int
websiteId
,
@Param
(
"ids"
)
String
ids
);
}
\ No newline at end of file
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
View file @
ca13da45
...
...
@@ -254,71 +254,43 @@
left join cms_category c
ON a.content_category_id
= c.id
<if
test=
"tableName!=null and tableName!=''"
>
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>
where a.app_id = #{websiteId}
<where>
a.app_id = #{websiteId}
<if
test=
"ids!=null and ids!=''"
>
and FIND_IN_SET(content_category_id,'${ids}')
</if>
<foreach
item=
"item"
index=
"key"
collection=
"map"
open=
""
separator=
""
close=
""
>
<if
test=
" item[0] == false"
>
and ${key}
<if
test=
"map.content_title!=null"
>
and a.content_title like CONCAT("%",'${map.content_title}',"%")
</if>
<if
test=
"
item[0]== true
"
>
and d.${key}
<if
test=
"
map.content_author!=null
"
>
and a.content_author like CONCAT("%",'${map.content_author}',"%")
</if>
<!-- 数字类型的查找 item[1]:字段是否为数字类型false:数字 -->
<if
test=
"item[1] == false"
>
<!--item[2]: 是采用等值还是区间查询。false:区间 itme[3][0]第一个值item[3][1]的二个值 -->
<if
test=
"item[2] == true"
>
=
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
>
#{val}
</foreach>
<if
test=
"map.content_source!=null"
>
and a.content_source like CONCAT("%",'${map.content_source}',"%")
</if>
<if
test=
"item[2] == false"
>
between
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
separator=
"and"
>
#{val}
</foreach>
<if
test=
"map.content_type!=null"
>
and a.content_type like CONCAT("%",'${map.content_type}',"%")
</if>
<if
test=
"map.content_description!=null"
>
and a.content_description like CONCAT("%",'${map.content_description}',"%")
</if>
<!-- 字符型数据的查找 item[1]:字段是否为数字类型true:字符串 -->
<if
test=
"item[1] == true"
>
<!--item[2]: 是采用模糊查询。false:不采用模糊 -->
<if
test=
"item[2] == true"
>
<include
refid=
"queryLike"
></include>
</if>
<if
test=
"item[2] == false"
>
=
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
>
#{val}
</foreach>
<if
test=
"map.content_keyword!=null"
>
and a.content_keyword like CONCAT("%",'${map.content_keyword}',"%")
</if>
<if
test=
"map.content_details!=null"
>
and a.content_details like CONCAT("%",'${map.content_details}',"%")
</if>
<if
test=
"tableName!=null and tableName!='' and diyMap!=null"
>
<foreach
item=
"item"
index=
"index"
collection=
"diyList"
open=
""
separator=
""
close=
""
>
and d.${item.key} like CONCAT("%",'${item.value}',"%")
</foreach>
</if>
</where>
</select>
<!-- 根据字段条件查找文章实体开始 -->
<sql
id=
"queryLike"
databaseId=
"mysql"
>
like CONCAT("%",
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
>
<if
test=
"index==0"
>
#{val}
</if>
</foreach>
,"%")
</sql>
<sql
id=
"queryLike"
databaseId=
"oracle"
>
like '%'||
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
>
<if
test=
"index==0"
>
#{val}
</if>
</foreach>
||'%'
</sql>
<sql
id=
"queryLike"
databaseId=
"sqlServer"
>
like '%'+
<foreach
item=
"val"
index=
"index"
collection=
"item[3]"
>
<if
test=
"index==0"
>
#{val}
</if>
</foreach>
+'%'
</sql>
</mapper>
\ No newline at end of file
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
ca13da45
...
...
@@ -227,7 +227,7 @@ public class CmsParserUtil extends ParserUtil {
}
// 判断文件是否存在,若不存在弹出返回信息
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
columnUrl
)))
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
columnUrl
))
||
StringUtils
.
isBlank
(
articleIdList
.
get
(
artId
).
getCategoryId
())
)
{
artId
++;
continue
;
}
...
...
src/main/java/net/mingsoft/config/SwaggerConfig.java
View file @
ca13da45
package
net
.
mingsoft
.
config
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
...
...
@@ -13,6 +14,7 @@ import springfox.documentation.spring.web.plugins.Docket;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@ConditionalOnProperty
(
prefix
=
"ms"
,
name
=
"swagger.enable"
,
havingValue
=
"true"
)
public
class
SwaggerConfig
{
@Bean
...
...
src/main/resources/application.yml
View file @
ca13da45
...
...
@@ -6,7 +6,11 @@ server:
logging
:
level
:
net.mingsoft
:
trace
file
:
mcms.log
#日志文件存放位置
path
:
log
#日志压缩文件存放位置
ms
:
swagger
:
enable
:
true
#启用swagger文档
manager
:
path
:
/ms
view-path
:
/WEB-INF/manager
...
...
@@ -27,7 +31,6 @@ ms:
spring
:
profiles
:
active
:
dev
...
...
@@ -64,6 +67,5 @@ spring:
number_format
:
0.##
mybatis
:
mapper-locations
:
classpath*:**/dao/*.xml
configuration
:
database-id
:
mysql
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
View file @
ca13da45
...
...
@@ -4,6 +4,7 @@
<title>
文章主体
</title>
<
#
include
"../../
include
/
head-file
.
ftl
"
>
<
#
include
"../../
include
/
increase-search
.
ftl
"
>
</head>
<body>
<div
id=
"main"
class=
"ms-index"
v-cloak
>
...
...
@@ -124,8 +125,8 @@
data
:{
conditionList
:[
{
action
:
'and'
,
field
:
'content_title'
,
el
:
'eq'
,
model
:
'contentTitle'
,
name
:
'文章标题'
,
type
:
'input'
},
{
action
:
'and'
,
field
:
'content_category_id'
,
el
:
'eq'
,
model
:
'contentCategoryId'
,
name
:
'所属栏目'
,
type
:
'cascader'
,
multiple
:
false
},
{
action
:
'and'
,
field
:
'content_type'
,
el
:
'eq'
,
model
:
'contentType'
,
name
:
'文章类型'
,
type
:
'checkbox'
,
label
:
false
,
multiple
:
true
},
{
action
:
'and'
,
field
:
'content_category_id'
,
el
:
'eq'
,
model
:
'contentCategoryId'
,
name
:
'所属栏目'
,
key
:
'id'
,
title
:
'categoryTitle'
,
type
:
'cascader'
,
multiple
:
false
},
{
action
:
'and'
,
field
:
'content_type'
,
el
:
'eq'
,
model
:
'contentType'
,
name
:
'文章类型'
,
key
:
'dictValue'
,
title
:
'dictLabel'
,
type
:
'checkbox'
,
label
:
false
,
multiple
:
true
},
{
action
:
'and'
,
field
:
'content_display'
,
el
:
'eq'
,
model
:
'contentDisplay'
,
name
:
'是否显示'
,
type
:
'radio'
,
label
:
true
,
multiple
:
false
},
{
action
:
'and'
,
field
:
'content_author'
,
el
:
'eq'
,
model
:
'contentAuthor'
,
name
:
'文章作者'
,
type
:
'input'
},
{
action
:
'and'
,
field
:
'content_source'
,
el
:
'eq'
,
model
:
'contentSource'
,
name
:
'文章来源'
,
type
:
'input'
},
...
...
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