Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
safe-campus-bbs
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
万成波
safe-campus-bbs
Commits
b8553733
Commit
b8553733
authored
Sep 30, 2025
by
万成波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
0d2c4a9c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
18 deletions
+45
-18
safe-campus-common/src/main/java/com/tangguo/common/core/domain/BaseEntity.java
.../main/java/com/tangguo/common/core/domain/BaseEntity.java
+2
-0
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
...n/java/com/tangguo/controller/pc/BbsMomentController.java
+16
-0
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
...us-moment/src/main/java/com/tangguo/domain/BbsMoment.java
+12
-17
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
...n/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
+12
-1
safe-campus-moment/src/main/resources/mapper/BbsMomentMapper.xml
...mpus-moment/src/main/resources/mapper/BbsMomentMapper.xml
+3
-0
No files found.
safe-campus-common/src/main/java/com/tangguo/common/core/domain/BaseEntity.java
View file @
b8553733
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.tangguo.common.annotation.Excel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -37,6 +38,7 @@ public class BaseEntity implements Serializable {
...
@@ -37,6 +38,7 @@ public class BaseEntity implements Serializable {
/**
/**
* 创建时间
* 创建时间
*/
*/
@Excel
(
name
=
"创建时间"
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
@TableField
(
fill
=
FieldFill
.
INSERT
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
"创建时间"
)
@ApiModelProperty
(
"创建时间"
)
...
...
safe-campus-moment/src/main/java/com/tangguo/controller/pc/BbsMomentController.java
View file @
b8553733
...
@@ -5,6 +5,7 @@ import com.tangguo.common.core.controller.BaseController;
...
@@ -5,6 +5,7 @@ import com.tangguo.common.core.controller.BaseController;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.domain.AjaxResult
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.core.page.TableDataInfo
;
import
com.tangguo.common.enums.BusinessType
;
import
com.tangguo.common.enums.BusinessType
;
import
com.tangguo.common.utils.poi.ExcelUtil
;
import
com.tangguo.domain.BbsMoment
;
import
com.tangguo.domain.BbsMoment
;
import
com.tangguo.domain.vo.BbsMomentListVO
;
import
com.tangguo.domain.vo.BbsMomentListVO
;
import
com.tangguo.service.IBbsMomentService
;
import
com.tangguo.service.IBbsMomentService
;
...
@@ -14,6 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
...
@@ -14,6 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -44,6 +46,20 @@ public class BbsMomentController extends BaseController {
...
@@ -44,6 +46,20 @@ public class BbsMomentController extends BaseController {
}
}
/**
* 导出动态列表
*/
@ApiOperation
(
"导出动态列表"
)
@PreAuthorize
(
"@ss.hasPermi('points:points:export')"
)
@Log
(
title
=
"导出动态列表"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/list/export"
)
public
void
export
(
HttpServletResponse
response
,
BbsMoment
bbsMoment
)
{
List
<
BbsMoment
>
list
=
bbsMomentService
.
selectBbsMomentList
(
bbsMoment
);
ExcelUtil
<
BbsMoment
>
util
=
new
ExcelUtil
<>(
BbsMoment
.
class
);
util
.
exportExcel
(
response
,
list
,
"动态数据"
);
}
/**
/**
* 获取动态详细信息
* 获取动态详细信息
*/
*/
...
...
safe-campus-moment/src/main/java/com/tangguo/domain/BbsMoment.java
View file @
b8553733
...
@@ -15,6 +15,7 @@ import lombok.ToString;
...
@@ -15,6 +15,7 @@ import lombok.ToString;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 动态对象 bbs_moment
* 动态对象 bbs_moment
...
@@ -37,94 +38,88 @@ public class BbsMoment extends BaseEntity {
...
@@ -37,94 +38,88 @@ public class BbsMoment extends BaseEntity {
private
Long
id
;
private
Long
id
;
/** 发布人用户名 */
/** 发布人用户名 */
@Excel
(
name
=
"发布人用户名"
)
@Excel
(
name
=
"用户名"
,
sort
=
2
)
@ApiModelProperty
(
"发布人用户名"
)
private
String
userName
;
private
String
userName
;
/** 动态内容 */
/** 动态内容 */
@Excel
(
name
=
"动态内容"
)
@Excel
(
name
=
"动态内容"
,
sort
=
4
)
@ApiModelProperty
(
"动态内容"
)
@ApiModelProperty
(
"动态内容"
)
private
String
content
;
private
String
content
;
/** 动态类型:IMAGE 图片动态、VIDEO 视频动态、URL 链接动态 */
/** 动态类型:IMAGE 图片动态、VIDEO 视频动态、URL 链接动态 */
@Excel
(
name
=
"动态类型:IMAGE 图片动态、VIDEO 视频动态、URL 链接动态"
)
@ApiModelProperty
(
"动态类型:IMAGE 图片动态、VIDEO 视频动态、URL 链接动态"
)
@ApiModelProperty
(
"动态类型:IMAGE 图片动态、VIDEO 视频动态、URL 链接动态"
)
private
String
type
;
private
String
type
;
/** 话题名称(逗号分割) */
/** 话题名称(逗号分割) */
@Excel
(
name
=
"话题名称"
,
readConverterExp
=
"逗号分割"
)
@Excel
(
name
=
"话题名称"
,
sort
=
5
)
@ApiModelProperty
(
"话题名称(逗号分割)"
)
@ApiModelProperty
(
"话题名称(逗号分割)"
)
private
String
topicNames
;
private
String
topicNames
;
/** 话题Ids(逗号分割) */
/** 话题Ids(逗号分割) */
@Excel
(
name
=
"话题Ids"
,
readConverterExp
=
"逗号分割"
)
@ApiModelProperty
(
"话题Ids(逗号分割)"
)
@ApiModelProperty
(
"话题Ids(逗号分割)"
)
private
String
topicIds
;
private
String
topicIds
;
/** 外部链接地址 */
/** 外部链接地址 */
@Excel
(
name
=
"外部链接地址"
)
@ApiModelProperty
(
"外部链接地址"
)
@ApiModelProperty
(
"外部链接地址"
)
private
String
linkUrl
;
private
String
linkUrl
;
/** 是否开启评论:0 否、1 是 */
/** 是否开启评论:0 否、1 是 */
@Excel
(
name
=
"是否开启评论:0 否、1 是"
)
@ApiModelProperty
(
"是否开启评论:0 否、1 是"
)
@ApiModelProperty
(
"是否开启评论:0 否、1 是"
)
private
Integer
isEnableComment
;
private
Integer
isEnableComment
;
/** 是否精选评论:0 否、1 是 */
/** 是否精选评论:0 否、1 是 */
@Excel
(
name
=
"是否精选评论:0 否、1 是"
)
@ApiModelProperty
(
"是否精选评论:0 否、1 是"
)
@ApiModelProperty
(
"是否精选评论:0 否、1 是"
)
private
Integer
isEnableFeaturedComment
;
private
Integer
isEnableFeaturedComment
;
/** 是否开启投票:0 否、1 是 */
/** 是否开启投票:0 否、1 是 */
@Excel
(
name
=
"是否开启投票:0 否、1 是"
)
@ApiModelProperty
(
"是否开启投票:0 否、1 是"
)
@ApiModelProperty
(
"是否开启投票:0 否、1 是"
)
private
Integer
isEnableVote
;
private
Integer
isEnableVote
;
/** 投票标题 */
/** 投票标题 */
@Excel
(
name
=
"投票标题"
)
@ApiModelProperty
(
"投票标题"
)
@ApiModelProperty
(
"投票标题"
)
private
String
voteTitle
;
private
String
voteTitle
;
/** 投票选项类型:TEXT 文字、IMAGE 图片 */
/** 投票选项类型:TEXT 文字、IMAGE 图片 */
@Excel
(
name
=
"投票选项类型:TEXT 文字、IMAGE 图片"
)
@ApiModelProperty
(
"投票选项类型:TEXT 文字、IMAGE 图片"
)
@ApiModelProperty
(
"投票选项类型:TEXT 文字、IMAGE 图片"
)
private
String
voteOptionType
;
private
String
voteOptionType
;
/** 投票开始时间 */
/** 投票开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"投票开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
"投票开始时间"
)
@ApiModelProperty
(
"投票开始时间"
)
private
Date
voteStartTime
;
private
Date
voteStartTime
;
/** 投票结束时间 */
/** 投票结束时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"投票结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@ApiModelProperty
(
"投票结束时间"
)
@ApiModelProperty
(
"投票结束时间"
)
private
Date
voteEndTime
;
private
Date
voteEndTime
;
/** 动态点赞人数 */
/** 动态点赞人数 */
@Excel
(
name
=
"
动态点赞人数"
)
@Excel
(
name
=
"
点赞人数"
,
sort
=
6
)
@ApiModelProperty
(
"动态点赞人数"
)
@ApiModelProperty
(
"动态点赞人数"
)
private
Integer
likeCount
;
private
Integer
likeCount
;
/** 动态评论人数 */
/** 动态评论人数 */
@Excel
(
name
=
"
动态评论人数"
)
@Excel
(
name
=
"
评论人数"
,
sort
=
7
)
@ApiModelProperty
(
"动态评论人数"
)
@ApiModelProperty
(
"动态评论人数"
)
private
Integer
commentCount
;
private
Integer
commentCount
;
/** 动态投票人数 */
/** 动态投票人数 */
@Excel
(
name
=
"动态投票人数"
)
@ApiModelProperty
(
"动态投票人数"
)
@ApiModelProperty
(
"动态投票人数"
)
private
Integer
voteCount
;
private
Integer
voteCount
;
/** 用户姓名 */
/** 用户姓名 */
@Excel
(
name
=
"姓名"
,
sort
=
1
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
nickName
;
private
String
nickName
;
/** 用户部门 */
/** 用户部门 */
@Excel
(
name
=
"所在部门"
,
sort
=
3
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
deptName
;
private
String
deptName
;
/** 动态附件 */
@TableField
(
exist
=
false
)
private
List
<
BbsMomentAttachment
>
attachments
;
}
}
safe-campus-moment/src/main/java/com/tangguo/service/impl/BbsMomentServiceImpl.java
View file @
b8553733
...
@@ -67,7 +67,18 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
...
@@ -67,7 +67,18 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
*/
*/
@Override
@Override
public
List
<
BbsMoment
>
selectBbsMomentList
(
BbsMoment
moment
)
{
public
List
<
BbsMoment
>
selectBbsMomentList
(
BbsMoment
moment
)
{
return
this
.
baseMapper
.
selectBbsMomentList
(
moment
);
List
<
BbsMoment
>
dbMoments
=
this
.
baseMapper
.
selectBbsMomentList
(
moment
);
List
<
Long
>
momentIds
=
dbMoments
.
stream
().
map
(
BbsMoment:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BbsMomentAttachment
>
dbAtts
=
this
.
attachmentsService
.
getAttachments
(
momentIds
);
for
(
BbsMoment
dbMoment
:
dbMoments
)
{
List
<
BbsMomentAttachment
>
atts
=
dbAtts
.
stream
()
.
filter
(
a
->
dbMoment
.
getId
().
equals
(
a
.
getMomentId
()))
.
collect
(
Collectors
.
toList
());
dbMoment
.
setAttachments
(
atts
);
}
return
dbMoments
;
}
}
...
...
safe-campus-moment/src/main/resources/mapper/BbsMomentMapper.xml
View file @
b8553733
...
@@ -19,6 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -19,6 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"moment.content != null and moment.content != ''"
>
<if
test=
"moment.content != null and moment.content != ''"
>
m.content LIKE CONCAT('%', #{moment.content}, '%')
m.content LIKE CONCAT('%', #{moment.content}, '%')
</if>
</if>
<if
test=
"moment.topicNames != null and moment.topicNames != ''"
>
AND m.topic_names LIKE CONCAT('%', #{moment.topicNames}, '%')
</if>
<if
test=
"moment.params.startTime != null and moment.params.startTime != ''"
>
<if
test=
"moment.params.startTime != null and moment.params.startTime != ''"
>
AND DATE_FORMAT(m.create_time, '%Y-%m-%d') >= #{moment.params.startTime}
AND DATE_FORMAT(m.create_time, '%Y-%m-%d') >= #{moment.params.startTime}
</if>
</if>
...
...
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