添加分页功能

liujun-2024-05-23-接口漏洞修复
liujun 2024-04-13 12:33:30 +08:00
parent b1dd0eb553
commit c7abd55db7
3 changed files with 22 additions and 10 deletions

View File

@ -67,7 +67,7 @@
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version> <version>4.0.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -3,15 +3,16 @@ package com.zcloud.controller.dw;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.entity.Page;
import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.DwService;
import com.zcloud.service.dw.dto.*; import com.zcloud.service.dw.dto.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
@Controller @RestController
@RequestMapping(value = "/dw") @RequestMapping(value = "/dingWei")
public class DwController extends BaseController { public class DwController extends BaseController {
@Resource @Resource
@ -28,9 +29,11 @@ public class DwController extends BaseController {
public Object getMapList(Page page) throws Exception { public Object getMapList(Page page) throws Exception {
PageData pd = this.getPageData(); PageData pd = this.getPageData();
MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class);
mapGet.getPage().setPage(page.getPage()); if (mapGet.getPage() == null){
mapGet.getPage().setCurrent(page.getCurrent()); mapGet.setPage(new com.zcloud.service.dw.dto.Page());
mapGet.getPage().setSize(page.getSize()); }
mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage()));
mapGet.getPage().setSize(String.valueOf(page.getShowCount()));
return dwService.getMapList(mapGet); return dwService.getMapList(mapGet);
} }
@ -45,9 +48,11 @@ public class DwController extends BaseController {
public Object getAlarmList(Page page) throws Exception { public Object getAlarmList(Page page) throws Exception {
PageData pd = this.getPageData(); PageData pd = this.getPageData();
AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class);
mapGet.getPage().setPage(page.getPage()); if (mapGet.getPage() == null){
mapGet.getPage().setCurrent(page.getCurrent()); mapGet.setPage(new com.zcloud.service.dw.dto.Page());
mapGet.getPage().setSize(page.getSize()); }
mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage()));
mapGet.getPage().setSize(String.valueOf(page.getShowCount()));
return dwService.getAlarmList(mapGet); return dwService.getAlarmList(mapGet);
} }
@ -62,4 +67,5 @@ public class DwController extends BaseController {
public Object getDictionary() throws Exception { public Object getDictionary() throws Exception {
return dwService.getDictionary(); return dwService.getDictionary();
} }
} }

View File

@ -41,4 +41,10 @@ public class HttpUtil<K,V> {
String result = restTemplate.postForEntity(url, info, String.class).getBody(); String result = restTemplate.postForEntity(url, info, String.class).getBody();
return JSONObject.parseObject(result, Map.class); return JSONObject.parseObject(result, Map.class);
} }
public static Object post(String url) {
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.getForObject(url, String.class);
return JSONObject.parseObject(result, Map.class);
}
} }