病例交流列表 新增了评论排序
This commit is contained in:
parent
c5bc0920d3
commit
862df3035c
@ -49,9 +49,15 @@ public class getCaseExchangeSearchPage {
|
|||||||
@JsonProperty("read_num")
|
@JsonProperty("read_num")
|
||||||
private String readNum; // 阅读量
|
private String readNum; // 阅读量
|
||||||
|
|
||||||
|
@JsonProperty("comment_num")
|
||||||
|
private String commentNum; // 评论数
|
||||||
|
|
||||||
@JsonProperty("push_date")
|
@JsonProperty("push_date")
|
||||||
private String pushDate; // 发表时间
|
private String pushDate; // 发表时间
|
||||||
|
|
||||||
|
@JsonProperty("last_comment_time")
|
||||||
|
private String lastCommentTime; // 最后评论时间
|
||||||
|
|
||||||
public Map<String, String> toMap() {
|
public Map<String, String> toMap() {
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
if (StringUtils.hasText(createdAt)) {
|
if (StringUtils.hasText(createdAt)) {
|
||||||
@ -62,10 +68,18 @@ public class getCaseExchangeSearchPage {
|
|||||||
map.put("a.read_num", readNum);
|
map.put("a.read_num", readNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.hasText(commentNum)) {
|
||||||
|
map.put("a.comment_num", commentNum);
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.hasText(pushDate)) {
|
if (StringUtils.hasText(pushDate)) {
|
||||||
map.put("a.push_date", pushDate);
|
map.put("a.push_date", pushDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.hasText(lastCommentTime)) {
|
||||||
|
map.put("commentCreatedAt", lastCommentTime);
|
||||||
|
}
|
||||||
|
|
||||||
// 默认排序(如果用户未传递任何排序字段)
|
// 默认排序(如果用户未传递任何排序字段)
|
||||||
if (map.isEmpty()) {
|
if (map.isEmpty()) {
|
||||||
map.put("a.updated_at", "desc");
|
map.put("a.updated_at", "desc");
|
||||||
|
|||||||
@ -53,12 +53,26 @@
|
|||||||
) AS result
|
) AS result
|
||||||
JOIN case_exchange a ON result.exchange_id = a.exchange_id
|
JOIN case_exchange a ON result.exchange_id = a.exchange_id
|
||||||
LEFT JOIN user c ON c.user_id = a.user_id
|
LEFT JOIN user c ON c.user_id = a.user_id
|
||||||
|
LEFT JOIN user_comment_exchange d ON d.exchange_id = a.exchange_id
|
||||||
<if test="order != null and !order.isEmpty()">
|
<if test="order != null and !order.isEmpty()">
|
||||||
ORDER BY
|
ORDER BY
|
||||||
<foreach item="entry" index="key" collection="order" separator=",">
|
<foreach item="entry" index="key" collection="order" separator=",">
|
||||||
|
<choose>
|
||||||
|
<when test="key == 'commentCreatedAt'">
|
||||||
|
d.created_at ${entry}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
${key} ${entry}
|
${key} ${entry}
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<!-- <if test="order != null and !order.isEmpty()">-->
|
||||||
|
<!-- ORDER BY-->
|
||||||
|
<!-- <foreach item="entry" index="key" collection="order" separator=",">-->
|
||||||
|
<!-- ${key} ${entry}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
<!-- </if>-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getCaseExchangeSearchList" resultMap="caseExchangeDtoMap">
|
<select id="getCaseExchangeSearchList" resultMap="caseExchangeDtoMap">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user