|
@@ -1,5 +1,6 @@
|
|
|
package com.sooka.sponest.data.emergency.appmin.material.controller;
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.ruoyi.common.core.web.controller.BaseController;
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
|
@@ -10,7 +11,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("AppMaterialController")
|
|
@@ -21,15 +24,25 @@ public class AppMaterialController extends BaseController {
|
|
|
|
|
|
@RequestMapping("geMaterialList")
|
|
|
public AjaxResult geMaterialList(AppMaterialVO vo) {
|
|
|
- try{
|
|
|
+ try {
|
|
|
+ // 开启分页
|
|
|
startPage();
|
|
|
+
|
|
|
+ // 查询数据
|
|
|
List list = appMaterialService.geMaterialList(vo);
|
|
|
+
|
|
|
+ // 移除空值
|
|
|
list.removeAll(Collections.singleton(null));
|
|
|
+
|
|
|
+ // 获取分页信息
|
|
|
TableDataInfo tableDataInfo = getDataTable(list);
|
|
|
- return AjaxResult.success(tableDataInfo);
|
|
|
- }catch (Exception e){
|
|
|
+
|
|
|
+ // 直接返回数据,不需要手动构建 Map
|
|
|
+ return AjaxResult.success(tableDataInfo.getRows());
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return AjaxResult.error("查询错误");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|