Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
39dcc55e
Commit
39dcc55e
authored
Sep 29, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加评论
parent
b558724e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
337 additions
and
0 deletions
+337
-0
UserCommentFindDTO.java
...github/wxiaoqi/security/admin/dto/UserCommentFindDTO.java
+22
-0
UserComment.java
...com/github/wxiaoqi/security/admin/entity/UserComment.java
+79
-0
UserCommentVo.java
...a/com/github/wxiaoqi/security/admin/vo/UserCommentVo.java
+31
-0
UserCommentBiz.java
...com/github/wxiaoqi/security/admin/biz/UserCommentBiz.java
+109
-0
UserCommentMapper.java
...thub/wxiaoqi/security/admin/mapper/UserCommentMapper.java
+21
-0
AppUserCommentController.java
...wxiaoqi/security/admin/rest/AppUserCommentController.java
+50
-0
UserCommentMapper.xml
...ace-admin/src/main/resources/mapper/UserCommentMapper.xml
+25
-0
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/UserCommentFindDTO.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public
class
UserCommentFindDTO
extends
PageParam
{
private
Integer
parentId
;
private
Integer
soureId
;
private
Integer
rootParentId
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/UserComment.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 16:41
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table
(
name
=
"user_comment"
)
public
class
UserComment
{
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
private
Integer
id
;
/**
* 被评论id
*/
@Column
(
name
=
"parent_id"
)
private
Integer
parentId
;
/**
* 资源ID
*/
@Column
(
name
=
"soure_id"
)
private
Integer
soureId
;
/**
* 资源类型:1-活动;
*/
@Column
(
name
=
"soure_type"
)
private
Integer
soureType
;
/**
* 用户ID
*/
@Column
(
name
=
"user_id"
)
private
Integer
userId
;
/**
* 用户ID
*/
@Column
(
name
=
"comment_text"
)
private
String
commentText
;
/**
* 回复评论者的ID
*/
@Column
(
name
=
"to_user_id"
)
private
Integer
toUserId
;
/**
* 最上级id
*/
@Column
(
name
=
"root_parent_id"
)
private
Integer
rootParentId
;
/**
* 回复数量
*/
@Column
(
name
=
"reply_num"
)
private
Integer
replyNum
;
/**
*评论时间
*/
@Column
(
name
=
"create_time"
)
private
Date
createTime
;
/**
* 是否删除:0-正常;1-删除
*/
@Column
(
name
=
"is_del"
)
private
Integer
isDel
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/UserCommentVo.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
import
com.github.wxiaoqi.security.admin.entity.UserComment
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/12 9:20
*/
@Data
public
class
UserCommentVo
extends
UserComment
{
@ApiModelProperty
(
"用户名称"
)
private
String
userName
;
@ApiModelProperty
(
"用户名称"
)
private
String
toUserName
;
private
PageDataVO
<
UserCommentVo
>
childer
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserCommentBiz.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
cn.hutool.json.JSONUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.wxiaoqi.security.admin.dto.CompanyInfoFindDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO
;
import
com.github.wxiaoqi.security.admin.entity.*
;
import
com.github.wxiaoqi.security.admin.mapper.CompanyInfoMapper
;
import
com.github.wxiaoqi.security.admin.mapper.UserCommentMapper
;
import
com.github.wxiaoqi.security.admin.vo.UserCommentVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.app.entity.Cofig
;
import
com.xxfc.platform.app.feign.ConfigFeign
;
import
com.xxfc.platform.universal.dto.SendMsgDTO
;
import
com.xxfc.platform.universal.feign.MQSenderFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.Date
;
import
java.util.List
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.
ADMIN_TOPIC
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.
KEY_CORPORATION_UPD
;
@Service
@Slf4j
public
class
UserCommentBiz
extends
BaseBiz
<
UserCommentMapper
,
UserComment
>{
public
void
addOrUpd
(
UserComment
userComment
){
if
(
StringUtils
.
isBlank
(
userComment
.
getCommentText
())){
throw
new
BaseException
(
"参数不能为空"
,
ResultCode
.
FAILED_CODE
);
}
Integer
parentId
=
userComment
.
getParentId
()
==
null
?
0
:
userComment
.
getParentId
();
if
(
parentId
>
0
){
UserComment
parentComment
=
selectById
(
parentId
);
if
(
parentComment
==
null
){
throw
new
BaseException
(
"该评论不存在"
,
ResultCode
.
FAILED_CODE
);
}
userComment
.
setSoureId
(
parentComment
.
getSoureId
());
userComment
.
setSoureType
(
parentComment
.
getSoureType
());
userComment
.
setToUserId
(
parentComment
.
getUserId
());
userComment
.
setRootParentId
(
parentComment
.
getRootParentId
());
}
else
{
if
(
userComment
.
getSoureId
()
==
null
||
userComment
.
getSoureId
()
==
0
){
throw
new
BaseException
(
"资源ID不能为空"
,
ResultCode
.
FAILED_CODE
);
}
}
userComment
.
setCreateTime
(
new
Date
());
insertSelective
(
userComment
);
Integer
id
=
userComment
.
getId
();
if
(
id
>
0
){
Integer
rootParentId
=
userComment
.
getRootParentId
()
==
null
?
0
:
userComment
.
getRootParentId
();
if
(
rootParentId
==
0
){
UserComment
userComment1
=
new
UserComment
();
userComment1
.
setId
(
id
);
userComment1
.
setRootParentId
(
id
);
updateSelectiveById
(
userComment1
);
}
else
{
mapper
.
addreplyNum
(
rootParentId
);
}
}
}
public
PageDataVO
<
UserCommentVo
>
selectList
(
UserCommentFindDTO
userCommentFindDTO
){
PageHelper
.
startPage
(
userCommentFindDTO
.
getPage
(),
userCommentFindDTO
.
getLimit
());
PageInfo
<
UserCommentVo
>
pageInfo
=
new
PageInfo
<>(
getList
(
userCommentFindDTO
));
PageDataVO
<
UserCommentVo
>
dataVO
=
PageDataVO
.
pageInfo
(
pageInfo
);
Integer
rootParentId
=
userCommentFindDTO
.
getRootParentId
()
==
null
?
0
:
userCommentFindDTO
.
getRootParentId
();
if
(
rootParentId
==
0
&&
dataVO
.
getData
()
!=
null
){
List
<
UserCommentVo
>
list
=
dataVO
.
getData
();
if
(
list
!=
null
&&
list
.
size
()
>
0
){
for
(
UserCommentVo
commentVo:
list
){
userCommentFindDTO
.
setParentId
(
null
);
userCommentFindDTO
.
setRootParentId
(
commentVo
.
getRootParentId
());
PageDataVO
<
UserCommentVo
>
pageDataVO
=
selectList
(
userCommentFindDTO
);
if
(
pageDataVO
!=
null
){
commentVo
.
setChilder
(
pageDataVO
);
}
}
}
}
return
dataVO
;
}
public
List
<
UserCommentVo
>
getList
(
UserCommentFindDTO
commentFindDTO
){
return
mapper
.
selectList
(
commentFindDTO
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/UserCommentMapper.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO
;
import
com.github.wxiaoqi.security.admin.entity.UserComment
;
import
com.github.wxiaoqi.security.admin.vo.UserCommentVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Update
;
import
tk.mybatis.mapper.additional.idlist.SelectByIdListMapper
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
public
interface
UserCommentMapper
extends
Mapper
<
UserComment
>,
SelectByIdListMapper
<
UserComment
,
Integer
>
{
@Update
(
"update user_comment set reply_num=reply_num+1 where id=#{id}"
)
void
addreplyNum
(
@Param
(
"id"
)
Integer
id
);
List
<
UserCommentVo
>
selectList
(
UserCommentFindDTO
commentFindDTO
);
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUserCommentController.java
0 → 100644
View file @
39dcc55e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.UserCommentBiz
;
import
com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO
;
import
com.github.wxiaoqi.security.admin.entity.UserComment
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping
(
"app/comment"
)
@Api
(
tags
=
{
"评论"
})
public
class
AppUserCommentController
extends
BaseController
<
UserCommentBiz
>
{
@GetMapping
(
"app/unauth/selectList"
)
@ApiModelProperty
(
"列表"
)
@IgnoreUserToken
public
ObjectRestResponse
selectList
(
UserCommentFindDTO
commentFindDTO
)
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
selectList
(
commentFindDTO
));
}
@PostMapping
(
"send"
)
@ApiModelProperty
(
"商家入驻申请"
)
public
ObjectRestResponse
apply
(
@RequestBody
UserComment
userComment
)
{
userComment
.
setUserId
(
getCurrentUserIdInt
());
baseBiz
.
addOrUpd
(
userComment
);
return
ObjectRestResponse
.
succ
();
}
}
ace-modules/ace-admin/src/main/resources/mapper/UserCommentMapper.xml
0 → 100644
View file @
39dcc55e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.github.wxiaoqi.security.admin.mapper.UserCommentMapper"
>
<select
id=
"selectList"
resultType=
"com.github.wxiaoqi.security.admin.vo.UserCommentVo"
parameterType=
"com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO"
>
SELECT
c.*,
IFNULL(d1.realname,d1.nickname) as userName,
IFNULL(d2.realname,d2.nickname) as toUserName
FROM user_comment c
LEFT JOIN app_user_detail d1 ON c.user_id=d1.userid
LEFT JOIN app_user_detail d2 ON c.to_user_id=d2.userid
<where>
c.soure_id=#{soureId}
<if
test=
"parentId != null "
>
AND c.`parent_id`= #{parentId}
</if>
<if
test=
"rootParentId != null and rootParentId > 0 "
>
AND ( c.`parent_id` > 0 and c.root_parent_id = #{rootParentId} )
</if>
</where>
order by c.create_time ASC
</select>
</mapper>
\ No newline at end of file
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