Explorar o código

fix: 操作日志列表排序生效 + 搜索框高度调整

- OperationLogController.queryLogs 从 body 读 sort 传给 service
- UserOperationLogService.queryLogs 加 sortSpecs 参数,显式 SortUtil.applySort
  (不再依赖 SortContext ThreadLocal 时序,确保排序可靠生效)
- OperationLogs.vue 搜索表单加 size=small 统一高度
Sisyphus hai 1 mes
pai
achega
61cc2134a4

+ 6 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/OperationLogController.java

@@ -49,8 +49,13 @@ public class OperationLogController {
             // 日期解析失败
             // 日期解析失败
         }
         }
 
 
+        @SuppressWarnings("unchecked")
+        List<Map<String, String>> sortSpecs = params.get("sort") != null
+                ? (List<Map<String, String>>) params.get("sort")
+                : null;
+
         Page<UserOperationLog> result = logService.queryLogs(
         Page<UserOperationLog> result = logService.queryLogs(
-                userId, operationType, startDate, endDate, page, size);
+                userId, operationType, startDate, endDate, page, size, sortSpecs);
 
 
         return Result.success(result);
         return Result.success(result);
     }
     }

+ 4 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/UserOperationLogService.java

@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 import com.etotem.cfc.util.SortUtil;
 import com.etotem.cfc.util.SortUtil;
 
 
 @Slf4j
 @Slf4j
@@ -95,7 +96,8 @@ public class UserOperationLogService {
      */
      */
     public Page<UserOperationLog> queryLogs(Long userId, String operationType, 
     public Page<UserOperationLog> queryLogs(Long userId, String operationType, 
                             Date startDate, Date endDate,
                             Date startDate, Date endDate,
-                            Integer page, Integer size) {
+                            Integer page, Integer size,
+                            List<Map<String, String>> sortSpecs) {
         Page<UserOperationLog> pageParam = new Page<>(page, size);
         Page<UserOperationLog> pageParam = new Page<>(page, size);
         LambdaQueryWrapper<UserOperationLog> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<UserOperationLog> wrapper = new LambdaQueryWrapper<>();
         
         
@@ -114,7 +116,7 @@ public class UserOperationLogService {
         
         
         wrapper.orderByDesc(UserOperationLog::getCreatedAt);
         wrapper.orderByDesc(UserOperationLog::getCreatedAt);
         
         
-        SortUtil.applySort(wrapper);
+        SortUtil.applySort(wrapper, sortSpecs, null);
         return logMapper.selectPage(pageParam, wrapper);
         return logMapper.selectPage(pageParam, wrapper);
     }
     }
 
 

+ 1 - 1
cfc-web/src/views/OperationLogs.vue

@@ -2,7 +2,7 @@
   <div class="operation-logs admin-page">
   <div class="operation-logs admin-page">
     <!-- 筛选条件 -->
     <!-- 筛选条件 -->
     <el-card class="filter-card">
     <el-card class="filter-card">
-      <el-form :inline="true" :model="filterForm" class="filter-form">
+      <el-form :inline="true" :model="filterForm" class="filter-form" size="small">
         <el-form-item label="用户名/ID">
         <el-form-item label="用户名/ID">
           <el-input v-model="filterForm.userId" placeholder="请输入用户名或ID" clearable></el-input>
           <el-input v-model="filterForm.userId" placeholder="请输入用户名或ID" clearable></el-input>
         </el-form-item>
         </el-form-item>