diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index f4e7dffe0..2680c01e6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -79,9 +79,9 @@ public class CaptchaController { @GetMapping("/captchaImage") public R> getCode() { Map ajax = new HashMap<>(); - boolean captchaOnOff = configService.selectCaptchaOnOff(); - ajax.put("captchaOnOff", captchaOnOff); - if (!captchaOnOff) { + boolean captchaEnabled = configService.selectCaptchaEnabled(); + ajax.put("captchaEnabled", captchaEnabled); + if (!captchaEnabled) { return R.ok(ajax); } // 保存验证码信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index 0f82c4eb5..55b6ac03a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -87,8 +87,8 @@ public class CacheController { @SaCheckPermission("monitor:cache:list") @GetMapping("/getKeys/{cacheName}") public R> getCacheKeys(@PathVariable String cacheName) { - Collection cacheKyes = RedisUtils.keys(cacheName + "*"); - return R.ok(cacheKyes); + Collection cacheKeys = RedisUtils.keys(cacheName + "*"); + return R.ok(cacheKeys); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java index 5584cbce3..080785c9f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java @@ -1,52 +1,52 @@ -package com.ruoyi.common.exception; - -/** - * 全局异常 - * - * @author ruoyi - */ -public class GlobalException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * 错误提示 - */ - private String message; - - /** - * 错误明细,内部调试错误 - *

- * 和 {@link CommonResult#getDetailMessage()} 一致的设计 - */ - private String detailMessage; - - /** - * 空构造方法,避免反序列化问题 - */ - public GlobalException() { - } - - public GlobalException(String message) { - this.message = message; - } - - public String getDetailMessage() { - return detailMessage; - } - - public GlobalException setDetailMessage(String detailMessage) { - this.detailMessage = detailMessage; - return this; - } - - @Override - public String getMessage() { - return message; - } - - public GlobalException setMessage(String message) { - this.message = message; - return this; - } -} \ No newline at end of file +package com.ruoyi.common.exception; + +/** + * 全局异常 + * + * @author ruoyi + */ +public class GlobalException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + *

+ * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public GlobalException() { + } + + public GlobalException(String message) { + this.message = message; + } + + public String getDetailMessage() { + return detailMessage; + } + + public GlobalException setDetailMessage(String detailMessage) { + this.detailMessage = detailMessage; + return this; + } + + @Override + public String getMessage() { + return message; + } + + public GlobalException setMessage(String message) { + this.message = message; + return this; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java index 95ce6d84c..53f41b3b9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java @@ -1,65 +1,65 @@ -package com.ruoyi.common.exception; - -/** - * 业务异常 - * - * @author ruoyi - */ -public final class ServiceException extends RuntimeException { - private static final long serialVersionUID = 1L; - - /** - * 错误码 - */ - private Integer code; - - /** - * 错误提示 - */ - private String message; - - /** - * 错误明细,内部调试错误 - *

- * 和 {@link CommonResult#getDetailMessage()} 一致的设计 - */ - private String detailMessage; - - /** - * 空构造方法,避免反序列化问题 - */ - public ServiceException() { - } - - public ServiceException(String message) { - this.message = message; - } - - public ServiceException(String message, Integer code) { - this.message = message; - this.code = code; - } - - public String getDetailMessage() { - return detailMessage; - } - - @Override - public String getMessage() { - return message; - } - - public Integer getCode() { - return code; - } - - public ServiceException setMessage(String message) { - this.message = message; - return this; - } - - public ServiceException setDetailMessage(String detailMessage) { - this.detailMessage = detailMessage; - return this; - } -} \ No newline at end of file +package com.ruoyi.common.exception; + +/** + * 业务异常 + * + * @author ruoyi + */ +public final class ServiceException extends RuntimeException { + private static final long serialVersionUID = 1L; + + /** + * 错误码 + */ + private Integer code; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + *

+ * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() { + } + + public ServiceException(String message) { + this.message = message; + } + + public ServiceException(String message, Integer code) { + this.message = message; + this.code = code; + } + + public String getDetailMessage() { + return detailMessage; + } + + @Override + public String getMessage() { + return message; + } + + public Integer getCode() { + return code; + } + + public ServiceException setMessage(String message) { + this.message = message; + return this; + } + + public ServiceException setDetailMessage(String detailMessage) { + this.detailMessage = detailMessage; + return this; + } +} diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm index 6c9cdd612..64adcb497 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -492,8 +492,8 @@ function handleAdd() { function handleUpdate(row) { loading.value = true reset(); - const ${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value - get${BusinessName}(${pkColumn.javaField}).then(response => { + const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value + get${BusinessName}(_${pkColumn.javaField}).then(response => { loading.value = false; form.value = response.data; #foreach ($column in $columns) @@ -545,10 +545,10 @@ function submitForm() { /** 删除按钮操作 */ function handleDelete(row) { - const ${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; + const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() { loading.value = true; - return del${BusinessName}(${pkColumn.javaField}s); + return del${BusinessName}(_${pkColumn.javaField}s); }).then(() => { loading.value = true; getList(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index 10c4acdd7..f957b5b25 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -37,7 +37,7 @@ public interface ISysConfigService { * * @return true开启,false关闭 */ - boolean selectCaptchaOnOff(); + boolean selectCaptchaEnabled(); /** * 查询参数配置列表 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java index 5a43203bf..acb27b7d6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java @@ -59,9 +59,9 @@ public class SysLoginService { */ public String login(String username, String password, String code, String uuid) { HttpServletRequest request = ServletUtils.getRequest(); - boolean captchaOnOff = configService.selectCaptchaOnOff(); + boolean captchaEnabled = configService.selectCaptchaEnabled(); // 验证码开关 - if (captchaOnOff) { + if (captchaEnabled) { validateCaptcha(username, code, uuid, request); } SysUser user = loadUserByUsername(username); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java index cefe4f75e..6d861e098 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysRegisterService.java @@ -43,9 +43,9 @@ public class SysRegisterService { // 校验用户类型是否存在 String userType = UserType.getUserType(registerBody.getUserType()).getUserType(); - boolean captchaOnOff = configService.selectCaptchaOnOff(); + boolean captchaEnabled = configService.selectCaptchaEnabled(); // 验证码开关 - if (captchaOnOff) { + if (captchaEnabled) { validateCaptcha(username, registerBody.getCode(), registerBody.getUuid(), request); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index ab6a826a7..010c3beb2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -87,12 +87,12 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService { * @return true开启,false关闭 */ @Override - public boolean selectCaptchaOnOff() { - String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); - if (StringUtils.isEmpty(captchaOnOff)) { + public boolean selectCaptchaEnabled() { + String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); + if (StringUtils.isEmpty(captchaEnabled)) { return true; } - return Convert.toBool(captchaOnOff); + return Convert.toBool(captchaEnabled); } /** diff --git a/ruoyi-ui/src/components/DictData/index.js b/ruoyi-ui/src/components/DictData/index.js index 24e3e9c83..d43d81657 100644 --- a/ruoyi-ui/src/components/DictData/index.js +++ b/ruoyi-ui/src/components/DictData/index.js @@ -1,7 +1,23 @@ import Vue from 'vue' +import store from '@/store' import DataDict from '@/utils/dict' import { getDicts as getDicts } from '@/api/system/dict/data' +function searchDictByKey(dict, key) { + if (key == null && key == "") { + return null + } + try { + for (let i = 0; i < dict.length; i++) { + if (dict[i].key == key) { + return dict[i].value + } + } + } catch (e) { + return null + } +} + function install() { Vue.use(DataDict, { metas: { @@ -9,7 +25,19 @@ function install() { labelField: 'dictLabel', valueField: 'dictValue', request(dictMeta) { - return getDicts(dictMeta.type).then(res => res.data) + const storeDict = searchDictByKey(store.getters.dict, dictMeta.type) + if (storeDict) { + return new Promise(resolve => { resolve(storeDict) }) + } else { + return new Promise((resolve, reject) => { + getDicts(dictMeta.type).then(res => { + store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data }) + resolve(res.data) + }).catch(error => { + reject(error) + }) + }) + } }, }, }, diff --git a/ruoyi-ui/src/components/RightPanel/index.vue b/ruoyi-ui/src/components/RightPanel/index.vue index fbf27eb4f..2d6122bc0 100644 --- a/ruoyi-ui/src/components/RightPanel/index.vue +++ b/ruoyi-ui/src/components/RightPanel/index.vue @@ -1,5 +1,5 @@ - -