Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
ruoyi
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
范晓龙
ruoyi
Commits
21f91206
提交
21f91206
authored
10月 26, 2022
作者:
dingtalk_nnkplh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加发布新闻功能,优化发布通知功能
上级
c8e4c6ac
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
165 行增加
和
129 行删除
+165
-129
TbNewsController.java
...ava/com/ruoyi/web/controller/school/TbNewsController.java
+4
-0
application-dev.yml
ruoyi-admin/src/main/resources/application-dev.yml
+2
-2
application-pro.yml
ruoyi-admin/src/main/resources/application-pro.yml
+2
-2
ueditor.config.js
...main/resources/static/ajax/libs/ueditor/ueditor.config.js
+1
-1
add.html
...admin/src/main/resources/templates/business/news/add.html
+25
-26
edit.html
...dmin/src/main/resources/templates/business/news/edit.html
+12
-12
news.html
...dmin/src/main/resources/templates/business/news/news.html
+6
-6
add.html
...min/src/main/resources/templates/business/notice/add.html
+4
-5
edit.html
...in/src/main/resources/templates/business/notice/edit.html
+21
-11
add.html
...i-admin/src/main/resources/templates/system/demo/add.html
+0
-9
TbNews.java
...-system/src/main/java/com/ruoyi/system/domain/TbNews.java
+48
-33
TbNewsMapper.java
...m/src/main/java/com/ruoyi/system/mapper/TbNewsMapper.java
+2
-0
TbNewsServiceImpl.java
...java/com/ruoyi/system/service/impl/TbNewsServiceImpl.java
+21
-2
TbNewsMapper.xml
...-system/src/main/resources/mapper/system/TbNewsMapper.xml
+17
-20
没有找到文件。
ruoyi-admin/src/main/java/com/ruoyi/web/controller/school/TbNewsController.java
浏览文件 @
21f91206
package
com
.
ruoyi
.
web
.
controller
.
school
;
import
java.io.UnsupportedEncodingException
;
import
java.util.List
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -18,6 +21,7 @@ import com.ruoyi.common.core.controller.BaseController;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
java.net.URLDecoder
;
/**
* 新闻与活动Controller
...
...
ruoyi-admin/src/main/resources/application-dev.yml
浏览文件 @
21f91206
...
...
@@ -169,7 +169,7 @@ shiro:
cipherKey
:
session
:
# Session超时时间,-1代表永不过期(默认30分钟)
expireTime
:
3
0
expireTime
:
12
0
# 同步session到数据库的周期(默认1分钟)
dbSyncPeriod
:
1
# 相隔多久检查一次session的有效性,默认就是10分钟
...
...
@@ -187,7 +187,7 @@ xss:
# 过滤开关
enabled
:
true
# 排除链接(多个用逗号分隔)
excludes
:
/system/notice/*,/system/demo/*
excludes
:
/system/notice/*,/system/demo/*
,/system/news/*
# 匹配链接
urlPatterns
:
/system/*,/monitor/*,/tool/*
...
...
ruoyi-admin/src/main/resources/application-pro.yml
浏览文件 @
21f91206
...
...
@@ -169,7 +169,7 @@ shiro:
cipherKey
:
session
:
# Session超时时间,-1代表永不过期(默认30分钟)
expireTime
:
3
0
expireTime
:
12
0
# 同步session到数据库的周期(默认1分钟)
dbSyncPeriod
:
1
# 相隔多久检查一次session的有效性,默认就是10分钟
...
...
@@ -187,7 +187,7 @@ xss:
# 过滤开关
enabled
:
true
# 排除链接(多个用逗号分隔)
excludes
:
/system/notice/*,/system/demo/*
excludes
:
/system/notice/*,/system/demo/*
,/system/news/*
# 匹配链接
urlPatterns
:
/system/*,/monitor/*,/tool/*
...
...
ruoyi-admin/src/main/resources/static/ajax/libs/ueditor/ueditor.config.js
浏览文件 @
21f91206
...
...
@@ -409,7 +409,7 @@
p
:
[
'class'
,
'style'
],
pre
:
[
'class'
,
'style'
],
s
:
[],
section
:[],
section
:[
'class'
,
'style'
],
small
:
[],
span
:
[
'class'
,
'style'
],
sub
:
[
'class'
,
'style'
],
...
...
ruoyi-admin/src/main/resources/templates/business/news/add.html
浏览文件 @
21f91206
...
...
@@ -10,30 +10,30 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻标题:
</label>
<div
class=
"col-sm-8"
>
<input
name=
"
t
itle"
class=
"form-control"
type=
"text"
required
>
<input
name=
"
newsT
itle"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻摘要:
</label>
<div
class=
"col-sm-8"
>
<input
name=
"summary"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻内容:
</label>
<div
class=
"col-sm-10"
>
<script
id=
"editor"
name=
"content"
type=
"text/plain"
style=
"height: 300px;"
></script>
<input
name=
"newsSummary"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻封面:
</label>
<input
name=
"
cover"
id=
"c
over"
type=
"hidden"
>
<input
name=
"
newsCover"
id=
"newsC
over"
type=
"hidden"
>
<div
class=
"col-sm-8"
>
<div
class=
"file-loading"
>
<input
id=
"singleCover"
name=
"file"
type=
"file"
>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻内容:
</label>
<div
class=
"col-sm-10"
>
<script
id=
"editor"
name=
"newsContent"
type=
"text/plain"
style=
"height: 300px;"
></script>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
备注:
</label>
<div
class=
"col-sm-8"
>
...
...
@@ -45,12 +45,27 @@
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: ueditor-js"
/>
<th:block
th:include=
"include :: bootstrap-fileinput-js"
/>
<script
t
ype=
"text/
javascript"
>
<script
t
h:inline=
"
javascript"
>
var
prefix
=
ctx
+
"system/news"
$
(
"#form-news-add"
).
validate
({
focusCleanup
:
true
});
$
(
document
).
ready
(
function
()
{
// 单图上传
$
(
"#singleCover"
).
fileinput
({
uploadUrl
:
ctx
+
'common/upload'
,
maxFileCount
:
1
,
autoReplace
:
true
}).
on
(
'fileuploaded'
,
function
(
event
,
data
,
previewId
,
index
)
{
var
rsp
=
data
.
response
;
$
(
"#newsCover"
).
val
(
rsp
.
fileName
);
}).
on
(
'fileremoved'
,
function
(
event
,
id
,
index
)
{
$
(
"input[name='"
+
event
.
currentTarget
.
id
+
"']"
).
val
(
''
)
})
});
var
ue
=
UE
.
getEditor
(
'editor'
);
function
getContentTxt
()
{
return
UE
.
getEditor
(
'editor'
).
getContentTxt
();
...
...
@@ -59,7 +74,6 @@
function
submitHandler
()
{
if
(
$
.
validate
.
form
())
{
var
text
=
getContentTxt
();
alert
(
text
);
if
(
text
==
''
||
text
.
length
==
0
)
{
$
.
modal
.
alertWarning
(
"请输入新闻内容!"
);
return
;
...
...
@@ -67,20 +81,6 @@
$
.
operate
.
save
(
prefix
+
"/add"
,
$
(
'#form-news-add'
).
serialize
());
}
}
$
(
document
).
ready
(
function
()
{
// 单图上传
$
(
"#singleCover"
).
fileinput
({
uploadUrl
:
ctx
+
'common/upload'
,
maxFileCount
:
1
,
autoReplace
:
true
}).
on
(
'fileuploaded'
,
function
(
event
,
data
,
previewId
,
index
)
{
var
rsp
=
data
.
response
;
$
(
"#cover"
).
val
(
rsp
.
fileName
);
}).
on
(
'fileremoved'
,
function
(
event
,
id
,
index
)
{
$
(
"input[name='"
+
event
.
currentTarget
.
id
+
"']"
).
val
(
''
)
})
});
</script>
</body>
</html>
\ No newline at end of file
ruoyi-admin/src/main/resources/templates/business/news/edit.html
浏览文件 @
21f91206
...
...
@@ -11,25 +11,25 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻标题:
</label>
<div
class=
"col-sm-8"
>
<input
name=
"
title"
th:field=
"*{t
itle}"
class=
"form-control"
type=
"text"
required
>
<input
name=
"
newsTitle"
th:field=
"*{newsT
itle}"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻摘要:
</label>
<div
class=
"col-sm-8"
>
<input
name=
"
summary"
th:field=
"*{s
ummary}"
class=
"form-control"
type=
"text"
required
>
<input
name=
"
newsSummary"
th:field=
"*{newsS
ummary}"
class=
"form-control"
type=
"text"
required
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻内容:
</label>
<div
class=
"col-sm-10"
>
<script
id=
"editor"
name=
"
c
ontent"
type=
"text/plain"
style=
"height: 300px;"
></script>
<textarea
id=
"
content"
style=
"display: none;"
>
[[*{c
ontent}]]
</textarea>
<script
id=
"editor"
name=
"
newsC
ontent"
type=
"text/plain"
style=
"height: 300px;"
></script>
<textarea
id=
"
newsContent"
style=
"display: none;"
>
[[*{newsC
ontent}]]
</textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
新闻封面:
</label>
<input
th:field=
"*{
cover}"
id=
"c
over"
type=
"hidden"
>
<input
th:field=
"*{
newsCover}"
id=
"newsC
over"
type=
"hidden"
>
<div
class=
"col-sm-8"
>
<div
class=
"file-loading"
>
<input
id=
"singleCover"
name=
"file"
type=
"file"
>
...
...
@@ -54,7 +54,7 @@
});
$
(
function
()
{
var
text
=
$
(
"#
c
ontent"
).
text
();
var
text
=
$
(
"#
newsC
ontent"
).
text
();
var
ue
=
UE
.
getEditor
(
'editor'
);
ue
.
ready
(
function
()
{
ue
.
setContent
(
text
);
...
...
@@ -81,7 +81,7 @@
//初始化方法
function
initUpload
()
{
var
logoUrl
=
$
(
"#
c
over"
).
val
();
//拿到图片路径
var
logoUrl
=
$
(
"#
newsC
over"
).
val
();
//拿到图片路径
var
preList
=
new
Array
();
var
initialPreviewConfig
=
new
Array
();
//设置初始化区域值
...
...
@@ -126,11 +126,11 @@
// 单图上传
$
(
"#singleCover"
).
on
(
'fileuploaded'
,
function
(
event
,
data
,
previewId
,
index
)
{
var
rsp
=
data
.
response
;
var
imgPath
=
$
(
"#
c
over"
).
val
();
var
imgPath
=
$
(
"#
newsC
over"
).
val
();
if
(
imgPath
!=
null
&&
imgPath
!=
''
){
$
(
"#
c
over"
).
val
(
imgPath
+
","
+
rsp
.
fileName
);
$
(
"#
newsC
over"
).
val
(
imgPath
+
","
+
rsp
.
fileName
);
}
else
{
$
(
"#
c
over"
).
val
(
rsp
.
fileName
);
$
(
"#
newsC
over"
).
val
(
rsp
.
fileName
);
}
$
(
"#singleCover"
).
fileinput
(
'destroy'
);
//销毁fileUploadFileInput
initUpload
();
//重新初始化文件预览数据和文件上传附件
...
...
@@ -151,8 +151,8 @@
urlLinkNew
=
imgArr
[
i
];
}
}
$
(
"#
c
over"
).
val
(
urlLinkNew
);
console
.
log
(
$
(
"#
c
over"
).
val
())
$
(
"#
newsC
over"
).
val
(
urlLinkNew
);
console
.
log
(
$
(
"#
newsC
over"
).
val
())
});
</script>
</body>
...
...
ruoyi-admin/src/main/resources/templates/business/news/news.html
浏览文件 @
21f91206
...
...
@@ -12,11 +12,11 @@
<ul>
<li>
<label>
新闻标题:
</label>
<input
type=
"text"
name=
"
t
itle"
/>
<input
type=
"text"
name=
"
newsT
itle"
/>
</li>
<li>
<label>
新闻摘要:
</label>
<input
type=
"text"
name=
"
s
ummary"
/>
<input
type=
"text"
name=
"
newsS
ummary"
/>
</li>
<a
class=
"btn btn-primary btn-rounded btn-sm"
onclick=
"$.table.search()"
><i
class=
"fa fa-search"
></i>
搜索
</a>
<a
class=
"btn btn-warning btn-rounded btn-sm"
onclick=
"$.form.reset()"
><i
class=
"fa fa-refresh"
></i>
重置
</a>
...
...
@@ -68,19 +68,19 @@
visible
:
false
},
{
field
:
'
t
itle'
,
field
:
'
newsT
itle'
,
title
:
'新闻标题'
},
{
field
:
'
s
ummary'
,
field
:
'
newsS
ummary'
,
title
:
'新闻摘要'
},
{
field
:
'creator'
,
field
:
'creator
Desc
'
,
title
:
'创建者'
},
{
field
:
'modifiedBy'
,
field
:
'modifiedBy
Desc
'
,
title
:
'更新者'
},
{
...
...
ruoyi-admin/src/main/resources/templates/business/notice/add.html
浏览文件 @
21f91206
...
...
@@ -18,8 +18,8 @@
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label is-required"
>
通知类型:
</label>
<div
class=
"col-sm-8"
>
<select
id=
"noticeType1"
class=
"form-control select2-multiple"
required
>
<option
value=
"1"
>
系统通知
</option>
<select
id=
"noticeType1"
class=
"form-control select2-multiple"
>
<option
value=
"1"
selected
>
系统通知
</option>
<option
value=
"2"
>
个人通知
</option>
</select>
</div>
...
...
@@ -77,9 +77,8 @@
function
submitHandler
()
{
if
(
$
.
validate
.
form
())
{
// var a=$('#noticeType1').val();
// $("#noticeType").val(a);
// alert($("#noticeType").val());
var
a
=
$
(
'#noticeType1'
).
val
();
$
(
"#noticeType"
).
val
(
a
);
var
text
=
getContentTxt
();
if
(
text
==
''
||
text
.
length
==
0
)
{
$
.
modal
.
alertWarning
(
"请输入通知内容!"
);
...
...
ruoyi-admin/src/main/resources/templates/business/notice/edit.html
浏览文件 @
21f91206
...
...
@@ -2,6 +2,8 @@
<html
lang=
"zh"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<th:block
th:include=
"include :: header('修改通知公告')"
/>
<th:block
th:include=
"include :: select2-css"
/>
<th:block
th:include=
"include :: bootstrap-select-css"
/>
</head>
<body
class=
"white-bg"
>
<div
class=
"wrapper wrapper-content animated fadeInRight ibox-content"
>
...
...
@@ -52,6 +54,8 @@
</div>
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: ueditor-js"
/>
<th:block
th:include=
"include :: select2-js"
/>
<th:block
th:include=
"include :: bootstrap-select-js"
/>
<script
th:inline=
"javascript"
>
var
prefix
=
ctx
+
"business/notice"
;
$
(
"#form-notice-edit"
).
validate
({
...
...
@@ -70,17 +74,6 @@
return
UE
.
getEditor
(
'editor'
).
getContentTxt
();
}
function
submitHandler
()
{
if
(
$
.
validate
.
form
())
{
var
text
=
getContentTxt
();
if
(
text
==
''
||
text
.
length
==
0
)
{
$
.
modal
.
alertWarning
(
"请输入通知内容!"
);
return
;
}
$
.
operate
.
save
(
prefix
+
"/edit"
,
$
(
'#form-notice-edit'
).
serialize
());
}
}
$
(
document
).
ready
(
function
()
{
var
vSele1
=
$
(
"#status"
).
val
();
$
(
"#status1"
).
append
(
"<option value='1'>正常</option>"
);
...
...
@@ -106,6 +99,11 @@
$
(
"#status"
).
val
(
a
);
});
$
(
'#status1'
).
on
(
'change'
,
function
(
e
)
{
var
a
=
$
(
'#status1'
).
val
();
$
(
"#status"
).
val
(
a
);
});
$
(
'#noticeType1'
).
on
(
'select2:select'
,
function
(
e
)
{
var
a
=
$
(
'#noticeType1'
).
val
();
$
(
"#noticeType"
).
val
(
a
);
...
...
@@ -115,6 +113,17 @@
var
a
=
$
(
'#noticeType1'
).
val
();
$
(
"#noticeType"
).
val
(
a
);
});
function
submitHandler
()
{
if
(
$
.
validate
.
form
())
{
var
text
=
getContentTxt
();
if
(
text
==
''
||
text
.
length
==
0
)
{
$
.
modal
.
alertWarning
(
"请输入通知内容!"
);
return
;
}
$
.
operate
.
save
(
prefix
+
"/edit"
,
$
(
'#form-notice-edit'
).
serialize
());
}
}
</script>
</body>
</html>
\ No newline at end of file
ruoyi-admin/src/main/resources/templates/system/demo/add.html
浏览文件 @
21f91206
...
...
@@ -21,15 +21,6 @@
<input
id=
"singleFile"
name=
"file"
type=
"file"
>
</div>
</div>
<!-- <div class="col-sm-8">-->
<!-- <div class="fileinput fileinput-new" data-provides="fileinput">-->
<!-- <div >-->
<!-- <span class="btn btn-white btn-file">-->
<!-- <input id="materialCover" name="materialCover" type="file">-->
<!-- </span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label is-required"
>
材料内容:
</label>
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/TbNews.java
浏览文件 @
21f91206
...
...
@@ -20,22 +20,26 @@ public class TbNews extends BaseEntity
/** 新闻标题 */
@Excel
(
name
=
"新闻标题"
)
private
String
t
itle
;
private
String
newsT
itle
;
/** 新闻摘要 */
@Excel
(
name
=
"新闻摘要"
)
private
String
s
ummary
;
private
String
newsS
ummary
;
/** 新闻内容 */
@Excel
(
name
=
"新闻内容"
)
private
String
c
ontent
;
private
String
newsC
ontent
;
private
String
c
over
;
private
String
newsC
over
;
/** 新闻状态(1正常 2关闭) */
@Excel
(
name
=
"新闻状态"
,
readConverterExp
=
"1=正常,2=关闭"
)
private
Integer
status
;
private
String
creatorDesc
;
private
String
modifiedByDesc
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
...
...
@@ -45,58 +49,69 @@ public class TbNews extends BaseEntity
{
return
id
;
}
public
void
setTitle
(
String
title
)
public
void
setStatus
(
Integer
status
)
{
this
.
title
=
title
;
this
.
status
=
status
;
}
public
String
getTitle
()
public
Integer
getStatus
()
{
return
title
;
return
status
;
}
public
void
setSummary
(
String
summary
)
{
this
.
summary
=
summary
;
public
String
getCreatorDesc
()
{
return
creatorDesc
;
}
public
String
getSummary
()
{
return
summary
;
public
void
setCreatorDesc
(
String
creatorDesc
)
{
this
.
creatorDesc
=
creatorDesc
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
public
String
getModifiedByDesc
()
{
return
modifiedByDesc
;
}
public
String
getContent
()
{
return
content
;
public
void
setModifiedByDesc
(
String
modifiedByDesc
)
{
this
.
modifiedByDesc
=
modifiedByDesc
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
public
String
getNewsTitle
()
{
return
newsTitle
;
}
public
Integer
getStatus
()
{
return
status
;
public
void
setNewsTitle
(
String
newsTitle
)
{
this
.
newsTitle
=
newsTitle
;
}
public
String
getNewsSummary
()
{
return
newsSummary
;
}
public
void
setNewsSummary
(
String
newsSummary
)
{
this
.
newsSummary
=
newsSummary
;
}
public
String
getNewsContent
()
{
return
newsContent
;
}
public
void
setNewsContent
(
String
newsContent
)
{
this
.
newsContent
=
newsContent
;
}
public
String
getCover
()
{
return
c
over
;
public
String
get
News
Cover
()
{
return
newsC
over
;
}
public
void
set
Cover
(
String
c
over
)
{
this
.
cover
=
c
over
;
public
void
set
NewsCover
(
String
newsC
over
)
{
this
.
newsCover
=
newsC
over
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"title"
,
getTitle
())
.
append
(
"summary"
,
getSummary
())
.
append
(
"content"
,
getContent
())
.
append
(
"status"
,
getStatus
())
.
append
(
"creator"
,
getCreator
())
.
append
(
"createTime"
,
getCreateTime
())
...
...
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TbNewsMapper.java
浏览文件 @
21f91206
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import
java.util.List
;
import
com.ruoyi.system.domain.TbNews
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 新闻与活动Mapper接口
...
...
@@ -9,6 +10,7 @@ import com.ruoyi.system.domain.TbNews;
* @author ruoyi
* @date 2022-10-25
*/
@Mapper
public
interface
TbNewsMapper
{
/**
...
...
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbNewsServiceImpl.java
浏览文件 @
21f91206
package
com
.
ruoyi
.
system
.
service
.
impl
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.ruoyi.common.utils.DateUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.system.mapper.TbNewsMapper
;
...
...
@@ -21,6 +24,9 @@ public class TbNewsServiceImpl implements ITbNewsService
@Autowired
private
TbNewsMapper
tbNewsMapper
;
@Autowired
private
CommonServiceImpl
commonService
;
/**
* 查询新闻与活动
*
...
...
@@ -30,7 +36,12 @@ public class TbNewsServiceImpl implements ITbNewsService
@Override
public
TbNews
selectTbNewsById
(
Long
id
)
{
return
tbNewsMapper
.
selectTbNewsById
(
id
);
TbNews
tn
=
tbNewsMapper
.
selectTbNewsById
(
id
);
tn
.
setCreatorDesc
(
commonService
.
getUserName
(
tn
.
getCreator
()));
if
(
ObjectUtils
.
isNotEmpty
(
tn
.
getModifiedBy
())){
tn
.
setModifiedByDesc
(
commonService
.
getUserName
(
tn
.
getModifiedBy
()));
}
return
tn
;
}
/**
...
...
@@ -42,7 +53,15 @@ public class TbNewsServiceImpl implements ITbNewsService
@Override
public
List
<
TbNews
>
selectTbNewsList
(
TbNews
tbNews
)
{
return
tbNewsMapper
.
selectTbNewsList
(
tbNews
);
List
<
TbNews
>
list
=
tbNewsMapper
.
selectTbNewsList
(
tbNews
);
list
.
stream
().
filter
(
tbNews1
->
{
tbNews1
.
setCreatorDesc
(
commonService
.
getUserName
(
tbNews1
.
getCreator
()));
if
(
ObjectUtils
.
isNotEmpty
(
tbNews1
.
getModifiedBy
())){
tbNews1
.
setModifiedByDesc
(
commonService
.
getUserName
(
tbNews1
.
getModifiedBy
()));
}
return
true
;
}).
collect
(
Collectors
.
toList
());
return
list
;
}
/**
...
...
ruoyi-system/src/main/resources/mapper/system/TbNewsMapper.xml
浏览文件 @
21f91206
...
...
@@ -6,10 +6,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap
type=
"TbNews"
id=
"TbNewsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"
title"
column=
"
title"
/>
<result
property=
"
summary"
column=
"
summary"
/>
<result
property=
"
content"
column=
"
content"
/>
<result
property=
"
cover"
column=
"
cover"
/>
<result
property=
"
newsTitle"
column=
"news_
title"
/>
<result
property=
"
newsSummary"
column=
"news_
summary"
/>
<result
property=
"
newsContent"
column=
"news_
content"
/>
<result
property=
"
newsCover"
column=
"news_
cover"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"creator"
column=
"creator"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -19,18 +19,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql
id=
"selectTbNewsVo"
>
select id, title, summary, content, cover, status, creator, create_time, modified_by, update_time, remark from tb_news
select id, news_title, news_summary, news_content, news_cover, status, creator, create_time,
modified_by, update_time, remark from tb_news
</sql>
<select
id=
"selectTbNewsList"
parameterType=
"TbNews"
resultMap=
"TbNewsResult"
>
<include
refid=
"selectTbNewsVo"
/>
<where>
<if
test=
"title != null and title != ''"
>
and title = #{title}
</if>
<if
test=
"summary != null and summary != ''"
>
and summary = #{summary}
</if>
<!-- <if test="content != null and content != ''"> and content = #{content}</if>-->
<!-- <if test="status != null "> and status = #{status}</if>-->
<!-- <if test="creator != null "> and creator = #{creator}</if>-->
<!-- <if test="modifiedBy != null "> and modified_by = #{modifiedBy}</if>-->
<if
test=
"newsTitle != null and newsTitle != ''"
>
and news_title = #{newsTitle}
</if>
<if
test=
"newsSummary != null and newsSummary != ''"
>
and news_summary = #{newsSummary}
</if>
</where>
</select>
...
...
@@ -42,15 +39,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert
id=
"insertTbNews"
parameterType=
"TbNews"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into tb_news
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
title,summary,content,
cover,status,
news_title,news_summary,news_content,news_
cover,status,
<if
test=
"remark != null"
>
remark,
</if>
creator,create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"
title != null and title != ''"
>
#{t
itle},
</if>
<if
test=
"
summary != null"
>
#{s
ummary},
</if>
<if
test=
"
content != null and content != ''"
>
#{c
ontent},
</if>
<if
test=
"
cover != null and cover != ''"
>
#{c
over},
</if>
<if
test=
"
newsTitle != null and newsTitle != ''"
>
#{newsT
itle},
</if>
<if
test=
"
newsSummary != null and newsSummary != '' "
>
#{newsS
ummary},
</if>
<if
test=
"
newsContent != null and newsContent != ''"
>
#{newsC
ontent},
</if>
<if
test=
"
newsCover != null and newsCover != ''"
>
#{newsC
over},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"creator != null"
>
#{creator},
</if>
...
...
@@ -61,10 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update
id=
"updateTbNews"
parameterType=
"TbNews"
>
update tb_news
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"
title != null and title != ''"
>
title = #{t
itle},
</if>
<if
test=
"
summary != null"
>
summary = #{s
ummary},
</if>
<if
test=
"
content != null and content != ''"
>
content = #{c
ontent},
</if>
<if
test=
"
cover != null and cover != ''"
>
cover = #{c
over},
</if>
<if
test=
"
newsTitle != null and newsTitle != ''"
>
news_title = #{newsT
itle},
</if>
<if
test=
"
newsSummary != null and newsSummary != ''"
>
news_summary = #{newsS
ummary},
</if>
<if
test=
"
newsContent != null and newsContent != ''"
>
news_content = #{newsC
ontent},
</if>
<if
test=
"
newsCover != null and newsCover != ''"
>
news_cover = #{newsC
over},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"modifiedBy != null"
>
modified_by = #{modifiedBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论