|
|
@@ -13,6 +13,7 @@ import com.pharmacopoeia.repository.QuestionRepository;
|
|
|
import com.pharmacopoeia.repository.QuickAskAuditLogRepository;
|
|
|
import com.pharmacopoeia.repository.QuickAskRepository;
|
|
|
import com.pharmacopoeia.util.IpUtils;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
@@ -415,9 +416,14 @@ public class AdminKnowledgeService {
|
|
|
return "unknown";
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> listQuickAskAuditLog(int page, int pageSize) {
|
|
|
+ public Map<String, Object> listQuickAskAuditLog(int page, int pageSize, String action) {
|
|
|
var pageable = org.springframework.data.domain.PageRequest.of(page - 1, pageSize);
|
|
|
- var result = auditLogRepository.findAllByOrderByCreatedAtDesc(pageable);
|
|
|
+ Page<QuickAskAuditLog> result;
|
|
|
+ if (action != null && !action.isBlank()) {
|
|
|
+ result = auditLogRepository.findByActionOrderByCreatedAtDesc(action, pageable);
|
|
|
+ } else {
|
|
|
+ result = auditLogRepository.findAllByOrderByCreatedAtDesc(pageable);
|
|
|
+ }
|
|
|
return Map.of(
|
|
|
"items", result.getContent(),
|
|
|
"page", page,
|