mirror of https://gitee.com/y_project/RuoYi.git
优化操作消息
parent
1788566a63
commit
21a743056c
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.common.exception;
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class DemoModeException extends RuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DemoModeException()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.ruoyi.framework.web.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返回数据通用处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class JSON extends HashMap<String, Object>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JSON()
|
||||
{
|
||||
put("code", 0);
|
||||
put("msg", "操作成功");
|
||||
}
|
||||
|
||||
public static JSON error()
|
||||
{
|
||||
return error(1, "操作失败");
|
||||
}
|
||||
|
||||
public static JSON error(String msg)
|
||||
{
|
||||
return error(500, msg);
|
||||
}
|
||||
|
||||
public static JSON error(int code, String msg)
|
||||
{
|
||||
JSON json = new JSON();
|
||||
json.put("code", code);
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSON ok(String msg)
|
||||
{
|
||||
JSON json = new JSON();
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSON ok(Map<String, Object> map)
|
||||
{
|
||||
JSON json = new JSON();
|
||||
json.putAll(map);
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSON ok()
|
||||
{
|
||||
return new JSON();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSON put(String key, Object value)
|
||||
{
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.ruoyi.framework.web.domain;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作消息提醒
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class Message extends HashMap<String, Object>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 初始化一个新创建的 Message 对象,默认成功。
|
||||
*/
|
||||
public Message()
|
||||
{
|
||||
put("code", 0);
|
||||
put("msg", "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static Message error()
|
||||
{
|
||||
return error(1, "操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static Message error(String msg)
|
||||
{
|
||||
return error(500, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param msg 内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static Message error(int code, String msg)
|
||||
{
|
||||
Message json = new Message();
|
||||
json.put("code", code);
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param msg 内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static Message ok(String msg)
|
||||
{
|
||||
Message json = new Message();
|
||||
json.put("msg", msg);
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param map 内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static Message ok(Map<String, Object> map)
|
||||
{
|
||||
Message json = new Message();
|
||||
json.putAll(map);
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static Message ok()
|
||||
{
|
||||
return new Message();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param key 键值
|
||||
* @param value 内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
@Override
|
||||
public Message put(String key, Object value)
|
||||
{
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,12 @@ package com.ruoyi.framework.web.exception;
|
|||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
|
||||
import com.ruoyi.common.exception.DemoModeException;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
|
||||
/**
|
||||
* 自定义异常处理器
|
||||
|
@ -22,40 +24,49 @@ public class DefaultExceptionHandler
|
|||
* 权限校验失败
|
||||
*/
|
||||
@ExceptionHandler(AuthorizationException.class)
|
||||
public JSON handleAuthorizationException(AuthorizationException e)
|
||||
public Message handleAuthorizationException(AuthorizationException e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
return JSON.error("您没有数据的权限,请联系管理员添加");
|
||||
return Message.error("您没有数据的权限,请联系管理员添加");
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求方式不支持
|
||||
*/
|
||||
@ExceptionHandler({ HttpRequestMethodNotSupportedException.class })
|
||||
public JSON handleException(HttpRequestMethodNotSupportedException e)
|
||||
public Message handleException(HttpRequestMethodNotSupportedException e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
return JSON.error("不支持' " + e.getMethod() + "'请求");
|
||||
return Message.error("不支持' " + e.getMethod() + "'请求");
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截未知的运行时异常
|
||||
*/
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public JSON notFount(RuntimeException e)
|
||||
public Message notFount(RuntimeException e)
|
||||
{
|
||||
log.error("运行时异常:", e);
|
||||
return JSON.error("运行时异常:" + e.getMessage());
|
||||
return Message.error("运行时异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public JSON handleException(Exception e)
|
||||
public Message handleException(Exception e)
|
||||
{
|
||||
log.error(e.getMessage(), e);
|
||||
return JSON.error("服务器错误,请联系管理员");
|
||||
return Message.error("服务器错误,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*/
|
||||
@ExceptionHandler(DemoModeException.class)
|
||||
public Message demoModeException(DemoModeException e)
|
||||
{
|
||||
return Message.error("演示模式,不允许操作");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.monitor.job.domain.Job;
|
||||
import com.ruoyi.project.monitor.job.service.IJobService;
|
||||
|
@ -56,35 +56,35 @@ public class JobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:remove")
|
||||
@RequestMapping("/remove/{jobId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("jobId") Long jobId)
|
||||
public Message remove(@PathVariable("jobId") Long jobId)
|
||||
{
|
||||
Job job = jobService.selectJobById(jobId);
|
||||
if (job == null)
|
||||
{
|
||||
return JSON.error("调度任务不存在");
|
||||
return Message.error("调度任务不存在");
|
||||
}
|
||||
if (jobService.deleteJob(job) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@Log(title = "监控管理", action = "定时任务-批量删除")
|
||||
@RequiresPermissions("monitor:job:batchRemove")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
jobService.batchDeleteJob(ids);
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return JSON.error(e.getMessage());
|
||||
return Message.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ public class JobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public JSON changeStatus(Job job)
|
||||
public Message changeStatus(Job job)
|
||||
{
|
||||
if (jobService.changeStatus(job) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,12 +135,12 @@ public class JobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(Job job)
|
||||
public Message save(Job job)
|
||||
{
|
||||
if (jobService.saveJobCron(job) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.monitor.job.domain.JobLog;
|
||||
import com.ruoyi.project.monitor.job.service.IJobLogService;
|
||||
|
@ -55,35 +55,35 @@ public class JobLogController extends BaseController
|
|||
@RequiresPermissions("monitor:job:remove")
|
||||
@RequestMapping("/remove/{jobLogId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("jobLogId") Long jobLogId)
|
||||
public Message remove(@PathVariable("jobLogId") Long jobLogId)
|
||||
{
|
||||
JobLog jobLog = jobLogService.selectJobLogById(jobLogId);
|
||||
if (jobLog == null)
|
||||
{
|
||||
return JSON.error("调度任务不存在");
|
||||
return Message.error("调度任务不存在");
|
||||
}
|
||||
if (jobLogService.deleteJobLogById(jobLogId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@Log(title = "监控管理", action = "定时任务-批量删除日志")
|
||||
@RequiresPermissions("monitor:job:batchRemove")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
jobLogService.batchDeleteJoblog(ids);
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return JSON.error(e.getMessage());
|
||||
return Message.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.monitor.logininfor.domain.Logininfor;
|
||||
import com.ruoyi.project.monitor.logininfor.service.ILogininforService;
|
||||
|
@ -51,13 +51,13 @@ public class LogininforController extends BaseController
|
|||
@Log(title = "监控管理", action = "登录日志-批量删除")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = logininforService.batchDeleteLogininfor(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.monitor.online.domain.OnlineSession;
|
||||
import com.ruoyi.project.monitor.online.domain.UserOnline;
|
||||
|
@ -57,47 +57,47 @@ public class UserOnlineController extends BaseController
|
|||
@Log(title = "监控管理", action = "在线用户-批量强退用户")
|
||||
@PostMapping("/batchForceLogout")
|
||||
@ResponseBody
|
||||
public JSON batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||
public Message batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||
{
|
||||
for (String sessionId : ids)
|
||||
{
|
||||
UserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (online == null)
|
||||
{
|
||||
return JSON.error("用户已下线");
|
||||
return Message.error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
return JSON.error("用户已下线");
|
||||
return Message.error("用户已下线");
|
||||
}
|
||||
onlineSession.setStatus(OnlineSession.OnlineStatus.off_line);
|
||||
online.setStatus(OnlineSession.OnlineStatus.off_line);
|
||||
userOnlineService.saveOnline(online);
|
||||
}
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@Log(title = "监控管理", action = "在线用户-强退用户")
|
||||
@RequestMapping("/forceLogout/{sessionId}")
|
||||
@ResponseBody
|
||||
public JSON forceLogout(@PathVariable("sessionId") String sessionId)
|
||||
public Message forceLogout(@PathVariable("sessionId") String sessionId)
|
||||
{
|
||||
UserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (online == null)
|
||||
{
|
||||
return JSON.error("用户已下线");
|
||||
return Message.error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
return JSON.error("用户已下线");
|
||||
return Message.error("用户已下线");
|
||||
}
|
||||
onlineSession.setStatus(OnlineSession.OnlineStatus.off_line);
|
||||
online.setStatus(OnlineSession.OnlineStatus.off_line);
|
||||
userOnlineService.saveOnline(online);
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.monitor.operlog.domain.OperLog;
|
||||
import com.ruoyi.project.monitor.operlog.service.IOperLogService;
|
||||
|
@ -53,14 +53,14 @@ public class OperlogController extends BaseController
|
|||
@Log(title = "监控管理", action = "操作日志-批量删除")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = operLogService.batchDeleteOperLog(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:detail")
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.project.system.dept.domain.Dept;
|
||||
import com.ruoyi.project.system.dept.service.IDeptService;
|
||||
|
||||
|
@ -80,13 +80,13 @@ public class DeptController extends BaseController
|
|||
@RequiresPermissions("system:dept:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(Dept dept)
|
||||
public Message save(Dept dept)
|
||||
{
|
||||
if (deptService.saveDept(dept) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,22 +96,22 @@ public class DeptController extends BaseController
|
|||
@RequiresPermissions("system:dept:remove")
|
||||
@GetMapping("/remove/{deptId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("deptId") Long deptId)
|
||||
public Message remove(@PathVariable("deptId") Long deptId)
|
||||
{
|
||||
if (deptService.selectDeptCount(deptId) > 0)
|
||||
{
|
||||
return JSON.error(1, "存在下级部门,不允许删除");
|
||||
return Message.error(1, "存在下级部门,不允许删除");
|
||||
}
|
||||
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return JSON.error(1, "部门存在用户,不允许删除");
|
||||
return Message.error(1, "部门存在用户,不允许删除");
|
||||
}
|
||||
if (deptService.deleteDeptById(deptId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.dict.domain.DictData;
|
||||
import com.ruoyi.project.system.dict.service.IDictDataService;
|
||||
|
@ -81,13 +81,13 @@ public class DictDataController extends BaseController
|
|||
@RequiresPermissions("system:dict:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(DictData dict)
|
||||
public Message save(DictData dict)
|
||||
{
|
||||
if (dictDataService.saveDictData(dict) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,31 +97,31 @@ public class DictDataController extends BaseController
|
|||
@RequiresPermissions("system:dict:remove")
|
||||
@RequestMapping("/remove/{dictCode}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("dictCode") Long dictCode)
|
||||
public Message remove(@PathVariable("dictCode") Long dictCode)
|
||||
{
|
||||
DictData dictData = dictDataService.selectDictDataById(dictCode);
|
||||
if (dictData == null)
|
||||
{
|
||||
return JSON.error("字典数据不存在");
|
||||
return Message.error("字典数据不存在");
|
||||
}
|
||||
if (dictDataService.deleteDictDataById(dictCode) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@Log(title = "系统管理", action = "字典类型-批量删除")
|
||||
@RequiresPermissions("system:dict:batchRemove")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = dictDataService.batchDeleteDictData(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.dict.domain.DictType;
|
||||
import com.ruoyi.project.system.dict.service.IDictTypeService;
|
||||
|
@ -82,13 +82,13 @@ public class DictTypeController extends BaseController
|
|||
@RequiresPermissions("system:dict:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(DictType dict)
|
||||
public Message save(DictType dict)
|
||||
{
|
||||
if (dictTypeService.saveDictType(dict) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,32 +98,32 @@ public class DictTypeController extends BaseController
|
|||
@RequiresPermissions("system:dict:remove")
|
||||
@RequestMapping("/remove/{dictId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("dictId") Long dictId)
|
||||
public Message remove(@PathVariable("dictId") Long dictId)
|
||||
{
|
||||
DictType dictType = dictTypeService.selectDictTypeById(dictId);
|
||||
if (dictType == null)
|
||||
{
|
||||
return JSON.error("字典不存在");
|
||||
return Message.error("字典不存在");
|
||||
}
|
||||
if (dictTypeService.deleteDictTypeById(dictId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@Log(title = "系统管理", action = "字典类型-批量删除")
|
||||
@RequiresPermissions("system:dict:batchRemove")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = dictTypeService.batchDeleteDictType(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.project.system.menu.domain.Menu;
|
||||
import com.ruoyi.project.system.menu.service.IMenuService;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
|
@ -56,15 +56,15 @@ public class MenuController extends BaseController
|
|||
@RequiresPermissions("system:menu:remove")
|
||||
@GetMapping("/remove/{menuId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("menuId") Long menuId)
|
||||
public Message remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.deleteMenuById(menuId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
return JSON.error(1, "删除失败");
|
||||
return Message.error(1, "删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,13 +111,13 @@ public class MenuController extends BaseController
|
|||
@RequiresPermissions("system:menu:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(Menu menu)
|
||||
public Message save(Menu menu)
|
||||
{
|
||||
if (menuService.saveMenu(menu) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.post.domain.Post;
|
||||
import com.ruoyi.project.system.post.service.IPostService;
|
||||
|
@ -56,32 +56,32 @@ public class PostController extends BaseController
|
|||
@RequiresPermissions("system:post:remove")
|
||||
@RequestMapping("/remove/{postId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("postId") Long postId)
|
||||
public Message remove(@PathVariable("postId") Long postId)
|
||||
{
|
||||
Post post = postService.selectPostById(postId);
|
||||
if (post == null)
|
||||
{
|
||||
return JSON.error("岗位不存在");
|
||||
return Message.error("岗位不存在");
|
||||
}
|
||||
if (postService.deletePostById(postId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:batchRemove")
|
||||
@Log(title = "系统管理", action = "岗位管理-批量删除")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = postService.batchDeletePost(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,13 +115,13 @@ public class PostController extends BaseController
|
|||
@RequiresPermissions("system:post:save")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(Post post)
|
||||
public Message save(Post post)
|
||||
{
|
||||
if (postService.savePost(post) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.role.domain.Role;
|
||||
import com.ruoyi.project.system.role.service.IRoleService;
|
||||
|
@ -81,45 +81,45 @@ public class RoleController extends BaseController
|
|||
@Log(title = "系统管理", action = "角色管理-保存角色")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(Role role)
|
||||
public Message save(Role role)
|
||||
{
|
||||
if (roleService.saveRole(role) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "系统管理", action = "角色管理-删除角色")
|
||||
@RequestMapping("/remove/{roleId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("roleId") Long roleId)
|
||||
public Message remove(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
Role role = roleService.selectRoleById(roleId);
|
||||
if (role == null)
|
||||
{
|
||||
return JSON.error("角色不存在");
|
||||
return Message.error("角色不存在");
|
||||
}
|
||||
if (roleService.deleteRoleById(roleId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:batchRemove")
|
||||
@Log(title = "系统管理", action = "角色管理-批量删除")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = roleService.batchDeleteRole(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
|
@ -30,14 +30,14 @@ public class LoginController extends BaseController
|
|||
|
||||
@PostMapping("/login")
|
||||
@ResponseBody
|
||||
public JSON ajaxLogin(String username, String password)
|
||||
public Message ajaxLogin(String username, String password)
|
||||
{
|
||||
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
try
|
||||
{
|
||||
subject.login(token);
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ public class LoginController extends BaseController
|
|||
{
|
||||
msg = e.getMessage();
|
||||
}
|
||||
return JSON.error(msg);
|
||||
return Message.error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.JSON;
|
||||
import com.ruoyi.framework.web.domain.Message;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.project.system.post.domain.Post;
|
||||
import com.ruoyi.project.system.post.service.IPostService;
|
||||
|
@ -106,46 +106,46 @@ public class UserController extends BaseController
|
|||
@Log(title = "系统管理", action = "用户管理-重置密码")
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public JSON resetPwd(User user)
|
||||
public Message resetPwd(User user)
|
||||
{
|
||||
int rows = userService.updateUser(user);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:remove")
|
||||
@Log(title = "系统管理", action = "用户管理-删除用户")
|
||||
@RequestMapping("/remove/{userId}")
|
||||
@ResponseBody
|
||||
public JSON remove(@PathVariable("userId") Long userId)
|
||||
public Message remove(@PathVariable("userId") Long userId)
|
||||
{
|
||||
User user = userService.selectUserById(userId);
|
||||
if (user == null)
|
||||
{
|
||||
return JSON.error("用户不存在");
|
||||
return Message.error("用户不存在");
|
||||
}
|
||||
if (userService.deleteUserById(userId) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:batchRemove")
|
||||
@Log(title = "系统管理", action = "用户管理-批量删除")
|
||||
@PostMapping("/batchRemove")
|
||||
@ResponseBody
|
||||
public JSON batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
public Message batchRemove(@RequestParam("ids[]") Long[] ids)
|
||||
{
|
||||
int rows = userService.batchDeleteUser(ids);
|
||||
if (rows > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,13 +155,13 @@ public class UserController extends BaseController
|
|||
@Log(title = "系统管理", action = "部门管理-保存部门")
|
||||
@PostMapping("/save")
|
||||
@ResponseBody
|
||||
public JSON save(User user)
|
||||
public Message save(User user)
|
||||
{
|
||||
if (userService.saveUser(user) > 0)
|
||||
{
|
||||
return JSON.ok();
|
||||
return Message.ok();
|
||||
}
|
||||
return JSON.error();
|
||||
return Message.error();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue