Industrial-image-management.../REGULATION_PROPOSAL_SEARCH_...

3.1 KiB
Raw Permalink Blame History

制度提案搜索接口实现指南

接口定义

请求接口

GET /api/regulation
Content-Type: application/json

请求参数

{
  "page": number,           // 页码可选默认1
  "size": number,           // 每页大小可选默认10
  "status": "string",       // 状态筛选(精确匹配,可选)
  "type": "string",         // 提案类型(精确匹配,可选)
  "title": "string",        // 提案标题(模糊搜索,可选)
  "proposer": "string"      // 提案人(模糊搜索,可选)
}

响应格式

{
  "code": 200,
  "message": "success",
  "data": {
    "records": [
      {
        "regulationId": "string",
        "title": "string",
        "content": "string",
        "regulationType": "string",
        "status": "string",
        "publishTime": "string",
        "effectiveTime": "string",
        "expireTime": "string",
        "scope": "string",
        "level": "string",
        "version": "string",
        "remark": "string",
        "createBy": "string",
        "updateBy": "string",
        "createTime": "string",
        "updateTime": "string",
        "delFlag": "string",
        "confirmStatus": "string"
      }
    ],
    "total": number,        // 总记录数
    "current": number,      // 当前页码
    "size": number,         // 每页大小
    "pages": number         // 总页数
  }
}

后端实现说明

后端已实现以下接口:

@ApiOperation(value = "获取制度列表", httpMethod = "GET")
@GetMapping
public Result getRegulationList(
    @RequestParam(defaultValue = "1") int page,
    @RequestParam(defaultValue = "10") int size,
    @RequestParam(required = false) String status,
    @RequestParam(required = false) String type,
    @RequestParam(required = false) String title,
    @RequestParam(required = false) String proposer
) {
    return regulationService.getRegulationList(page, size, status, type, title, proposer);
}

前端集成说明

前端已完成以下功能:

  1. 删除前端搜索逻辑(防抖、实时搜索等)
  2. 调整为GET请求接口
  3. 参数名匹配后端接口createByName → proposer, regulationType → type
  4. 简化搜索表单,只支持手动搜索
  5. 保持原有功能不受影响

搜索流程

  1. 用户在搜索表单中输入条件
  2. 点击"搜索"按钮触发搜索
  3. 调用后端GET接口 /api/regulation
  4. 后端返回搜索结果
  5. 前端展示搜索结果

参数说明

  • page: 页码默认1
  • size: 每页大小默认10
  • status: 状态筛选精确匹配DRAFT、PUBLISHED、APPROVED等
  • type: 提案类型,精确匹配(如:管理规范、操作流程、安全制度、其他)
  • title: 提案标题,支持模糊搜索
  • proposer: 提案人,支持模糊搜索

搜索功能特性

  • 模糊搜索title 和 proposer 字段支持模糊匹配
  • 精确筛选type 和 status 字段精确匹配
  • 分页查询:支持分页和排序
  • 性能优化:使用数据库索引提升查询性能