Commit 2af2275a by 阳浪

查看我的投稿接口

parent f8fd8738
......@@ -19,8 +19,8 @@ import java.util.Map;
@FeignClient(name = "trainingProject", contextId = "TpCommentClient")
public interface TpCommentClient {
@GetMapping("/tpComment/list")
Page<PageCommentVo> list(
@GetMapping("/tpComment/listByMyself")
Page<PageCommentVo> listByMyself(
@RequestParam(name = "trainingProjectId")Long trainingProjectId,
@RequestParam(name = "bizType", required = false) Integer bizType,
@RequestParam(name = "accountId")Long accountId,
......@@ -29,6 +29,16 @@ public interface TpCommentClient {
@RequestParam(name = "type") Integer type
);
@GetMapping("/tpComment/list")
Page<PageCommentVo> list(
@RequestParam(name = "trainingProjectId")Long trainingProjectId,
@RequestParam(name = "bizType", required = false) Integer bizType,
@RequestParam(name = "accountId")Long accountId,
@RequestParam(name = "pageNo")Integer pageNo,
@RequestParam(name = "pageSize")Integer pageSize,
@RequestParam(name = "type") Integer type
);
@PostMapping("/tpComment/delete")
Boolean delete(@RequestBody TpCommentVo tpComment);
......
......@@ -54,5 +54,8 @@ public class PageCommentVo {
@ApiModelProperty(value = "评论对象")
private String replyName;
@ApiModelProperty(value = "关联业务类型:1活动服务;2新闻资讯;3培训测试;4培训资讯")
private Integer bizType;
}
......@@ -75,6 +75,41 @@ public class TpCommentController {
}
/**
* 培训项目 我的评论列表
*
* @param trainingProjectId
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/listByMyself")
public Page<PageCommentVo> listByMyself(
@RequestParam(name = "trainingProjectId", required = false) Long trainingProjectId,
@RequestParam(name = "bizType", required = false) Integer bizType,
@RequestParam(name = "accountId") Long accountId,
@RequestParam(name = "pageNo") Integer pageNo,
@RequestParam(name = "pageSize") Integer pageSize,
@RequestParam(name = "type") Integer type
) {
Page<PageCommentVo> page = iTpCommentService.getCommentPage(ContextHolder.get().getAccountId(),trainingProjectId, bizType, accountId, pageNo, pageSize, type);
String fullName;
String name;
for (PageCommentVo listCommentVo : page.getRecords()) {
listCommentVo.setContent(StringEscapeUtils.unescapeJava(listCommentVo.getContent()));
AccountVO accountVO = accountClient.findById(listCommentVo.getAccountId());
fullName = accountVO.getFullName();
name = accountVO.getName();
listCommentVo.setCommentator(name);
listCommentVo.setReplyName("--");
listCommentVo.setCommentatorName(null == fullName || "" == fullName ? name : fullName);
Boolean hasThumbsUp = tpCommentThumbsUpService.judgeHasThumbsUp(listCommentVo.getId());
listCommentVo.setHasThumbsUp(hasThumbsUp);
}
return page;
}
/**
* 培训项目 评论列表
*
* @param trainingProjectId
......@@ -92,7 +127,7 @@ public class TpCommentController {
@RequestParam(name = "type") Integer type
) {
Page<PageCommentVo> page = iTpCommentService.getCommentPage(trainingProjectId, bizType, accountId, pageNo, pageSize, type);
Page<PageCommentVo> page = iTpCommentService.getCommentPage(null,trainingProjectId, bizType, accountId, pageNo, pageSize, type);
String fullName;
String name;
TpCommentReply reply = new TpCommentReply();
......@@ -142,7 +177,7 @@ public class TpCommentController {
if (!CollectionUtils.isEmpty(list1)) {
for (TpCommentReply tr : list1
) {
TpCommentReplyVo trv=new TpCommentReplyVo();
TpCommentReplyVo trv=new TpCommentReplyVo();
BeanUtils.copyProperties(tr,trv);
list2.add(trv);
}
......
......@@ -25,9 +25,9 @@ public interface TpCommentMapper extends BaseMapper<TpComment> {
* @param rowBounds
* @return
*/
List<PageCommentVo> searchPage(@Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId, RowBounds rowBounds,@Param("type") Integer type);
List<PageCommentVo> searchPage(@Param("createById") Long createById, @Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId, RowBounds rowBounds,@Param("type") Integer type);
Integer searchPageCount(@Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId,@Param("type") Integer type);
Integer searchPageCount(@Param("createById") Long createById,@Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId,@Param("type") Integer type);
List<PageCommentVo> getList(@Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId);
List<PageCommentVo> getList(@Param("createById") Long createById,@Param("trainingProjectId") Long trainingProjectId, @Param("bizType") Integer bizType, @Param("accountId") Long accountId);
}
......@@ -17,6 +17,7 @@
<result column="tb_site_id" property="siteId"/>
<result column="tb_org_id" property="orgId"/>
<result column="tb_company_id" property="companyId"/>
<result column="biz_type" property="bizType"/>
</resultMap>
<!-- 通用查询结果列 -->
......@@ -47,6 +48,7 @@
<id column="replys" property="replys"/>
<id column="thumbsUp" property="thumbsUps"/>
<id column="state" property="state"/>
<result column="biz_type" property="bizType"/>
</resultMap>
<!-- 培训项目 评论分页 -->
......@@ -61,7 +63,8 @@
a.user_avatar,
a. STATUS,
COUNT(r.id) AS replys,
a.state
a.state,
a.biz_type
FROM
(
SELECT
......@@ -73,7 +76,8 @@
b.user_avatar,
COUNT(tu.id) AS thumbsUp,
b. STATUS,
b.state
b.state,
b.biz_type
FROM
(
SELECT
......@@ -91,20 +95,25 @@
0
END
) AS STATUS,
c.state
c.state,
c.biz_type
FROM
tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId}
WHERE
c.`training_project_id` = #{trainingProjectId}
WHERE c.`audit_status` = 0
<if test="trainingProjectId != null">
AND c.`training_project_id` = #{trainingProjectId}
</if>
<if test="createById != null">
AND c.`create_by_id` = #{createById}
</if>
<if test="bizType == null">
AND c.biz_type=1
</if>
<if test="bizType != null">
AND c.biz_type=#{bizType}
</if>
AND c.`audit_status` = 0
<if test="type != 0 ">
and c.state=0
</if>
......@@ -138,7 +147,8 @@
b.user_avatar,
COUNT(tu.id) AS thumbsUp,
b. STATUS,
b.state
b.state,
b.biz_type
FROM
(
SELECT
......@@ -156,20 +166,25 @@
ELSE
0
END
) AS STATUS
) AS STATUS,
c.biz_type
FROM
tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId}
WHERE
c.`training_project_id` = #{trainingProjectId}
WHERE c.`audit_status` = 0
<if test="trainingProjectId != null">
AND c.`training_project_id` = #{trainingProjectId}
</if>
<if test="createById != null">
AND c.`create_by_id` = #{createById}
</if>
<if test="bizType == null">
AND c.biz_type=1
</if>
<if test="bizType != null">
AND c.biz_type=#{bizType}
</if>
AND c.`audit_status` = 0
<if test="type != 0 ">
and c.state=0
</if>
......@@ -195,7 +210,8 @@
a.user_avatar,
a. STATUS,
COUNT(r.id) AS replys,
a.state
a.state,
a.biz_type
FROM
(
SELECT
......@@ -207,7 +223,8 @@
b.user_avatar,
COUNT(tu.id) AS thumbsUp,
b. STATUS,
b.state
b.state,
b.biz_type
FROM
(
SELECT
......@@ -225,20 +242,25 @@
0
END
) AS STATUS,
c.state
c.state,
c.biz_type
FROM
tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId}
WHERE
c.`training_project_id` = #{trainingProjectId}
WHERE c.`audit_status` = 0
<if test="trainingProjectId != null">
AND c.`training_project_id` = #{trainingProjectId}
</if>
<if test="createById != null">
AND c.`create_by_id` = #{createById}
</if>
<if test="bizType == null">
AND c.biz_type=1
</if>
<if test="bizType != null">
AND c.biz_type=#{bizType}
</if>
AND c.`audit_status` = 0
GROUP BY
c.`id`
) b
......
......@@ -17,7 +17,7 @@ import com.yizhi.training.application.vo.manage.PageCommentVo;
*/
public interface ITpCommentService extends IService<TpComment> {
Page<PageCommentVo> getCommentPage(Long trainingProjectId, Integer bizType, Long accountId, int pageNo, int pageSize,int type);
Page<PageCommentVo> getCommentPage(Long createById,Long trainingProjectId, Integer bizType, Long accountId, int pageNo, int pageSize,int type);
List<PageCommentVo> getList(Long trainingProjectId, Integer bizType, Long accountId);
List<PageCommentVo> getList(Long createById,Long trainingProjectId, Integer bizType, Long accountId);
}
......@@ -24,17 +24,17 @@ import org.springframework.stereotype.Service;
public class TpCommentServiceImpl extends ServiceImpl<TpCommentMapper, TpComment> implements ITpCommentService {
@Override
public Page<PageCommentVo> getCommentPage(Long trainingProjectId, Integer bizType, Long accountId, int pageNo, int pageSize, int type) {
public Page<PageCommentVo> getCommentPage(Long createById,Long trainingProjectId, Integer bizType, Long accountId, int pageNo, int pageSize, int type) {
Page<PageCommentVo> page = new Page<PageCommentVo>(pageNo, pageSize);
page.setRecords(this.baseMapper.searchPage(trainingProjectId, bizType, accountId, new RowBounds(page.getOffset(), page.getLimit()),type));
Integer count = this.baseMapper.searchPageCount(trainingProjectId, bizType, accountId,type);
page.setRecords(this.baseMapper.searchPage(createById,trainingProjectId, bizType, accountId, new RowBounds(page.getOffset(), page.getLimit()),type));
Integer count = this.baseMapper.searchPageCount(createById,trainingProjectId, bizType, accountId,type);
page.setTotal(count);
return page;
}
@Override
public List<PageCommentVo> getList(Long trainingProjectId, Integer bizType, Long accountId){
List<PageCommentVo> list = this.baseMapper.getList(trainingProjectId, bizType, accountId);
public List<PageCommentVo> getList(Long createById,Long trainingProjectId, Integer bizType, Long accountId){
List<PageCommentVo> list = this.baseMapper.getList(createById,trainingProjectId, bizType, accountId);
return list;
}
}
......@@ -72,7 +72,7 @@ public class CommentListExportAsync extends
fileDir.mkdir();
}
//项目评论开始组装
List<PageCommentVo> list = tpCommentService.getList(trainingProjectId, null, accountId);
List<PageCommentVo> list = tpCommentService.getList(null,trainingProjectId, null, accountId);
List<PageCommentVo> listVO = new ArrayList<PageCommentVo>();
TpCommentReply reply=new TpCommentReply();
PageCommentVo vo = new PageCommentVo();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment