Commit 9a5a21a7 by 刘志强

Merge branch '105' into 'master'

105

See merge request !24
2 parents 8792dcb8 3ce5c281
...@@ -128,4 +128,38 @@ public class CommentController extends BaseController { ...@@ -128,4 +128,38 @@ public class CommentController extends BaseController {
} }
} }
/**
* 评论列表
* @param pageNo
* @param pageSize
* @param authStatus
* @param name
* @return
*/
@ResponseBody
@RequestMapping(path = "/queryCommentList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map queryCommentList(@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "1") Integer pageSize,
@RequestParam(defaultValue ="-1")Integer authStatus,@RequestParam(defaultValue ="")String name) {
try {
Map paramMap = new HashMap<>();
if(authStatus!=-1){
paramMap.put("authStatus",authStatus);
}
if(!("").equals(name)){
paramMap.put("name","%"+name+"%");
}
PageHelper.startPage(pageNo,pageSize,true,false);
List list = openSqlRingsService.selectList_Rings("com.mapping.queryModel.queryCommentList",paramMap);
PageInfo pageInfo = new PageInfo(list);
PageModel model = new PageModel();
model.setTotal(pageInfo.getTotal());
model.setList(list);
return success(model);
} catch (Exception e) {
e.printStackTrace();
return error("0","系统异常",null);
}
}
} }
...@@ -279,4 +279,60 @@ ...@@ -279,4 +279,60 @@
c.type=1 AND c.relation_id = #{id,jdbcType=BIGINT} c.type=1 AND c.relation_id = #{id,jdbcType=BIGINT}
ORDER BY c.auth_status ASC,c.create_dt ASC ORDER BY c.auth_status ASC,c.create_dt ASC
</select> </select>
<select id="queryCommentList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT * FROM (
SELECT
t.id,
t.type,
u.full_name AS fullName,
u.phone,
t.auth_status AS authStatus,
t.auth_dt AS authDt,
t.create_dt AS createDt,
t.reply_content AS replyContent,
c.course_name as name,
t.relation_id as relationId
FROM
t_kzy_comment t
LEFT JOIN t_kzy_course c ON t.relation_id = c.id
LEFT JOIN t_kzy_user u ON t.user_id = u.id
WHERE
t.type = 2
AND t.is_delete = 0
<if test="authStatus != null">
AND t.auth_status = #{authStatus,jdbcType=INTEGER}
</if>
<if test="name != null">
AND c.course_name LIKE #{name}
</if>
UNION ALL
SELECT
t.id,
t.type,
u.full_name AS fullName,
u.phone,
t.auth_status AS authStatus,
t.auth_dt AS authDt,
t.create_dt AS createDt,
t.reply_content AS replyContent,
c.title as name,
t.relation_id as relationId
FROM
t_kzy_comment t
LEFT JOIN t_kzy_information c ON t.relation_id = c.id
LEFT JOIN t_kzy_user u ON t.user_id = u.id
WHERE
t.type = 1
AND t.is_delete = 0
<if test="authStatus != null">
AND t.auth_status = #{authStatus,jdbcType=INTEGER}
</if>
<if test="name != null">
AND c.title LIKE #{name}
</if>
) a
ORDER BY a.createDt DESC
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!