通用Controller添加响应返回消息

pull/52/MERGE
RuoYi 4 years ago
parent 265b680a61
commit 0f733b89dc

@ -797,13 +797,17 @@ public class Convert
} }
else if (obj instanceof byte[] || obj instanceof Byte[]) else if (obj instanceof byte[] || obj instanceof Byte[])
{ {
if (obj instanceof byte[]){ if (obj instanceof byte[])
{
return str((byte[]) obj, charset); return str((byte[]) obj, charset);
} else { }
else
{
Byte[] bytes = (Byte[]) obj; Byte[] bytes = (Byte[]) obj;
int length = bytes.length; int length = bytes.length;
byte[] dest = new byte[length]; byte[] dest = new byte[length];
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++)
{
dest[i] = bytes[i]; dest[i] = bytes[i];
} }
return str(dest, charset); return str(dest, charset);

@ -83,4 +83,47 @@ public class BaseController
{ {
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); 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);
}
} }

Loading…
Cancel
Save