Explorar el Código

列表分页优化

limingming hace 1 año
padre
commit
a1615b80c6

+ 2 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/BasicLibraryController.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.PageInfo;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.DateUtils;
@@ -41,16 +40,11 @@ public class BasicLibraryController extends BaseController {
     @ApiOperation("查询基础库管理列表")
 //    @PreAuthorize("@ss.hasPermi('platform:base:list')")
     @PostMapping("/list")
-    public R<PageInfo<BasicLibrary>> list(@RequestBody BaseParam param) {
+    public R<IPage<BasicLibrary>> list(@RequestBody BaseParam param) {
         IPage<BasicLibrary> basicLibraryIPage = basicLibraryService.page(new Page<BasicLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),
                 new LambdaQueryWrapper<BasicLibrary>().like(param.getName()!=null,BasicLibrary::getName,param.getName())
                         .eq(BasicLibrary::getDelFlag,0));
-        PageInfo<BasicLibrary> pageInfo = new PageInfo<>();
-        pageInfo.setRecords(basicLibraryIPage.getRecords());
-        pageInfo.setSize(basicLibraryIPage.getSize());
-        pageInfo.setCurrent(basicLibraryIPage.getCurrent());
-        pageInfo.setTotal(basicLibraryIPage.getTotal());
-        return R.ok(pageInfo);
+        return R.ok(basicLibraryIPage);
     }
 
 

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/ComponentsLibraryController.java

@@ -44,7 +44,7 @@ public class ComponentsLibraryController extends BaseController {
      */
 //    @PreAuthorize("@ss.hasPermi('platform:components:list')")
     @PostMapping("/list")
-    public R<PageInfo<ComponentsLibrary>> list(@RequestBody BaseParam param) {
+    public R<IPage<ComponentsLibrary>> list(@RequestBody BaseParam param) {
         IPage<ComponentsLibrary> basicLibraryIPage = componentsLibraryService.page(new Page<ComponentsLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),
                 new LambdaQueryWrapper<ComponentsLibrary>().like(param.getName()!=null,ComponentsLibrary::getName,param.getName())
                         .eq(ComponentsLibrary::getDelFlag,"0"));
@@ -53,7 +53,7 @@ public class ComponentsLibraryController extends BaseController {
         pageInfo.setSize(param.getSize());
         pageInfo.setCurrent(basicLibraryIPage.getCurrent());
         pageInfo.setTotal(basicLibraryIPage.getTotal());
-        return R.ok(pageInfo);
+        return R.ok(basicLibraryIPage);
     }
 
 

+ 2 - 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/QrLibraryController.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.PageInfo;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.DateUtils;
@@ -36,16 +35,11 @@ public class QrLibraryController extends BaseController {
      */
 //    @PreAuthorize("@ss.hasPermi('platform:or:list')")
     @PostMapping("/list")
-    public R<PageInfo<QrLibrary>> list(@RequestBody BaseParam param){
+    public R<IPage<QrLibrary>> list(@RequestBody BaseParam param){
         IPage<QrLibrary> qrLibraryIPage = qrLibraryService.page(new Page<QrLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),
                 new LambdaQueryWrapper<QrLibrary>().like(param.getName()!=null,QrLibrary::getName,param.getName())
                         .eq(QrLibrary::getDelFlag,0));
-        PageInfo<QrLibrary> pageInfo = new PageInfo<>();
-        pageInfo.setRecords(qrLibraryIPage.getRecords());
-        pageInfo.setTotal(qrLibraryIPage.getTotal());
-        pageInfo.setSize(qrLibraryIPage.getSize());
-        pageInfo.setCurrent(qrLibraryIPage.getCurrent());
-        return R.ok(pageInfo);
+        return R.ok(qrLibraryIPage);
     }
 
 

+ 4 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/TemplateLibraryController.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.PageInfo;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.DateUtils;
@@ -14,7 +13,10 @@ import com.ruoyi.system.domain.TemplateLibrary;
 import com.ruoyi.system.service.TemplateLibraryService;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 红外遥控模板库Controller
@@ -37,9 +39,6 @@ public class TemplateLibraryController extends BaseController {
         IPage<TemplateLibrary> templateIPage = templateLibraryService.page(new Page<TemplateLibrary>().setCurrent(param.getCurrent()).setSize(param.getSize()),
                 new LambdaQueryWrapper<TemplateLibrary>().like(param.getName()!=null,TemplateLibrary::getName,param.getName())
                         .eq(TemplateLibrary::getDelFlag,0));
-        PageInfo<TemplateLibrary> pageInfo = new PageInfo<>();
-        pageInfo.setRecords(templateIPage.getRecords());
-        pageInfo.setTotal(templateIPage.getTotal());
         return R.ok(templateIPage);
     }
 

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/UploadController.java

@@ -22,7 +22,6 @@ public class UploadController {
     @ResponseBody
     @PostMapping("/uploadImage")
     public R<UploadInfo> addSave(@RequestParam("file") MultipartFile file) throws IOException {
-        //限制文件大小??
         String originalImgFilename = file.getOriginalFilename();
         String imgSuffix = originalImgFilename.substring(file.getOriginalFilename().lastIndexOf("."));
         if (!ConstantUtil.PICTURE.contains(imgSuffix)) {