Commit 2af2275a by 阳浪

查看我的投稿接口

parent f8fd8738
...@@ -19,6 +19,16 @@ import java.util.Map; ...@@ -19,6 +19,16 @@ import java.util.Map;
@FeignClient(name = "trainingProject", contextId = "TpCommentClient") @FeignClient(name = "trainingProject", contextId = "TpCommentClient")
public interface TpCommentClient { public interface TpCommentClient {
@GetMapping("/tpComment/listByMyself")
Page<PageCommentVo> listByMyself(
@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
);
@GetMapping("/tpComment/list") @GetMapping("/tpComment/list")
Page<PageCommentVo> list( Page<PageCommentVo> list(
@RequestParam(name = "trainingProjectId")Long trainingProjectId, @RequestParam(name = "trainingProjectId")Long trainingProjectId,
......
...@@ -54,5 +54,8 @@ public class PageCommentVo { ...@@ -54,5 +54,8 @@ public class PageCommentVo {
@ApiModelProperty(value = "评论对象") @ApiModelProperty(value = "评论对象")
private String replyName; private String replyName;
@ApiModelProperty(value = "关联业务类型:1活动服务;2新闻资讯;3培训测试;4培训资讯")
private Integer bizType;
} }
...@@ -75,6 +75,41 @@ public class TpCommentController { ...@@ -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 * @param trainingProjectId
...@@ -92,7 +127,7 @@ public class TpCommentController { ...@@ -92,7 +127,7 @@ public class TpCommentController {
@RequestParam(name = "type") Integer type @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 fullName;
String name; String name;
TpCommentReply reply = new TpCommentReply(); TpCommentReply reply = new TpCommentReply();
......
...@@ -25,9 +25,9 @@ public interface TpCommentMapper extends BaseMapper<TpComment> { ...@@ -25,9 +25,9 @@ public interface TpCommentMapper extends BaseMapper<TpComment> {
* @param rowBounds * @param rowBounds
* @return * @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 @@ ...@@ -17,6 +17,7 @@
<result column="tb_site_id" property="siteId"/> <result column="tb_site_id" property="siteId"/>
<result column="tb_org_id" property="orgId"/> <result column="tb_org_id" property="orgId"/>
<result column="tb_company_id" property="companyId"/> <result column="tb_company_id" property="companyId"/>
<result column="biz_type" property="bizType"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
<id column="replys" property="replys"/> <id column="replys" property="replys"/>
<id column="thumbsUp" property="thumbsUps"/> <id column="thumbsUp" property="thumbsUps"/>
<id column="state" property="state"/> <id column="state" property="state"/>
<result column="biz_type" property="bizType"/>
</resultMap> </resultMap>
<!-- 培训项目 评论分页 --> <!-- 培训项目 评论分页 -->
...@@ -61,7 +63,8 @@ ...@@ -61,7 +63,8 @@
a.user_avatar, a.user_avatar,
a. STATUS, a. STATUS,
COUNT(r.id) AS replys, COUNT(r.id) AS replys,
a.state a.state,
a.biz_type
FROM FROM
( (
SELECT SELECT
...@@ -73,7 +76,8 @@ ...@@ -73,7 +76,8 @@
b.user_avatar, b.user_avatar,
COUNT(tu.id) AS thumbsUp, COUNT(tu.id) AS thumbsUp,
b. STATUS, b. STATUS,
b.state b.state,
b.biz_type
FROM FROM
( (
SELECT SELECT
...@@ -91,20 +95,25 @@ ...@@ -91,20 +95,25 @@
0 0
END END
) AS STATUS, ) AS STATUS,
c.state c.state,
c.biz_type
FROM FROM
tp_comment c tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id` LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId} AND tuu.`account_id` = #{accountId}
WHERE WHERE c.`audit_status` = 0
c.`training_project_id` = #{trainingProjectId} <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"> <if test="bizType == null">
AND c.biz_type=1 AND c.biz_type=1
</if> </if>
<if test="bizType != null"> <if test="bizType != null">
AND c.biz_type=#{bizType} AND c.biz_type=#{bizType}
</if> </if>
AND c.`audit_status` = 0
<if test="type != 0 "> <if test="type != 0 ">
and c.state=0 and c.state=0
</if> </if>
...@@ -138,7 +147,8 @@ ...@@ -138,7 +147,8 @@
b.user_avatar, b.user_avatar,
COUNT(tu.id) AS thumbsUp, COUNT(tu.id) AS thumbsUp,
b. STATUS, b. STATUS,
b.state b.state,
b.biz_type
FROM FROM
( (
SELECT SELECT
...@@ -156,20 +166,25 @@ ...@@ -156,20 +166,25 @@
ELSE ELSE
0 0
END END
) AS STATUS ) AS STATUS,
c.biz_type
FROM FROM
tp_comment c tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id` LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId} AND tuu.`account_id` = #{accountId}
WHERE WHERE c.`audit_status` = 0
c.`training_project_id` = #{trainingProjectId} <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"> <if test="bizType == null">
AND c.biz_type=1 AND c.biz_type=1
</if> </if>
<if test="bizType != null"> <if test="bizType != null">
AND c.biz_type=#{bizType} AND c.biz_type=#{bizType}
</if> </if>
AND c.`audit_status` = 0
<if test="type != 0 "> <if test="type != 0 ">
and c.state=0 and c.state=0
</if> </if>
...@@ -195,7 +210,8 @@ ...@@ -195,7 +210,8 @@
a.user_avatar, a.user_avatar,
a. STATUS, a. STATUS,
COUNT(r.id) AS replys, COUNT(r.id) AS replys,
a.state a.state,
a.biz_type
FROM FROM
( (
SELECT SELECT
...@@ -207,7 +223,8 @@ ...@@ -207,7 +223,8 @@
b.user_avatar, b.user_avatar,
COUNT(tu.id) AS thumbsUp, COUNT(tu.id) AS thumbsUp,
b. STATUS, b. STATUS,
b.state b.state,
b.biz_type
FROM FROM
( (
SELECT SELECT
...@@ -225,20 +242,25 @@ ...@@ -225,20 +242,25 @@
0 0
END END
) AS STATUS, ) AS STATUS,
c.state c.state,
c.biz_type
FROM FROM
tp_comment c tp_comment c
LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id` LEFT JOIN tp_comment_thumbs_up tuu ON c.`id` = tuu.`tp_comment_id`
AND tuu.`account_id` = #{accountId} AND tuu.`account_id` = #{accountId}
WHERE WHERE c.`audit_status` = 0
c.`training_project_id` = #{trainingProjectId} <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"> <if test="bizType == null">
AND c.biz_type=1 AND c.biz_type=1
</if> </if>
<if test="bizType != null"> <if test="bizType != null">
AND c.biz_type=#{bizType} AND c.biz_type=#{bizType}
</if> </if>
AND c.`audit_status` = 0
GROUP BY GROUP BY
c.`id` c.`id`
) b ) b
......
...@@ -17,7 +17,7 @@ import com.yizhi.training.application.vo.manage.PageCommentVo; ...@@ -17,7 +17,7 @@ import com.yizhi.training.application.vo.manage.PageCommentVo;
*/ */
public interface ITpCommentService extends IService<TpComment> { 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; ...@@ -24,17 +24,17 @@ import org.springframework.stereotype.Service;
public class TpCommentServiceImpl extends ServiceImpl<TpCommentMapper, TpComment> implements ITpCommentService { public class TpCommentServiceImpl extends ServiceImpl<TpCommentMapper, TpComment> implements ITpCommentService {
@Override @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<PageCommentVo> page = new Page<PageCommentVo>(pageNo, pageSize);
page.setRecords(this.baseMapper.searchPage(trainingProjectId, bizType, accountId, new RowBounds(page.getOffset(), page.getLimit()),type)); page.setRecords(this.baseMapper.searchPage(createById,trainingProjectId, bizType, accountId, new RowBounds(page.getOffset(), page.getLimit()),type));
Integer count = this.baseMapper.searchPageCount(trainingProjectId, bizType, accountId,type); Integer count = this.baseMapper.searchPageCount(createById,trainingProjectId, bizType, accountId,type);
page.setTotal(count); page.setTotal(count);
return page; return page;
} }
@Override @Override
public List<PageCommentVo> getList(Long trainingProjectId, Integer bizType, Long accountId){ public List<PageCommentVo> getList(Long createById,Long trainingProjectId, Integer bizType, Long accountId){
List<PageCommentVo> list = this.baseMapper.getList(trainingProjectId, bizType, accountId); List<PageCommentVo> list = this.baseMapper.getList(createById,trainingProjectId, bizType, accountId);
return list; return list;
} }
} }
...@@ -72,7 +72,7 @@ public class CommentListExportAsync extends ...@@ -72,7 +72,7 @@ public class CommentListExportAsync extends
fileDir.mkdir(); 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>(); List<PageCommentVo> listVO = new ArrayList<PageCommentVo>();
TpCommentReply reply=new TpCommentReply(); TpCommentReply reply=new TpCommentReply();
PageCommentVo vo = new PageCommentVo(); 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