123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- package cn.ele6.catalyzer.ruoyi.enhance;
- import cn.ele6.catalyzer.ruoyi.custom.RuoYiResponse;
- import com.ruoyi.common.constant.HttpStatus;
- import org.springframework.beans.BeanUtils;
- import java.io.Serializable;
- /**
- * 改造。
- */
- public class AjaxResult extends com.ruoyi.common.core.domain.AjaxResult implements Serializable, RuoYiResponse {
- /**
- * 返回成功消息
- * copy.
- *
- * @return 成功消息
- */
- public static AjaxResult success() {
- return convert(com.ruoyi.common.core.domain.AjaxResult.success("操作成功"));
- }
- /**
- * 返回成功数据
- * copy.
- *
- * @return 成功消息
- */
- public static AjaxResult success(Object data) {
- return convert(com.ruoyi.common.core.domain.AjaxResult.success("操作成功", data));
- }
- /**
- * 返回成功消息
- * copy.
- *
- * @param msg 返回内容
- * @return 成功消息
- */
- public static AjaxResult success(String msg) {
- return convert(com.ruoyi.common.core.domain.AjaxResult.success(msg, null));
- }
- /**
- * 返回成功消息
- * copy.
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 成功消息
- */
- public static AjaxResult success(String msg, Object data) {
- return convert(new com.ruoyi.common.core.domain.AjaxResult(HttpStatus.SUCCESS, msg, data));
- }
- /**
- * 返回警告消息
- * copy.
- *
- * @param msg 返回内容
- * @return 警告消息
- */
- public static AjaxResult warn(String msg) {
- return convert(com.ruoyi.common.core.domain.AjaxResult.warn(msg, null));
- }
- /**
- * 返回警告消息
- * copy.
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 警告消息
- */
- public static AjaxResult warn(String msg, Object data) {
- return convert(new com.ruoyi.common.core.domain.AjaxResult(HttpStatus.WARN, msg, data));
- }
- /**
- * 返回错误消息
- * copy.
- *
- * @return 错误消息
- */
- public static AjaxResult error() {
- return convert(com.ruoyi.common.core.domain.AjaxResult.error("操作失败"));
- }
- /**
- * 返回错误消息
- * copy.
- *
- * @param msg 返回内容
- * @return 错误消息
- */
- public static AjaxResult error(String msg) {
- return convert(com.ruoyi.common.core.domain.AjaxResult.error(msg, null));
- }
- /**
- * 返回错误消息
- * copy.
- *
- * @param msg 返回内容
- * @param data 数据对象
- * @return 错误消息
- */
- public static AjaxResult error(String msg, Object data) {
- return convert(new com.ruoyi.common.core.domain.AjaxResult(HttpStatus.ERROR, msg, data));
- }
- /**
- * 返回错误消息
- * copy.
- *
- * @param code 状态码
- * @param msg 返回内容
- * @return 错误消息
- */
- public static AjaxResult error(int code, String msg) {
- return convert(new com.ruoyi.common.core.domain.AjaxResult(code, msg, null));
- }
- /**
- * copy obj and convert type.
- *
- * @param o
- * @return
- */
- public static AjaxResult convert(com.ruoyi.common.core.domain.AjaxResult o) {
- AjaxResult t = new AjaxResult();
- BeanUtils.copyProperties(o, t);
- return t;
- }
- }
|