diff --git a/doc/new_intall_20180302.sql b/doc/new_intall_20180302.sql index 44c3489d3..7108cbb18 100644 --- a/doc/new_intall_20180302.sql +++ b/doc/new_intall_20180302.sql @@ -186,8 +186,8 @@ create table sys_oper_log ( channel varchar(20) default '' comment '来源渠道', login_name varchar(50) default '' comment '登录名称', dept_name varchar(50) default '' comment '部门名称', - opert_url varchar(255) default '' comment '请求URL', - opert_ip varchar(30) default '' comment '操作地址', + oper_url varchar(255) default '' comment '请求URL', + oper_ip varchar(30) default '' comment '主机地址', oper_param varchar(255) default '' comment '请求参数', status int(1) default 0 comment '操作状态 0正常 1异常', error_msg varchar(255) default '' comment '错误消息', @@ -195,7 +195,7 @@ create table sys_oper_log ( primary key (oper_id) ) engine=innodb auto_increment=100 default charset=utf8; -insert into sys_oper_log values(1, '监控管理', '在线用户-踢出用户', 'com.ruoyi.project.monitor.online.controller.UserOnlineController()', 'web', 'admin', '研发部门', 'delete.do?id=1', '127.0.0.1', 'JSON参数', 0, '错误描述', '2018-01-01'); +insert into sys_oper_log values(1, '监控管理', '在线用户-强退用户', 'com.ruoyi.project.monitor.online.controller.UserOnlineController()', 'web', 'admin', '研发部门', 'delete.do?id=1', '127.0.0.1', 'JSON参数', 0, '错误描述', '2018-01-01'); -- ---------------------------- -- 8、数据字典表 diff --git a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 5f51cf026..311895e3d 100644 --- a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -84,8 +84,8 @@ public class LogAspect operLog.setStatus(UserConstants.NORMAL); // 请求的地址 String ip = ShiroUtils.getIp(); - operLog.setOpertIp(ip); - operLog.setOpertUrl(HttpContextUtils.getHttpServletRequest().getRequestURI()); + operLog.setOperIp(ip); + operLog.setOperUrl(HttpContextUtils.getHttpServletRequest().getRequestURI()); if (currentUser != null) { operLog.setLoginName(currentUser.getLoginName()); @@ -148,7 +148,7 @@ public class LogAspect { Map map = HttpContextUtils.getHttpServletRequest().getParameterMap(); String params = JSONObject.toJSONString(map); - operLog.setOpertParam(params); + operLog.setOperParam(params); } /** diff --git a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java index be3f13d28..bb4487a6f 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java +++ b/src/main/java/com/ruoyi/framework/shiro/service/LoginService.java @@ -55,7 +55,7 @@ public class LoginService } // 查询用户信息 - User user = userService.selectByUserName(username); + User user = userService.selectUserByName(username); if (user == null) { diff --git a/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java b/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java index 79e84b80f..1dd99ab98 100644 --- a/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java +++ b/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java @@ -53,7 +53,7 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO @Override protected Session doReadSession(Serializable sessionId) { - UserOnline userOnline = onlineService.selectByOnlineId(String.valueOf(sessionId)); + UserOnline userOnline = onlineService.selectOnlineById(String.valueOf(sessionId)); if (userOnline == null) { return null; @@ -95,7 +95,7 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO { onlineSession.resetAttributeChanged(); } - onlineService.saveByOnline(UserOnline.fromOnlineSession(onlineSession)); + onlineService.saveOnline(UserOnline.fromOnlineSession(onlineSession)); } /** @@ -110,6 +110,6 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO return; } onlineSession.setStatus(OnlineSession.OnlineStatus.off_line); - onlineService.deleteByOnlineId(String.valueOf(onlineSession.getId())); + onlineService.deleteOnlineById(String.valueOf(onlineSession.getId())); } } diff --git a/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java b/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java index 95144548d..555860885 100644 --- a/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java +++ b/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java @@ -91,7 +91,7 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager int timeout = (int) this.getGlobalSessionTimeout(); Date expiredDate = DateUtils.addMilliseconds(new Date(), 0 - timeout); UserOnlineServiceImpl userOnlineService = SpringUtils.getBean(UserOnlineServiceImpl.class); - List userOnlineList = userOnlineService.selectByOnlineExpired(expiredDate); + List userOnlineList = userOnlineService.selectOnlineByExpired(expiredDate); // 批量过期删除 List needOfflineIdList = new ArrayList(); for (UserOnline userOnline : userOnlineList) @@ -123,7 +123,7 @@ public class OnlineWebSessionManager extends DefaultWebSessionManager { try { - userOnlineService.batchDeleteByOnline(needOfflineIdList); + userOnlineService.batchDeleteOnline(needOfflineIdList); } catch (Exception e) { diff --git a/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java b/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java index 3a6bd9e8a..d5e59c04f 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java +++ b/src/main/java/com/ruoyi/project/monitor/online/controller/UserOnlineController.java @@ -61,7 +61,7 @@ public class UserOnlineController extends BaseController { for (String sessionId : ids) { - UserOnline online = userOnlineService.selectByOnlineId(sessionId); + UserOnline online = userOnlineService.selectOnlineById(sessionId); if (online == null) { return JSON.error("用户已下线"); @@ -73,17 +73,17 @@ public class UserOnlineController extends BaseController } onlineSession.setStatus(OnlineSession.OnlineStatus.off_line); online.setStatus(OnlineSession.OnlineStatus.off_line); - userOnlineService.saveByOnline(online); + userOnlineService.saveOnline(online); } return JSON.ok(); } - @Log(title = "监控管理", action = "在线用户-踢出用户") + @Log(title = "监控管理", action = "在线用户-强退用户") @RequestMapping("/forceLogout/{sessionId}") @ResponseBody public JSON forceLogout(@PathVariable("sessionId") String sessionId) { - UserOnline online = userOnlineService.selectByOnlineId(sessionId); + UserOnline online = userOnlineService.selectOnlineById(sessionId); if (online == null) { return JSON.error("用户已下线"); @@ -95,7 +95,7 @@ public class UserOnlineController extends BaseController } onlineSession.setStatus(OnlineSession.OnlineStatus.off_line); online.setStatus(OnlineSession.OnlineStatus.off_line); - userOnlineService.saveByOnline(online); + userOnlineService.saveOnline(online); return JSON.ok(); } diff --git a/src/main/java/com/ruoyi/project/monitor/online/dao/IUserOnlineDao.java b/src/main/java/com/ruoyi/project/monitor/online/dao/IUserOnlineDao.java index 7a248e51c..ec8c9715f 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/dao/IUserOnlineDao.java +++ b/src/main/java/com/ruoyi/project/monitor/online/dao/IUserOnlineDao.java @@ -18,7 +18,7 @@ public interface IUserOnlineDao * @param sessionId 会话ID * @return 在线用户信息 */ - public UserOnline selectByOnlineId(String sessionId); + public UserOnline selectOnlineById(String sessionId); /** * 通过会话序号删除信息 @@ -26,7 +26,7 @@ public interface IUserOnlineDao * @param sessionId 会话ID * @return 在线用户信息 */ - public int deleteByOnlineId(String sessionId); + public int deleteOnlineById(String sessionId); /** * 保存会话信息 @@ -34,7 +34,7 @@ public interface IUserOnlineDao * @param online 会话信息 * @return 结果 */ - public int saveByOnline(UserOnline online); + public int saveOnline(UserOnline online); /** * 查询会话集合 @@ -50,5 +50,5 @@ public interface IUserOnlineDao * @param lastAccessTime 过期时间 * @return 会话集合 */ - public List selectByOnlineExpired(String lastAccessTime); + public List selectOnlineByExpired(String lastAccessTime); } diff --git a/src/main/java/com/ruoyi/project/monitor/online/dao/UserOnlineDaoImpl.java b/src/main/java/com/ruoyi/project/monitor/online/dao/UserOnlineDaoImpl.java index bee540975..5b34f9f57 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/dao/UserOnlineDaoImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/online/dao/UserOnlineDaoImpl.java @@ -21,9 +21,9 @@ public class UserOnlineDaoImpl extends DynamicObjectBaseDao implements IUserOnli * @return 在线用户信息 */ @Override - public UserOnline selectByOnlineId(String sessionId) + public UserOnline selectOnlineById(String sessionId) { - return this.findForObject("SystemOnlineMapper.selectByOnlineId", sessionId); + return this.findForObject("SystemOnlineMapper.selectOnlineById", sessionId); } /** @@ -33,9 +33,9 @@ public class UserOnlineDaoImpl extends DynamicObjectBaseDao implements IUserOnli * @return 在线用户信息 */ @Override - public int deleteByOnlineId(String sessionId) + public int deleteOnlineById(String sessionId) { - return this.delete("SystemOnlineMapper.deleteByOnlineId", sessionId); + return this.delete("SystemOnlineMapper.deleteOnlineById", sessionId); } /** @@ -44,9 +44,9 @@ public class UserOnlineDaoImpl extends DynamicObjectBaseDao implements IUserOnli * @param online 会话信息 */ @Override - public int saveByOnline(UserOnline online) + public int saveOnline(UserOnline online) { - return this.save("SystemOnlineMapper.saveByOnline", online); + return this.save("SystemOnlineMapper.saveOnline", online); } /** @@ -75,12 +75,12 @@ public class UserOnlineDaoImpl extends DynamicObjectBaseDao implements IUserOnli * @param lastAccessTime 过期时间 */ @Override - public List selectByOnlineExpired(String lastAccessTime) + public List selectOnlineByExpired(String lastAccessTime) { List userOnlineList = null; try { - userOnlineList = this.findForList("SystemOnlineMapper.selectByOnlineExpired", lastAccessTime); + userOnlineList = this.findForList("SystemOnlineMapper.selectOnlineByExpired", lastAccessTime); } catch (Exception e) { diff --git a/src/main/java/com/ruoyi/project/monitor/online/service/IUserOnlineService.java b/src/main/java/com/ruoyi/project/monitor/online/service/IUserOnlineService.java index bb7cdb35e..51b43db89 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/service/IUserOnlineService.java +++ b/src/main/java/com/ruoyi/project/monitor/online/service/IUserOnlineService.java @@ -19,7 +19,7 @@ public interface IUserOnlineService * @param sessionId 会话ID * @return 在线用户信息 */ - public UserOnline selectByOnlineId(String sessionId); + public UserOnline selectOnlineById(String sessionId); /** * 通过会话序号删除信息 @@ -27,7 +27,7 @@ public interface IUserOnlineService * @param sessionId 会话ID * @return 在线用户信息 */ - public void deleteByOnlineId(String sessionId); + public void deleteOnlineById(String sessionId); /** * 通过会话序号删除信息 @@ -35,14 +35,14 @@ public interface IUserOnlineService * @param sessions 会话ID集合 * @return 在线用户信息 */ - public void batchDeleteByOnline(List sessions); + public void batchDeleteOnline(List sessions); /** * 保存会话信息 * * @param online 会话信息 */ - public void saveByOnline(UserOnline online); + public void saveOnline(UserOnline online); /** * 查询会话集合 @@ -65,5 +65,5 @@ public interface IUserOnlineService * @param expiredDate 有效期 * @return 会话集合 */ - public List selectByOnlineExpired(Date expiredDate); + public List selectOnlineByExpired(Date expiredDate); } diff --git a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java index a8cf05fed..08063688d 100644 --- a/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/online/service/UserOnlineServiceImpl.java @@ -34,9 +34,9 @@ public class UserOnlineServiceImpl implements IUserOnlineService * @return 在线用户信息 */ @Override - public UserOnline selectByOnlineId(String sessionId) + public UserOnline selectOnlineById(String sessionId) { - return userOnlineDao.selectByOnlineId(sessionId); + return userOnlineDao.selectOnlineById(sessionId); } /** @@ -46,12 +46,12 @@ public class UserOnlineServiceImpl implements IUserOnlineService * @return 在线用户信息 */ @Override - public void deleteByOnlineId(String sessionId) + public void deleteOnlineById(String sessionId) { - UserOnline userOnline = selectByOnlineId(sessionId); + UserOnline userOnline = selectOnlineById(sessionId); if (userOnline != null) { - userOnlineDao.deleteByOnlineId(sessionId); + userOnlineDao.deleteOnlineById(sessionId); } } @@ -62,14 +62,14 @@ public class UserOnlineServiceImpl implements IUserOnlineService * @return 在线用户信息 */ @Override - public void batchDeleteByOnline(List sessions) + public void batchDeleteOnline(List sessions) { for (String sessionId : sessions) { - UserOnline userOnline = selectByOnlineId(sessionId); + UserOnline userOnline = selectOnlineById(sessionId); if (userOnline != null) { - userOnlineDao.deleteByOnlineId(sessionId); + userOnlineDao.deleteOnlineById(sessionId); } } } @@ -80,9 +80,9 @@ public class UserOnlineServiceImpl implements IUserOnlineService * @param online 会话信息 */ @Override - public void saveByOnline(UserOnline online) + public void saveOnline(UserOnline online) { - userOnlineDao.saveByOnline(online); + userOnlineDao.saveOnline(online); } /** @@ -110,7 +110,7 @@ public class UserOnlineServiceImpl implements IUserOnlineService return; } session.setTimeout(1000); - userOnlineDao.deleteByOnlineId(sessionId); + userOnlineDao.deleteOnlineById(sessionId); } /** @@ -119,9 +119,9 @@ public class UserOnlineServiceImpl implements IUserOnlineService * @param online 会话信息 */ @Override - public List selectByOnlineExpired(Date expiredDate) + public List selectOnlineByExpired(Date expiredDate) { String lastAccessTime = DateUtils.dateTime("yyyy-MM-dd HH:mm:ss", expiredDate); - return userOnlineDao.selectByOnlineExpired(lastAccessTime); + return userOnlineDao.selectOnlineByExpired(lastAccessTime); } } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java index ae31b549d..8bd280887 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/controller/OperlogController.java @@ -1,13 +1,17 @@ package com.ruoyi.project.monitor.operlog.controller; import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; 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; @@ -58,4 +62,12 @@ public class OperlogController extends BaseController } return JSON.error(); } + + @GetMapping("/view/{operId}") + String edit(@PathVariable("operId") Long deptId, Model model) + { + OperLog operLog = operLogService.selectOperLogById(deptId); + model.addAttribute("operLog", operLog); + return prefix + "/view"; + } } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/dao/IOperLogDao.java b/src/main/java/com/ruoyi/project/monitor/operlog/dao/IOperLogDao.java index 19eb266f8..09608867a 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/dao/IOperLogDao.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/dao/IOperLogDao.java @@ -30,7 +30,15 @@ public interface IOperLogDao * 批量删除系统操作日志 * * @param ids 需要删除的数据 - * @return + * @return 结果 */ public int batchDeleteOperLog(Long[] ids); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public OperLog selectOperLogById(Long operId); } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/dao/OperLogDaoImpl.java b/src/main/java/com/ruoyi/project/monitor/operlog/dao/OperLogDaoImpl.java index cf33e7401..243f1ee6f 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/dao/OperLogDaoImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/dao/OperLogDaoImpl.java @@ -64,4 +64,15 @@ public class OperLogDaoImpl extends DynamicObjectBaseDao implements IOperLogDao } return rows; } + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public OperLog selectOperLogById(Long operId) + { + return this.findForObject("SystemOperLogMapper.selectOperLogById", operId); + } } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java index 1e86ea0bd..724c0c3b2 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/domain/OperLog.java @@ -26,11 +26,11 @@ public class OperLog /** 部门名称 */ private String deptName; /** 请求url */ - private String opertUrl; + private String operUrl; /** 操作地址 */ - private String opertIp; + private String operIp; /** 请求参数 */ - private String opertParam; + private String operParam; /** 状态0正常 1异常 */ private int status; /** 错误消息 */ diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/service/IOperLogService.java b/src/main/java/com/ruoyi/project/monitor/operlog/service/IOperLogService.java index 1b5f80ca8..0f8a38cbc 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/service/IOperLogService.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/service/IOperLogService.java @@ -30,7 +30,15 @@ public interface IOperLogService * 批量删除系统操作日志 * * @param ids 需要删除的数据 - * @return + * @return 结果 */ public int batchDeleteOperLog(Long[] ids); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public OperLog selectOperLogById(Long operId); } diff --git a/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java b/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java index e24aa0317..2682b3910 100644 --- a/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java +++ b/src/main/java/com/ruoyi/project/monitor/operlog/service/OperLogServiceImpl.java @@ -41,7 +41,7 @@ public class OperLogServiceImpl implements IOperLogService { return operLogDao.pageInfoQuery(pageUtilEntity); } - + /** * 批量删除系统操作日志 * @@ -52,4 +52,15 @@ public class OperLogServiceImpl implements IOperLogService { return operLogDao.batchDeleteOperLog(ids); } + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public OperLog selectOperLogById(Long operId) + { + return operLogDao.selectOperLogById(operId); + } } diff --git a/src/main/java/com/ruoyi/project/system/user/dao/IUserDao.java b/src/main/java/com/ruoyi/project/system/user/dao/IUserDao.java index cd41fa134..e7f4655fb 100644 --- a/src/main/java/com/ruoyi/project/system/user/dao/IUserDao.java +++ b/src/main/java/com/ruoyi/project/system/user/dao/IUserDao.java @@ -27,6 +27,6 @@ public interface IUserDao * @param userName 用户名 * @return 用户对象信息 */ - public User selectByUserName(String userName); + public User selectUserByName(String userName); } diff --git a/src/main/java/com/ruoyi/project/system/user/dao/UserDaoImpl.java b/src/main/java/com/ruoyi/project/system/user/dao/UserDaoImpl.java index bdbdb867c..b66ae18cf 100644 --- a/src/main/java/com/ruoyi/project/system/user/dao/UserDaoImpl.java +++ b/src/main/java/com/ruoyi/project/system/user/dao/UserDaoImpl.java @@ -45,9 +45,9 @@ public class UserDaoImpl extends DynamicObjectBaseDao implements IUserDao * @return 用户对象信息 */ @Override - public User selectByUserName(String username) + public User selectUserByName(String username) { - return this.findForObject("SystemUserMapper.selectByUserName", username); + return this.findForObject("SystemUserMapper.selectUserByName", username); } } diff --git a/src/main/java/com/ruoyi/project/system/user/service/IUserService.java b/src/main/java/com/ruoyi/project/system/user/service/IUserService.java index 990ef7789..35f97ae8a 100644 --- a/src/main/java/com/ruoyi/project/system/user/service/IUserService.java +++ b/src/main/java/com/ruoyi/project/system/user/service/IUserService.java @@ -27,5 +27,5 @@ public interface IUserService * @param userName 用户名 * @return 用户对象信息 */ - public User selectByUserName(String userName); + public User selectUserByName(String userName); } diff --git a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java index 858e90793..1c518deb6 100644 --- a/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java +++ b/src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java @@ -40,9 +40,9 @@ public class UserServiceImpl implements IUserService * @return 用户对象信息 */ @Override - public User selectByUserName(String userName) + public User selectUserByName(String userName) { - return userDao.selectByUserName(userName); + return userDao.selectUserByName(userName); } } diff --git a/src/main/resources/application-druid.yml b/src/main/resources/application-druid.yml index 7fe61c6e4..de649b95a 100644 --- a/src/main/resources/application-druid.yml +++ b/src/main/resources/application-druid.yml @@ -7,8 +7,8 @@ spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://10.213.24.45:3306/ry?useUnicode=true&characterEncoding=utf8 - #url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8 + #url: jdbc:mysql://10.213.24.45:3306/ry?useUnicode=true&characterEncoding=utf8 + url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8 username: root password: password # 初始化大小,最小,最大 diff --git a/src/main/resources/mybatis/system/SystemOnlineMapper.xml b/src/main/resources/mybatis/system/SystemOnlineMapper.xml index 164638e01..91c2d1cb1 100644 --- a/src/main/resources/mybatis/system/SystemOnlineMapper.xml +++ b/src/main/resources/mybatis/system/SystemOnlineMapper.xml @@ -25,18 +25,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select * from sys_user_online where sessionid = #{sessionid} - + replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, browser, os, status, start_timestsamp, last_access_time, expire_time) values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime}) - + delete from sys_user_online where sessionId = #{sessionId} @@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - SELECT * FROM sys_user_online o WHERE o.last_access_time #{lastAccessTime} ORDER BY o.last_access_time ASC diff --git a/src/main/resources/mybatis/system/SystemOperLogMapper.xml b/src/main/resources/mybatis/system/SystemOperLogMapper.xml index 812aa5e58..547d4b753 100644 --- a/src/main/resources/mybatis/system/SystemOperLogMapper.xml +++ b/src/main/resources/mybatis/system/SystemOperLogMapper.xml @@ -12,17 +12,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - + + + - insert into sys_oper_log(oper_id, title, action, method, channel, login_name, dept_name, opert_url, opert_ip, oper_param, status, error_msg) - values (#{operId}, #{title}, #{action}, #{method}, #{channel}, #{loginName}, #{deptName}, #{opertUrl}, #{opertIp}, #{opertParam}, #{status}, #{errorMsg}) + insert into sys_oper_log(oper_id, title, action, method, channel, login_name, dept_name, oper_url, oper_ip, oper_param, status, error_msg) + values (#{operId}, #{title}, #{action}, #{method}, #{channel}, #{loginName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{status}, #{errorMsg}) + select * + from sys_oper_log + where oper_id = #{operId} + \ No newline at end of file diff --git a/src/main/resources/mybatis/system/SystemUserMapper.xml b/src/main/resources/mybatis/system/SystemUserMapper.xml index 5e500c34e..8f7e582c8 100644 --- a/src/main/resources/mybatis/system/SystemUserMapper.xml +++ b/src/main/resources/mybatis/system/SystemUserMapper.xml @@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select * from sys_user - select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.salt, u.status, u.refuse_des, u.create_time, d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status from sys_user u diff --git a/src/main/resources/static/js/ajax-util.js b/src/main/resources/static/js/ajax-util.js deleted file mode 100644 index ae2c66d9f..000000000 --- a/src/main/resources/static/js/ajax-util.js +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Created by liuruijie on 2016/9/28. - * 前端控制 - */ - //状态码 -web_status = { - SUCCESS : "000", - FAIL : "001", - NO_LOGIN : "003", - NO_PRIVILEGE : "004" -}; - -function getQueryString(name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); - var r = window.location.search.substr(1).match(reg); - if (r != null) return unescape(r[2]); - return null; -} - -function simpleSuccess(result) { - //如果成功,则读取后端返回的操作指令 - if (result.status == web_status.SUCCESS) { - if(result['msg']){ - alert(result.msg); - } - //刷新 - if(result['refresh']){ - window.location.reload(); - return; - } - //返回 - if(result['back']){ - window.location.href = document.referrer; - } - //跳转 - if(result['redirectUrl']!=null){ - window.location.href = result.redirectUrl; - return; - } - return result.data; - } - //未登录 - if (result.status == web_status.NO_LOGIN) { - alert("您还未登陆!"); - window.location.href = - "http://127.0.0.1:8081/login.html?backToUrl="+encodeURIComponent(btoa(window.location.href)); - }else{ - //其他错误情况,直接弹出提示框 - if(result.msg!=null){ - alert(result.msg); - } - } - return null; -} - -//对jquery的ajax方法再次封装 -__ajax = function(url, data, success, type ,contentType){ - success = success||function(data){}; - data = data||{}; - var config = { - url:url, - type:type, - dataType:"json", - data:data, - success:function(result){ - success(simpleSuccess(result)); - } - }; - //如果需要token校验 - if(contentType){ - config.contentType = contentType; - } - - var token = $.cookie("token"); - if(token){ - config.beforeSend = function (xhr) { - xhr.setRequestHeader("Authorization", "Basic " + btoa(token)); - } - } - $.ajax(config) -}; - -//再再次封装 -AJAX = { - GET:function(url, data, success){ - __ajax(url, data, success, "get"); - }, - POST_JSON: function(url, data, success){ - __ajax(url, data, success, "post", "application/json"); - }, - POST:function(url, data, success){ - __ajax(url, data, success, "post"); - }, - DELETE: function(url, data, success){ - __ajax(url, data, success, "delete"); - }, - PUT:function(url, data, success){ - __ajax(url, data, success, "put", "application/json"); - }, - PATCH: function (url, data, success) { - __ajax(url, data, success, "patch", "application/json"); - }, - INCLUDE: function (url, id) { - $.ajax({ - url:url, - type:"get", - dataType:"html", - error: function (code) { - $("#"+id).html("加载失败"); - }, - success: function (result) { - $("#"+id).html(result); - } - }) - } -}; - -// -// -// function __act_ajax(url, data, success, type, contentType){ -// if(!success&&type == 'get'){ -// success = function(data){ -// } -// } -// else if(!success){ -// success = function(data){ -// window.location.reload(); -// } -// } -// var config = { -// url: url, -// data: data, -// type: type, -// dataType: "json", -// error: function(code){ -// alert("失败! code = "+code.status); -// }, -// success: function(result){ -// success(result); -// } -// }; -// -// if(contentType){ -// config.contentType = contentType; -// } -// $.ajax(config); -// } -// -// ACT_AJAX = { -// GET:function(url, data, success){ -// __act_ajax(url, data, success, "get"); -// }, -// POST:function(url, data, success){ -// __act_ajax(url, data, success, "post"); -// }, -// PUT:function(url, data, success){ -// __act_ajax(url, data, success, "put", "application/json"); -// }, -// DELETE:function(url, data, success){ -// __act_ajax(url, data, success, "delete"); -// }, -// PATCH: function (url, data, success) { -// __act_ajax(url, data, success, "patch", "application/json"); -// } -// }; diff --git a/src/main/resources/static/ruoyi/js/common.js b/src/main/resources/static/ruoyi/js/common.js new file mode 100644 index 000000000..608aa1a9d --- /dev/null +++ b/src/main/resources/static/ruoyi/js/common.js @@ -0,0 +1,84 @@ +/** + * 通用方法封装处理 + * Copyright (c) 2018 ruoyi + */ +/* + 参数解释: + title 标题 + url 请求的url + w 弹出层宽度(缺省调默认值) + h 弹出层高度(缺省调默认值) +*/ +function layer_show(title, url, w, h) { + if (title == null || title == '') { + title = false; + }; + if (url == null || url == '') { + url = "404.html"; + }; + if (w == null || w == '') { + w = 800; + }; + if (h == null || h == '') { + h = ($(window).height() - 50); + }; + layer.open({ + type: 2, + area: [w + 'px', h + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.4, + title: title, + content: url + }); +} + +/*关闭弹出框口*/ +function layer_close() { + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); +} + +//状态码 +web_status = { + SUCCESS: 0, + FAIL: 500 +}; + +//对jquery的ajax方法再次封装 +_ajax = function(url, data, success, type, contentType) { + success = success || + function(data) {}; + data = data || {}; + var config = { + url: url, + type: type, + dataType: "json", + data: data, + success: function(result) { + success(simpleSuccess(result)); + } + }; + $.ajax(config) +}; + +/** 返回结果处理 */ +function simpleSuccess(result) { + if (result.code == web_status.SUCCESS) { + if (result['msg']) { + layer.msg(result.msg, { icon: 1, time: 1000 }); + } + //刷新 + if (result['refresh']) { + refresh(); + return; + } + return result; + } else { + if (result.msg != null) { + layer.alert(result.msg, { icon: 2, title: "系统提示" }); + } + } + return null; +} \ No newline at end of file diff --git a/src/main/resources/static/ruoyi/monitor/operlog/operlog.js b/src/main/resources/static/ruoyi/monitor/operlog/operlog.js index 08241e089..cbc8f57f3 100644 --- a/src/main/resources/static/ruoyi/monitor/operlog/operlog.js +++ b/src/main/resources/static/ruoyi/monitor/operlog/operlog.js @@ -26,7 +26,7 @@ $(function() { title: '部门名称' }, { - field: 'opertIp', + field: 'operIp', title: '主机' }, { @@ -57,7 +57,10 @@ $(function() { initTable(columns, url); }); +/*操作日志-详细*/ function view(id) { + var url = prefix + '/view/' + id; + layer_show("操作日志详细", url, '800', '500'); } function batchRemove() { diff --git a/src/main/resources/templates/include.html b/src/main/resources/templates/include.html index d4506df73..b59801a75 100644 --- a/src/main/resources/templates/include.html +++ b/src/main/resources/templates/include.html @@ -32,5 +32,6 @@ + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index c4dbae243..7c0a876b1 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -126,6 +126,6 @@ - + diff --git a/src/main/resources/templates/monitor/operlog/view.html b/src/main/resources/templates/monitor/operlog/view.html new file mode 100644 index 000000000..992da7784 --- /dev/null +++ b/src/main/resources/templates/monitor/operlog/view.html @@ -0,0 +1,53 @@ + + + + + +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file