1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.jarvis.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 评论统计信息
|
||||
@@ -30,5 +31,8 @@ public class CommentStatistics {
|
||||
|
||||
/** 今日调用次数 */
|
||||
private Long todayCallCount;
|
||||
|
||||
/** 最后一条评论的创建时间(作为更新日期) */
|
||||
private Date lastCommentUpdateTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,15 @@ public class CommentServiceImpl implements ICommentService {
|
||||
stats.setTotalCount(((Number) statMap.get("totalCount")).longValue());
|
||||
stats.setAvailableCount(((Number) statMap.get("availableCount")).longValue());
|
||||
stats.setUsedCount(((Number) statMap.get("usedCount")).longValue());
|
||||
// 设置最后一条评论的创建时间
|
||||
Object lastUpdateTime = statMap.get("lastCommentUpdateTime");
|
||||
if (lastUpdateTime != null) {
|
||||
if (lastUpdateTime instanceof Date) {
|
||||
stats.setLastCommentUpdateTime((Date) lastUpdateTime);
|
||||
} else if (lastUpdateTime instanceof java.sql.Timestamp) {
|
||||
stats.setLastCommentUpdateTime(new Date(((java.sql.Timestamp) lastUpdateTime).getTime()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取接口调用统计
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
select
|
||||
count(*) as totalCount,
|
||||
sum(case when is_use = 0 then 1 else 0 end) as availableCount,
|
||||
sum(case when is_use = 1 then 1 else 0 end) as usedCount
|
||||
sum(case when is_use = 1 then 1 else 0 end) as usedCount,
|
||||
(select max(created_at) from comments where product_id = #{productId}) as lastCommentUpdateTime
|
||||
from comments
|
||||
where product_id = #{productId}
|
||||
</select>
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
select
|
||||
count(*) as totalCount,
|
||||
sum(case when is_use = 0 then 1 else 0 end) as availableCount,
|
||||
sum(case when is_use = 1 then 1 else 0 end) as usedCount
|
||||
sum(case when is_use = 1 then 1 else 0 end) as usedCount,
|
||||
(select max(created_at) from taobao_comments where product_id = #{productId}) as lastCommentUpdateTime
|
||||
from taobao_comments
|
||||
where product_id = #{productId}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user