From 9776eab0645b2dfbe787e9d035f94ce80314e7fd Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 27 二月 2023 18:36:26 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/data/MetaController.java | 75 ++++++++++++++++++++++++++----------- 1 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/lf/server/controller/data/MetaController.java b/src/main/java/com/lf/server/controller/data/MetaController.java index 79d1831..0012bcf 100644 --- a/src/main/java/com/lf/server/controller/data/MetaController.java +++ b/src/main/java/com/lf/server/controller/data/MetaController.java @@ -38,10 +38,10 @@ import java.util.List; /** - * 婧愭暟鎹� + * 鍏冩暟鎹� * @author WWW */ -@Api(tags = "鏁版嵁绠$悊\\婧愭暟鎹鐞�") +@Api(tags = "鏁版嵁绠$悊\\淇℃伅绠$悊") @RestController @RequestMapping("/meta") public class MetaController extends BaseController { @@ -89,7 +89,38 @@ return success(count, rs); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); + } + } + + @SysLog() + @ApiOperation(value = "鏍规嵁鐖禝D鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟") + @ApiImplicitParams({ + @ApiImplicitParam(name = "metaid", value = "鐖禝D", dataType = "String", paramType = "query", example = "0"), + @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 = "/selectPageAndCountByPid") + public ResponseMsg<List<MetaEntity>> selectPageAndCountByPid(Integer metaid, String name, Integer pageSize, Integer pageIndex) { + try { + if (pageSize < 1 || pageIndex < 1) { + return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null); + } + if (null == metaid || metaid < 1) { + return fail("鐖禝D涓嶈兘涓虹┖涓斿ぇ浜�1", null); + } + + int count = metaService.selectCountByPid(metaid, name); + if (count == 0) { + return success(0, null); + } + + List<MetaEntity> rs = metaService.selectPageByPid(metaid, name, pageSize, pageSize * (pageIndex - 1)); + + return success(count, rs); + } catch (Exception ex) { + return fail(ex, null); } } @@ -112,7 +143,7 @@ return success(list); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @@ -128,14 +159,14 @@ return success(entity); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @SysLog() @ApiOperation(value = "鏌ヨ琛ㄤ腑鏁版嵁") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "婧愭暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), + @ApiImplicitParam(name = "id", value = "鍏冩暟鎹甀D", dataType = "Integer", paramType = "query", example = "115"), @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1"), @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10") }) @@ -144,12 +175,12 @@ // noinspection AlibabaRemoveCommentedCode try { if (null == id || id < 0) { - return fail("婧愭暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); + return fail("鍏冩暟鎹甀D涓嶈兘涓虹┖鎴栧皬浜�0", null); } MetaEntity meta = metaService.selectById(id); if (null == meta || null == meta.getTab() || !meta.getTab().contains(StaticData.POINT)) { - return fail("鎵句笉鍒版簮鏁版嵁淇℃伅", null); + return fail("鎵句笉鍒板厓鏁版嵁淇℃伅", null); } String entity = meta.getTab().substring(meta.getTab().indexOf(".") + 1).replace("_", "").toLowerCase(); @@ -167,7 +198,7 @@ return success(paged.getTotal(), paged.getRecords()); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @@ -188,7 +219,7 @@ return success(list); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @@ -210,7 +241,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -233,7 +264,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -249,7 +280,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -269,7 +300,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -291,7 +322,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -315,7 +346,7 @@ return success(count); } catch (Exception ex) { - return fail(ex.getMessage(), -1); + return fail(ex, -1); } } @@ -338,15 +369,15 @@ return fail("鐢ㄦ埛鏈櫥褰�", null); } - int count = downloadService.selectCountForUser(ue.getCreateUser(), 3, name); + int count = downloadService.selectCountForUser(ue.getId(), 3, name); if (count == 0) { return success(0, null); } - List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getCreateUser(), 3, name, pageSize, pageSize * (pageIndex - 1)); + List<DownloadEntity> rs = downloadService.selectByPageForUser(ue.getId(), 3, name, pageSize, pageSize * (pageIndex - 1)); return success(count, rs); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @@ -375,7 +406,7 @@ List<MetaEntity> list = metaService.selectMetaFiles(reqEntity.getIds()); if (null == list || list.isEmpty()) { - return fail("娌℃湁鎵惧埌婧愭暟鎹�"); + return fail("娌℃湁鎵惧埌鍏冩暟鎹�"); } UserEntity ue = tokenService.getCurrentUser(req); @@ -383,7 +414,7 @@ return success(guid); } catch (Exception ex) { - return fail(ex.getMessage(), null); + return fail(ex, null); } } @@ -421,7 +452,7 @@ return success(file.exists()); } catch (Exception ex) { - return fail(ex.getMessage(), false); + return fail(ex, false); } } -- Gitblit v1.9.3