|
@@ -1,10 +1,11 @@
|
|
package org.jeecg.modules.ctop.controller;
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.modules.ctop.service.IMaterialTopService;
|
|
import org.jeecg.modules.ctop.service.IMaterialTopService;
|
|
|
|
+import org.jeecg.modules.ctop.vo.MaterialTopVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -20,12 +21,12 @@ public class MaterialTopCtrl {
|
|
IMaterialTopService materialTopService;
|
|
IMaterialTopService materialTopService;
|
|
|
|
|
|
@PostMapping("/top/cost")
|
|
@PostMapping("/top/cost")
|
|
- public Result<PageInfo<JSONObject>> getCostTop(@RequestBody JSONObject requestBody,
|
|
|
|
|
|
+ public Result<IPage<MaterialTopVO>> getCostTop(@RequestBody JSONObject requestBody,
|
|
@RequestParam(defaultValue = "cost") String target,
|
|
@RequestParam(defaultValue = "cost") String target,
|
|
@RequestParam(defaultValue = "desc") String order,
|
|
@RequestParam(defaultValue = "desc") String order,
|
|
@RequestParam(defaultValue = "1") int pageNo,
|
|
@RequestParam(defaultValue = "1") int pageNo,
|
|
@RequestParam(defaultValue = "10") int pageSize) {
|
|
@RequestParam(defaultValue = "10") int pageSize) {
|
|
- Result<PageInfo<JSONObject>> result = new Result<>();
|
|
|
|
|
|
+ Result<IPage<MaterialTopVO>> result = new Result<>();
|
|
if(requestBody.isEmpty()){
|
|
if(requestBody.isEmpty()){
|
|
log.error("request body is empty");
|
|
log.error("request body is empty");
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
@@ -37,8 +38,8 @@ public class MaterialTopCtrl {
|
|
log.error("startDate or endDate is empty");
|
|
log.error("startDate or endDate is empty");
|
|
result.setSuccess(false);
|
|
result.setSuccess(false);
|
|
}
|
|
}
|
|
- PageInfo<JSONObject> resultPageInfo = materialTopService.pageQueryMaterialTop(endDate, startDate, target, order, pageNo, pageSize);
|
|
|
|
- result.setResult(resultPageInfo);
|
|
|
|
|
|
+ IPage<MaterialTopVO> voiPage = materialTopService.selectByPage(endDate, startDate, target, order, pageNo, pageSize);
|
|
|
|
+ result.setResult(voiPage);
|
|
result.setSuccess(true);
|
|
result.setSuccess(true);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(e.getMessage(),e);
|
|
log.error(e.getMessage(),e);
|