记录页面添加分页、搜索、全选和一键清理功能
后端实现: - RecordController:添加分页和搜索参数支持 - DeductRecordService:新增findByUserIdWithSearch方法 - DeductRecordRepository:添加分页查询和关键词搜索方法 - 新增deleteBatch批量删除接口 前端实现: - 搜索栏:支持按姓名或事项搜索 - 分页功能:上一页/下一页按钮,显示页码信息 - 全选功能:复选框全选/取消全选 - 批量删除:选中多条记录后可批量删除 - 一键清空:清空所有测算记录 - UI优化:添加操作栏、复选框样式 API接口: - GET /api/records/list - 支持分页和搜索参数 - POST /api/records/deleteBatch - 批量删除记录 - POST /api/records/clear - 清空所有记录
This commit is contained in:
1 parent
03535c831f
commit
16624fa189
8 files changed
+675
-499
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package xuan.repository;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -14,8 +15,18 @@ public interface DeductRecordRepository extends JpaRepository<DeductRecord, Long
|
||||
|
||||
List<DeductRecord> findByUserIdOrderByCreateTimeDesc(String userId);
|
||||
|
||||
Page<DeductRecord> findByUserIdOrderByCreateTimeDesc(String userId, Pageable pageable);
|
||||
|
||||
List<DeductRecord> findByUserIdAndTypeOrderByCreateTimeDesc(String userId, String type);
|
||||
|
||||
Page<DeductRecord> findByUserIdAndType(String userId, String type, Pageable pageable);
|
||||
|
||||
@Query("SELECT d FROM DeductRecord d WHERE d.userId = :userId ORDER BY d.createTime DESC")
|
||||
List<DeductRecord> findTop10ByUserIdOrderByCreateTimeDesc(@Param("userId") String userId, Pageable pageable);
|
||||
|
||||
@Query("SELECT d FROM DeductRecord d WHERE d.userId = :userId AND (d.name LIKE %:keyword% OR d.occupy LIKE %:keyword%) ORDER BY d.createTime DESC")
|
||||
Page<DeductRecord> findByUserIdAndKeyword(@Param("userId") String userId, @Param("keyword") String keyword, Pageable pageable);
|
||||
|
||||
@Query("SELECT d FROM DeductRecord d WHERE d.userId = :userId AND d.type = :type AND (d.name LIKE %:keyword% OR d.occupy LIKE %:keyword%) ORDER BY d.createTime DESC")
|
||||
Page<DeductRecord> findByUserIdAndTypeAndKeyword(@Param("userId") String userId, @Param("type") String type, @Param("keyword") String keyword, Pageable pageable);
|
||||
}
|
||||
Reference in new issue
Block a user