From 523fd3962382e6da762b7cf7417d54096e7767c1 Mon Sep 17 00:00:00 2001 From: jameszow Date: Sun, 10 Sep 2023 18:58:50 +0800 Subject: [PATCH] update api request context-path --- .../com/wansensoft/api/LogController.java | 10 +++++-- .../wansensoft/api/ResourceController.java | 29 ------------------- api/src/main/resources/application.yml | 2 +- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/api/src/main/java/com/wansensoft/api/LogController.java b/api/src/main/java/com/wansensoft/api/LogController.java index feced9fa..bc718d03 100644 --- a/api/src/main/java/com/wansensoft/api/LogController.java +++ b/api/src/main/java/com/wansensoft/api/LogController.java @@ -4,9 +4,11 @@ import com.wansensoft.entities.user.User; import com.wansensoft.service.log.LogService; import com.wansensoft.utils.BaseResponseInfo; +import com.wansensoft.utils.Constants; import jakarta.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; @@ -24,13 +26,17 @@ public LogController(LogService logService) { } @GetMapping("/getAllList") - public BaseResponseInfo getAllList(HttpServletRequest request)throws Exception { + public BaseResponseInfo getAllList(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize, + @RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage, + @RequestParam(value = Constants.SEARCH, required = false) String search, + HttpServletRequest request)throws Exception { BaseResponseInfo res = new BaseResponseInfo(); try { Map data = new HashMap<>(); List dataList = logService.getLog(); if(dataList!=null) { - data.put("logList", dataList); + data.put("total", 10); + data.put("rows", dataList); } res.code = 200; res.data = data; diff --git a/api/src/main/java/com/wansensoft/api/ResourceController.java b/api/src/main/java/com/wansensoft/api/ResourceController.java index abdbd188..acd74bf5 100644 --- a/api/src/main/java/com/wansensoft/api/ResourceController.java +++ b/api/src/main/java/com/wansensoft/api/ResourceController.java @@ -68,35 +68,6 @@ public String getList(@PathVariable("apiName") String apiName, return ResponseJsonUtil.returnJson(objectMap, "查找不到数据", ErpInfo.OK.code); } } -// @GetMapping(value = "/{apiName}/list") -// @ApiOperation(value = "获取信息列表") -// public String getList(@PathVariable("apiName") String apiName, -// @RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize, -// @RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage, -// @RequestParam(value = Constants.SEARCH, required = false) String search, -// HttpServletRequest request)throws Exception { -// Map parameterMap = ParamUtils.requestToMap(request); -// parameterMap.put(Constants.SEARCH, search); -// Map objectMap = new HashMap(); -// if (pageSize != null && pageSize <= 0) { -// pageSize = 10; -// } -// String offset = ParamUtils.getPageOffset(currentPage, pageSize); -// if (StringUtil.isNotEmpty(offset)) { -// parameterMap.put(Constants.OFFSET, offset); -// } -// List list = configResourceManager.select(apiName, parameterMap); -// if (list != null) { -// objectMap.put("total", configResourceManager.counts(apiName, parameterMap)); -// objectMap.put("rows", list); -// System.err.println(ResponseJsonUtil.returnJson(objectMap, ErpInfo.OK.name, Integer.parseInt(ErpInfo.OK.code))); -// return ResponseJsonUtil.returnJson(objectMap, ErpInfo.OK.name, Integer.parseInt(ErpInfo.OK.code)); -// } else { -// objectMap.put("total", BusinessConstants.DEFAULT_LIST_NULL_NUMBER); -// objectMap.put("rows", new ArrayList()); -// return ResponseJsonUtil.returnJson(objectMap, "查找不到数据", Integer.parseInt(ErpInfo.OK.code)); -// } -// } @PostMapping(value = "/{apiName}/add", produces = {"application/javascript", "application/json"}) @ApiOperation(value = "新增") diff --git a/api/src/main/resources/application.yml b/api/src/main/resources/application.yml index 51ad3aad..d1893333 100644 --- a/api/src/main/resources/application.yml +++ b/api/src/main/resources/application.yml @@ -1,7 +1,7 @@ server: port: 9999 servlet: - context-path: /wansenerp + context-path: /wansenerp-api tomcat: basedir: /opt/tmp/tomcat