SearchController.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.ruoyi.project.VRdemo.controller;
  2. import com.alibaba.fastjson2.JSONObject;
  3. import com.github.pagehelper.PageInfo;
  4. import com.ruoyi.framework.aspectj.lang.annotation.Anonymous;
  5. import com.ruoyi.framework.web.controller.BaseController;
  6. import com.ruoyi.framework.web.domain.AjaxResult;
  7. import com.ruoyi.framework.web.page.TableDataInfo;
  8. import com.ruoyi.project.VRdemo.domain.SearchData;
  9. import com.ruoyi.project.VRdemo.service.ISearchService;
  10. import org.apache.poi.ss.formula.functions.T;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. import java.util.List;
  14. @RestController
  15. @RequestMapping("/vr/search")
  16. public class SearchController extends BaseController {
  17. @Autowired
  18. private ISearchService searchService;
  19. // 高级检索功能接口
  20. @Anonymous
  21. @PostMapping("/SearchDatabases")
  22. public TableDataInfo searchDatabases(@RequestBody JSONObject jsonObject) {
  23. List<SearchData> searchData = jsonObject.getList("searchData", SearchData.class);
  24. Integer pageNum = jsonObject.getInteger("pageNum");
  25. Integer pageSize = jsonObject.getInteger("pageSize");
  26. List<Object> list = searchService.MappingSelection(searchData);
  27. TableDataInfo rspData = new TableDataInfo();
  28. rspData.setCode(200);
  29. rspData.setMsg("查询成功");
  30. rspData.setRows(searchService.startPage(list, pageNum, pageSize));
  31. rspData.setTotal(new PageInfo(list).getTotal());
  32. return rspData;
  33. }
  34. }