diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java index aa7c436b..95a00b73 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java @@ -797,16 +797,20 @@ public class Convert } else if (obj instanceof byte[] || obj instanceof Byte[]) { - if (obj instanceof byte[]){ + if (obj instanceof byte[]) + { return str((byte[]) obj, charset); - } else { - Byte[] bytes = (Byte[])obj; + } + else + { + Byte[] bytes = (Byte[]) obj; int length = bytes.length; byte[] dest = new byte[length]; - for (int i = 0; i < length; i++) { + for (int i = 0; i < length; i++) + { dest[i] = bytes[i]; } - return str (dest,charset); + return str(dest, charset); } } else if (obj instanceof ByteBuffer) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java index 6460340b..1b423d63 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java @@ -83,4 +83,47 @@ public class BaseController { return rows > 0 ? AjaxResult.success() : AjaxResult.error(); } + + /** + * 响应返回结果 + * + * @param result 结果 + * @return 操作结果 + */ + protected AjaxResult toAjax(boolean result) + { + return result ? success() : error(); + } + + /** + * 返回成功 + */ + public AjaxResult success() + { + return AjaxResult.success(); + } + + /** + * 返回失败消息 + */ + public AjaxResult error() + { + return AjaxResult.error(); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(String message) + { + return AjaxResult.success(message); + } + + /** + * 返回失败消息 + */ + public AjaxResult error(String message) + { + return AjaxResult.error(message); + } }