From 2d3500da2c58a44cd0a4d974393b96e52eb68467 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期一, 10 十月 2022 18:35:23 +0800 Subject: [PATCH] ResEntity --- src/main/java/com/lf/server/controller/sys/ArgsController.java | 50 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/lf/server/controller/sys/ArgsController.java b/src/main/java/com/lf/server/controller/sys/ArgsController.java index 0608569..873bcb2 100644 --- a/src/main/java/com/lf/server/controller/sys/ArgsController.java +++ b/src/main/java/com/lf/server/controller/sys/ArgsController.java @@ -16,8 +16,7 @@ /** * 鍙傛暟璁剧疆 - * @author sws - * @date 2022-09-27 + * @author WWW */ @Api(tags = "杩愮淮绠$悊\\绯荤粺閰嶇疆") @RestController @@ -65,6 +64,31 @@ } @SysLog() + @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name", value = "鍚嶇О", dataType = "String", paramType = "query", example = "鏈夋晥鏈�"), + @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"), + @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1") + }) + @GetMapping(value = "/selectByPageAndCount") + public ResponseMsg<List<ArgsEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + int count = argsService.selectCount(name); + if (count == 0) { + return success(0, null); + } + List<ArgsEntity> rs = argsService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() @ApiOperation(value = "鏌ヨ鎵�鏈�") @GetMapping(value = "/selectAll") public ResponseMsg<List<ArgsEntity>> selectAll() { @@ -78,16 +102,16 @@ } @SysLog() - @ApiOperation(value = "鏌ヨ鍗曟潯") + @ApiOperation(value = "鏍规嵁ID鏌ヨ") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1") + @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1") }) - @GetMapping(value = "/selectOne") - public ResponseMsg<ArgsEntity> selectOne(int id) { + @GetMapping(value = "/selectById") + public ResponseMsg<ArgsEntity> selectById(int id) { try { - ArgsEntity argsEntity = argsService.selectOne(id); + ArgsEntity entity = argsService.selectById(id); - return success(argsEntity); + return success(entity); } catch (Exception ex) { return fail(ex.getMessage(), null); } @@ -96,7 +120,7 @@ @SysLog() @ApiOperation(value = "娣诲姞鏁版嵁") @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", paramType = "body") + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") }) @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") public ResponseMsg<Integer> insert(@RequestBody ArgsEntity entity) { @@ -112,7 +136,7 @@ @SysLog() @ApiOperation(value = "鎵归噺娣诲姞") @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", paramType = "body") + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") }) @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8") public ResponseMsg<Integer> inserts(@RequestBody List<ArgsEntity> list) { @@ -144,7 +168,7 @@ @SysLog() @ApiOperation(value = "鎵归噺鍒犻櫎") @ApiImplicitParams({ - @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "{1,2}") + @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2") }) @GetMapping(value = "/deletes") public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { @@ -164,7 +188,7 @@ @SysLog() @ApiOperation(value = "淇敼鏁版嵁") @ApiImplicitParams({ - @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", paramType = "body") + @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "ArgsEntity", paramType = "body") }) @ResponseBody @PostMapping(value = "/update", produces = "application/json; charset=UTF-8") @@ -181,7 +205,7 @@ @SysLog() @ApiOperation(value = "鎵归噺淇敼") @ApiImplicitParams({ - @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", paramType = "body") + @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "ArgsEntity", paramType = "body") }) @ResponseBody @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8") -- Gitblit v1.9.3