From cc22b83e5fce0f6232a3407bc4622815f50db067 Mon Sep 17 00:00:00 2001 From: "20932067@zju.edu.cn" Date: Sun, 24 Jan 2021 23:57:26 +0800 Subject: [PATCH] 11 --- hchyun-ui/src/api/system/apiclass.js | 10 ++- hchyun-ui/src/api/system/module.js | 12 ++- hchyun-ui/src/views/system/apiclass/index.vue | 9 +- .../controller/system/ApiclassController.java | 37 ++++---- .../controller/system/ModuleController.java | 24 +++++ .../hchyun/common/core/entity/AjaxResult.java | 88 +++++++++---------- .../com/hchyun/system/dao/ApiclassDao.java | 19 ++-- 7 files changed, 122 insertions(+), 77 deletions(-) diff --git a/hchyun-ui/src/api/system/apiclass.js b/hchyun-ui/src/api/system/apiclass.js index 2577dd3..5ebcb41 100644 --- a/hchyun-ui/src/api/system/apiclass.js +++ b/hchyun-ui/src/api/system/apiclass.js @@ -9,6 +9,14 @@ export function listApiclass(query) { }) } +// 获取模块管理选项列表 +export function queryListApiclass() { + return request({ + url: '/system/module/querylist', + method: 'get', + }) +} + // 查询接口类名详细 export function getApiclass(id) { return request({ @@ -50,4 +58,4 @@ export function exportApiclass(query) { method: 'get', params: query }) -} \ No newline at end of file +} diff --git a/hchyun-ui/src/api/system/module.js b/hchyun-ui/src/api/system/module.js index 95d5108..a6991f7 100644 --- a/hchyun-ui/src/api/system/module.js +++ b/hchyun-ui/src/api/system/module.js @@ -1,5 +1,7 @@ import request from '@/utils/request' + + // 查询模块管理列表 export function listModule(query) { return request({ @@ -9,6 +11,14 @@ export function listModule(query) { }) } +// 获取模块管理选项列表 +export function queryListModule() { + return request({ + url: '/system/module/querylist', + method: 'get', + }) +} + // 查询模块管理详细 export function getModule(id) { return request({ @@ -50,4 +60,4 @@ export function exportModule(query) { method: 'get', params: query }) -} \ No newline at end of file +} diff --git a/hchyun-ui/src/views/system/apiclass/index.vue b/hchyun-ui/src/views/system/apiclass/index.vue index e132ef9..e4f0aea 100644 --- a/hchyun-ui/src/views/system/apiclass/index.vue +++ b/hchyun-ui/src/views/system/apiclass/index.vue @@ -94,7 +94,7 @@ - + @@ -127,7 +127,7 @@ - + import { listApiclass, getApiclass, delApiclass, addApiclass, updateApiclass, exportApiclass } from "@/api/system/apiclass"; - +import {queryListModule} from "@/api/system/module" export default { name: "Apiclass", components: { @@ -212,6 +212,9 @@ export default { }, created() { this.getList(); + queryListModule().then(respone =>{ + console.log(respone) + }) }, methods: { /** 查询接口类名列表 */ diff --git a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ApiclassController.java b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ApiclassController.java index 7ce441d..0a6d6c4 100644 --- a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ApiclassController.java +++ b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ApiclassController.java @@ -2,15 +2,10 @@ package com.hchyun.web.controller.system; import java.io.Serializable; import java.util.List; -import java.util.regex.Pattern; - import com.hchyun.common.constant.ReturnConstants; import com.hchyun.common.core.controller.HcyBaseController; import com.hchyun.common.utils.ServerResult; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.prepost.PreAuthorize; @@ -36,7 +31,6 @@ import com.hchyun.common.utils.poi.ExcelUtil; * @author hchyun * @date 2021-01-24 */ -@Api(value = "接口类名管理",tags = "接口类名管理") @RestController @RequestMapping("/system/apiclass") public class ApiclassController extends HcyBaseController { @@ -45,10 +39,30 @@ public class ApiclassController extends HcyBaseController { @Autowired private ApiclassService apiclassService; + + /** + * 获取到api类的select选项 + * @return + */ + @PreAuthorize("@ss.hasAnyPermi('system:apiclass:querylist')") + @GetMapping("querylist") + public AjaxResult queryList(){ + try { + ServerResult> serverResult = apiclassService.selectApiclassList(new Apiclass()); + if (serverResult.isStart()){ + return AjaxResult.success(serverResult.getData()); + }else { + return AjaxResult.error(serverResult.getMsg()); + } + }catch (RuntimeException e){ + logger.error(e.getMessage()); + return AjaxResult.error(ReturnConstants.SYS_ERROR); + } + } + /** * 查询接口类名列表 */ - @ApiOperation("查询接口类名列表") @PreAuthorize("@ss.hasPermi('system:apiclass:list')") @GetMapping("/list") public Serializable list(Apiclass apiclass) { @@ -69,7 +83,6 @@ public class ApiclassController extends HcyBaseController { /** * 导出接口类名列表 */ - @ApiOperation("导出接口类名列表") @PreAuthorize("@ss.hasPermi('system:apiclass:export')") @Log(title = "接口类名", businessType = BusinessType.EXPORT) @GetMapping("/export") @@ -91,8 +104,6 @@ public class ApiclassController extends HcyBaseController { /** * 获取接口类名详细信息 */ - @ApiOperation("获取接口类名详细信息") - @ApiImplicitParam(name = "id" , value = "接口类名id" , required = true, dataType = "Long" , paramType = "path") @PreAuthorize("@ss.hasPermi('system:apiclass:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { @@ -112,8 +123,6 @@ public class ApiclassController extends HcyBaseController { /** * 新增接口类名 */ - @ApiOperation("新增接口类名") - @ApiImplicitParam(name = "apiclass" , value = "新增接口类名信息" , dataType = "Apiclass") @PreAuthorize("@ss.hasPermi('system:apiclass:add')") @Log(title = "接口类名", businessType = BusinessType.INSERT) @PostMapping @@ -143,8 +152,6 @@ public class ApiclassController extends HcyBaseController { /** * 修改接口类名 */ - @ApiOperation("修改接口类名") - @ApiImplicitParam(name = "apiclass" , value = "修改接口类名信息" , dataType = "Apiclass") @PreAuthorize("@ss.hasPermi('system:apiclass:edit')") @Log(title = "接口类名", businessType = BusinessType.UPDATE) @PutMapping @@ -175,8 +182,6 @@ public class ApiclassController extends HcyBaseController { /** * 删除接口类名 */ - @ApiOperation("删除接口类名") - @ApiImplicitParam(name = "ids" , value = "接口类名ids" , required = true, dataType = "Long" , paramType = "path") @PreAuthorize("@ss.hasPermi('system:apiclass:remove')") @Log(title = "接口类名", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") diff --git a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ModuleController.java b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ModuleController.java index fb4fa72..ad01c1e 100644 --- a/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ModuleController.java +++ b/hchyun/hchyun-admin/src/main/java/com/hchyun/web/controller/system/ModuleController.java @@ -7,6 +7,7 @@ import java.util.List; import com.hchyun.common.constant.ReturnConstants; import com.hchyun.common.core.controller.HcyBaseController; import com.hchyun.common.utils.ServerResult; +import com.hchyun.system.entity.Apiclass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.prepost.PreAuthorize; @@ -41,6 +42,29 @@ public class ModuleController extends HcyBaseController { @Autowired private ModuleService moduleService; + + /** + * 获取到api类的select选项 + * @return + */ + @PreAuthorize("@ss.hasAnyPermi('system:module:querylist')") + @GetMapping("querylist") + public AjaxResult queryList(){ + try { + ServerResult> serverResult = moduleService.selectModuleList(new Module()); + if (serverResult.isStart()){ + return AjaxResult.success(serverResult.getData()); + }else { + return AjaxResult.error(serverResult.getMsg()); + } + }catch (RuntimeException e){ + logger.error(e.getMessage()); + return AjaxResult.error(ReturnConstants.SYS_ERROR); + } + } + + + /** * 查询模块管理列表 */ diff --git a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/AjaxResult.java b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/AjaxResult.java index b10c4b4..3e6079e 100644 --- a/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/AjaxResult.java +++ b/hchyun/hchyun-common/src/main/java/com/hchyun/common/core/entity/AjaxResult.java @@ -1,158 +1,152 @@ package com.hchyun.common.core.entity; import java.util.HashMap; + import com.hchyun.common.constant.HttpStatus; import com.hchyun.common.utils.StringUtils; /** * 操作消息提醒 - * + * * @author hchyun */ -public class AjaxResult extends HashMap -{ +public class AjaxResult extends HashMap { private static final long serialVersionUID = 1L; - /** 状态码 */ + /** + * 状态码 + */ public static final String CODE_TAG = "code"; - /** 返回内容 */ + /** + * 返回内容 + */ public static final String MSG_TAG = "msg"; - /** 数据对象 */ + /** + * 数据对象 + */ public static final String DATA_TAG = "data"; /** * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 */ - public AjaxResult() - { + public AjaxResult() { } /** * 初始化一个新创建的 AjaxResult 对象 - * + * * @param code 状态码 - * @param msg 返回内容 + * @param msg 返回内容 */ - public AjaxResult(int code, String msg) - { + public AjaxResult(int code, String msg) { super.put(CODE_TAG, code); super.put(MSG_TAG, msg); } /** * 初始化一个新创建的 AjaxResult 对象 - * + * * @param code 状态码 - * @param msg 返回内容 + * @param msg 返回内容 * @param data 数据对象 */ - public AjaxResult(int code, String msg, Object data) - { + public AjaxResult(int code, String msg, Object data) { super.put(CODE_TAG, code); super.put(MSG_TAG, msg); - if (StringUtils.isNotNull(data)) - { + if (StringUtils.isNotNull(data)) { super.put(DATA_TAG, data); } } /** * 返回成功消息 - * + * * @return 成功消息 */ - public static AjaxResult success() - { + public static AjaxResult success() { return AjaxResult.success("操作成功"); } /** * 返回成功数据 - * + * * @return 成功消息 */ - public static AjaxResult success(Object data) - { + public static AjaxResult success(Object data) { return AjaxResult.success("操作成功", data); } /** * 返回成功消息 - * + * * @param msg 返回内容 * @return 成功消息 */ - public static AjaxResult success(String msg) - { + public static AjaxResult success(String msg) { return AjaxResult.success(msg, null); } /** * 返回成功消息 - * - * @param msg 返回内容 + * + * @param msg 返回内容 * @param data 数据对象 * @return 成功消息 */ - public static AjaxResult success(String msg, Object data) - { + public static AjaxResult success(String msg, Object data) { return new AjaxResult(HttpStatus.SUCCESS, msg, data); } /** * 返回错误消息 - * + * * @return */ - public static AjaxResult error() - { + public static AjaxResult error() { return AjaxResult.error("操作失败"); } /** * 返回错误消息 - * + * * @param msg 返回内容 * @return 警告消息 */ - public static AjaxResult error(String msg) - { + public static AjaxResult error(String msg) { return AjaxResult.error(msg, null); } /** * 返回错误消息 - * - * @param msg 返回内容 + * + * @param msg 返回内容 * @param data 数据对象 * @return 警告消息 */ - public static AjaxResult error(String msg, Object data) - { + public static AjaxResult error(String msg, Object data) { return new AjaxResult(HttpStatus.ERROR, msg, data); } /** * 返回错误消息 - * + * * @param code 状态码 - * @param msg 返回内容 + * @param msg 返回内容 * @return 警告消息 */ - public static AjaxResult error(int code, String msg) - { + public static AjaxResult error(int code, String msg) { return new AjaxResult(code, msg, null); } + /** * 返回提示信息 * * @param msg 返回内容 * @return 提示消息 */ - public static AjaxResult info(String msg) - { + public static AjaxResult info(String msg) { return new AjaxResult(HttpStatus.NO_DATA, msg, null); } } diff --git a/hchyun/hchyun-system/src/main/java/com/hchyun/system/dao/ApiclassDao.java b/hchyun/hchyun-system/src/main/java/com/hchyun/system/dao/ApiclassDao.java index c37aeae..0d7d843 100644 --- a/hchyun/hchyun-system/src/main/java/com/hchyun/system/dao/ApiclassDao.java +++ b/hchyun/hchyun-system/src/main/java/com/hchyun/system/dao/ApiclassDao.java @@ -1,19 +1,20 @@ package com.hchyun.system.dao; import java.util.List; + import com.hchyun.system.entity.Apiclass; /** * 接口类名Mapper接口 - * + * * @author hchyun * @date 2021-01-24 */ -public interface ApiclassDao -{ +public interface ApiclassDao { + /** * 查询接口类名 - * + * * @param id 接口类名ID * @return 接口类名 */ @@ -21,7 +22,7 @@ public interface ApiclassDao /** * 查询接口类名列表 - * + * * @param apiclass 接口类名 * @return 接口类名集合 */ @@ -29,7 +30,7 @@ public interface ApiclassDao /** * 新增接口类名 - * + * * @param apiclass 接口类名 * @return 结果 */ @@ -37,7 +38,7 @@ public interface ApiclassDao /** * 修改接口类名 - * + * * @param apiclass 接口类名 * @return 结果 */ @@ -45,7 +46,7 @@ public interface ApiclassDao /** * 删除接口类名 - * + * * @param id 接口类名ID * @return 结果 */ @@ -53,7 +54,7 @@ public interface ApiclassDao /** * 批量删除接口类名 - * + * * @param ids 需要删除的数据ID * @return 结果 */