diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml
new file mode 100644
index 0000000..ed1f8a0
--- /dev/null
+++ b/ruoyi-system/pom.xml
@@ -0,0 +1,28 @@
+
+
+
+ ruoyi
+ com.ruoyi
+ 4.7.2
+
+ 4.0.0
+
+ ruoyi-system
+
+
+ system系统模块
+
+
+
+
+
+
+ com.ruoyi
+ ruoyi-common
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
new file mode 100644
index 0000000..56f3767
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java
@@ -0,0 +1,110 @@
+package com.ruoyi.system.domain;
+
+import javax.validation.constraints.*;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 参数配置表 sys_config
+ *
+ * @author ruoyi
+ */
+public class SysConfig extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 参数主键 */
+ @Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
+ private Long configId;
+
+ /** 参数名称 */
+ @Excel(name = "参数名称")
+ private String configName;
+
+ /** 参数键名 */
+ @Excel(name = "参数键名")
+ private String configKey;
+
+ /** 参数键值 */
+ @Excel(name = "参数键值")
+ private String configValue;
+
+ /** 系统内置(Y是 N否) */
+ @Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
+ private String configType;
+
+ public Long getConfigId()
+ {
+ return configId;
+ }
+
+ public void setConfigId(Long configId)
+ {
+ this.configId = configId;
+ }
+
+ @NotBlank(message = "参数名称不能为空")
+ @Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ }
+
+ @NotBlank(message = "参数键名长度不能为空")
+ @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
+ public String getConfigKey()
+ {
+ return configKey;
+ }
+
+ public void setConfigKey(String configKey)
+ {
+ this.configKey = configKey;
+ }
+
+ @NotBlank(message = "参数键值不能为空")
+ @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
+ public String getConfigValue()
+ {
+ return configValue;
+ }
+
+ public void setConfigValue(String configValue)
+ {
+ this.configValue = configValue;
+ }
+
+ public String getConfigType()
+ {
+ return configType;
+ }
+
+ public void setConfigType(String configType)
+ {
+ this.configType = configType;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("configId", getConfigId())
+ .append("configName", getConfigName())
+ .append("configKey", getConfigKey())
+ .append("configValue", getConfigValue())
+ .append("configType", getConfigType())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
new file mode 100644
index 0000000..29b3af1
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java
@@ -0,0 +1,159 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.util.Date;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 系统访问记录表 sys_logininfor
+ *
+ * @author ruoyi
+ */
+public class SysLogininfor extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** ID */
+ @Excel(name = "序号", cellType = ColumnType.NUMERIC)
+ private Long infoId;
+
+ /** 用户账号 */
+ @Excel(name = "用户账号")
+ private String loginName;
+
+ /** 登录状态 0成功 1失败 */
+ @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败")
+ private String status;
+
+ /** 登录IP地址 */
+ @Excel(name = "登录地址")
+ private String ipaddr;
+
+ /** 登录地点 */
+ @Excel(name = "登录地点")
+ private String loginLocation;
+
+ /** 浏览器类型 */
+ @Excel(name = "浏览器")
+ private String browser;
+
+ /** 操作系统 */
+ @Excel(name = "操作系统")
+ private String os;
+
+ /** 提示消息 */
+ @Excel(name = "提示消息")
+ private String msg;
+
+ /** 访问时间 */
+ @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date loginTime;
+
+ public Long getInfoId()
+ {
+ return infoId;
+ }
+
+ public void setInfoId(Long infoId)
+ {
+ this.infoId = infoId;
+ }
+
+ public String getLoginName()
+ {
+ return loginName;
+ }
+
+ public void setLoginName(String loginName)
+ {
+ this.loginName = loginName;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public String getIpaddr()
+ {
+ return ipaddr;
+ }
+
+ public void setIpaddr(String ipaddr)
+ {
+ this.ipaddr = ipaddr;
+ }
+
+ public String getLoginLocation()
+ {
+ return loginLocation;
+ }
+
+ public void setLoginLocation(String loginLocation)
+ {
+ this.loginLocation = loginLocation;
+ }
+
+ public String getBrowser()
+ {
+ return browser;
+ }
+
+ public void setBrowser(String browser)
+ {
+ this.browser = browser;
+ }
+
+ public String getOs()
+ {
+ return os;
+ }
+
+ public void setOs(String os)
+ {
+ this.os = os;
+ }
+
+ public String getMsg()
+ {
+ return msg;
+ }
+
+ public void setMsg(String msg)
+ {
+ this.msg = msg;
+ }
+
+ public Date getLoginTime()
+ {
+ return loginTime;
+ }
+
+ public void setLoginTime(Date loginTime)
+ {
+ this.loginTime = loginTime;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("infoId", getInfoId())
+ .append("loginName", getLoginName())
+ .append("ipaddr", getIpaddr())
+ .append("loginLocation", getLoginLocation())
+ .append("browser", getBrowser())
+ .append("os", getOs())
+ .append("status", getStatus())
+ .append("msg", getMsg())
+ .append("loginTime", getLoginTime())
+ .toString();
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java
new file mode 100644
index 0000000..8c07a54
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java
@@ -0,0 +1,102 @@
+package com.ruoyi.system.domain;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.xss.Xss;
+
+/**
+ * 通知公告表 sys_notice
+ *
+ * @author ruoyi
+ */
+public class SysNotice extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 公告ID */
+ private Long noticeId;
+
+ /** 公告标题 */
+ private String noticeTitle;
+
+ /** 公告类型(1通知 2公告) */
+ private String noticeType;
+
+ /** 公告内容 */
+ private String noticeContent;
+
+ /** 公告状态(0正常 1关闭) */
+ private String status;
+
+ public Long getNoticeId()
+ {
+ return noticeId;
+ }
+
+ public void setNoticeId(Long noticeId)
+ {
+ this.noticeId = noticeId;
+ }
+
+ public void setNoticeTitle(String noticeTitle)
+ {
+ this.noticeTitle = noticeTitle;
+ }
+
+ @Xss(message = "公告标题不能包含脚本字符")
+ @NotBlank(message = "公告标题不能为空")
+ @Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
+ public String getNoticeTitle()
+ {
+ return noticeTitle;
+ }
+
+ public void setNoticeType(String noticeType)
+ {
+ this.noticeType = noticeType;
+ }
+
+ public String getNoticeType()
+ {
+ return noticeType;
+ }
+
+ public void setNoticeContent(String noticeContent)
+ {
+ this.noticeContent = noticeContent;
+ }
+
+ public String getNoticeContent()
+ {
+ return noticeContent;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("noticeId", getNoticeId())
+ .append("noticeTitle", getNoticeTitle())
+ .append("noticeType", getNoticeType())
+ .append("noticeContent", getNoticeContent())
+ .append("status", getStatus())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
new file mode 100644
index 0000000..56ddde7
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
@@ -0,0 +1,277 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.util.Date;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 操作日志记录表 oper_log
+ *
+ * @author ruoyi
+ */
+public class SysOperLog extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 日志主键 */
+ @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
+ private Long operId;
+
+ /** 操作模块 */
+ @Excel(name = "操作模块")
+ private String title;
+
+ /** 业务类型(0其它 1新增 2修改 3删除) */
+ @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
+ private Integer businessType;
+
+ /** 业务类型数组 */
+ private Integer[] businessTypes;
+
+ /** 请求方法 */
+ @Excel(name = "请求方法")
+ private String method;
+
+ /** 请求方式 */
+ @Excel(name = "请求方式")
+ private String requestMethod;
+
+ /** 操作类别(0其它 1后台用户 2手机端用户) */
+ @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
+ private Integer operatorType;
+
+ /** 操作人员 */
+ @Excel(name = "操作人员")
+ private String operName;
+
+ /** 部门名称 */
+ @Excel(name = "部门名称")
+ private String deptName;
+
+ /** 请求url */
+ @Excel(name = "请求地址")
+ private String operUrl;
+
+ /** 操作地址 */
+ @Excel(name = "操作地址")
+ private String operIp;
+
+ /** 操作地点 */
+ @Excel(name = "操作地点")
+ private String operLocation;
+
+ /** 请求参数 */
+ @Excel(name = "请求参数")
+ private String operParam;
+
+ /** 返回参数 */
+ @Excel(name = "返回参数")
+ private String jsonResult;
+
+ /** 操作状态(0正常 1异常) */
+ @Excel(name = "状态", readConverterExp = "0=正常,1=异常")
+ private Integer status;
+
+ /** 错误消息 */
+ @Excel(name = "错误消息")
+ private String errorMsg;
+
+ /** 操作时间 */
+ @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date operTime;
+
+ public Long getOperId()
+ {
+ return operId;
+ }
+
+ public void setOperId(Long operId)
+ {
+ this.operId = operId;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public Integer getBusinessType()
+ {
+ return businessType;
+ }
+
+ public void setBusinessType(Integer businessType)
+ {
+ this.businessType = businessType;
+ }
+
+ public Integer[] getBusinessTypes()
+ {
+ return businessTypes;
+ }
+
+ public void setBusinessTypes(Integer[] businessTypes)
+ {
+ this.businessTypes = businessTypes;
+ }
+
+ public String getMethod()
+ {
+ return method;
+ }
+
+ public void setMethod(String method)
+ {
+ this.method = method;
+ }
+
+ public String getRequestMethod()
+ {
+ return requestMethod;
+ }
+
+ public void setRequestMethod(String requestMethod)
+ {
+ this.requestMethod = requestMethod;
+ }
+
+ public Integer getOperatorType()
+ {
+ return operatorType;
+ }
+
+ public void setOperatorType(Integer operatorType)
+ {
+ this.operatorType = operatorType;
+ }
+
+ public String getOperName()
+ {
+ return operName;
+ }
+
+ public void setOperName(String operName)
+ {
+ this.operName = operName;
+ }
+
+ public String getDeptName()
+ {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName)
+ {
+ this.deptName = deptName;
+ }
+
+ public String getOperUrl()
+ {
+ return operUrl;
+ }
+
+ public void setOperUrl(String operUrl)
+ {
+ this.operUrl = operUrl;
+ }
+
+ public String getOperIp()
+ {
+ return operIp;
+ }
+
+ public void setOperIp(String operIp)
+ {
+ this.operIp = operIp;
+ }
+
+ public String getOperLocation()
+ {
+ return operLocation;
+ }
+
+ public void setOperLocation(String operLocation)
+ {
+ this.operLocation = operLocation;
+ }
+
+ public String getOperParam()
+ {
+ return operParam;
+ }
+
+ public void setOperParam(String operParam)
+ {
+ this.operParam = operParam;
+ }
+
+ public String getJsonResult()
+ {
+ return jsonResult;
+ }
+
+ public void setJsonResult(String jsonResult)
+ {
+ this.jsonResult = jsonResult;
+ }
+
+ public Integer getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(Integer status)
+ {
+ this.status = status;
+ }
+
+ public String getErrorMsg()
+ {
+ return errorMsg;
+ }
+
+ public void setErrorMsg(String errorMsg)
+ {
+ this.errorMsg = errorMsg;
+ }
+
+ public Date getOperTime()
+ {
+ return operTime;
+ }
+
+ public void setOperTime(Date operTime)
+ {
+ this.operTime = operTime;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("operId", getOperId())
+ .append("title", getTitle())
+ .append("businessType", getBusinessType())
+ .append("businessTypes", getBusinessTypes())
+ .append("method", getMethod())
+ .append("requestMethod", getRequestMethod())
+ .append("operatorType", getOperatorType())
+ .append("operName", getOperName())
+ .append("deptName", getDeptName())
+ .append("operUrl", getOperUrl())
+ .append("operIp", getOperIp())
+ .append("operLocation", getOperLocation())
+ .append("operParam", getOperParam())
+ .append("status", getStatus())
+ .append("errorMsg", getErrorMsg())
+ .append("operTime", getOperTime())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
new file mode 100644
index 0000000..a172f66
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java
@@ -0,0 +1,122 @@
+package com.ruoyi.system.domain;
+
+import javax.validation.constraints.*;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 岗位表 sys_post
+ *
+ * @author ruoyi
+ */
+public class SysPost extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 岗位序号 */
+ @Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
+ private Long postId;
+
+ /** 岗位编码 */
+ @Excel(name = "岗位编码")
+ private String postCode;
+
+ /** 岗位名称 */
+ @Excel(name = "岗位名称")
+ private String postName;
+
+ /** 岗位排序 */
+ @Excel(name = "岗位排序", cellType = ColumnType.NUMERIC)
+ private String postSort;
+
+ /** 状态(0正常 1停用) */
+ @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
+ private String status;
+
+ /** 用户是否存在此岗位标识 默认不存在 */
+ private boolean flag = false;
+
+ public Long getPostId()
+ {
+ return postId;
+ }
+
+ public void setPostId(Long postId)
+ {
+ this.postId = postId;
+ }
+
+ @NotBlank(message = "岗位编码不能为空")
+ @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
+ public String getPostCode()
+ {
+ return postCode;
+ }
+
+ public void setPostCode(String postCode)
+ {
+ this.postCode = postCode;
+ }
+
+ @NotBlank(message = "岗位名称不能为空")
+ @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
+ public String getPostName()
+ {
+ return postName;
+ }
+
+ public void setPostName(String postName)
+ {
+ this.postName = postName;
+ }
+
+ @NotBlank(message = "显示顺序不能为空")
+ public String getPostSort()
+ {
+ return postSort;
+ }
+
+ public void setPostSort(String postSort)
+ {
+ this.postSort = postSort;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(String status)
+ {
+ this.status = status;
+ }
+
+ public boolean isFlag()
+ {
+ return flag;
+ }
+
+ public void setFlag(boolean flag)
+ {
+ this.flag = flag;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("postId", getPostId())
+ .append("postCode", getPostCode())
+ .append("postName", getPostName())
+ .append("postSort", getPostSort())
+ .append("status", getStatus())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("remark", getRemark())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java
new file mode 100644
index 0000000..47b21bf
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java
@@ -0,0 +1,46 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 角色和部门关联 sys_role_dept
+ *
+ * @author ruoyi
+ */
+public class SysRoleDept
+{
+ /** 角色ID */
+ private Long roleId;
+
+ /** 部门ID */
+ private Long deptId;
+
+ public Long getRoleId()
+ {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId)
+ {
+ this.roleId = roleId;
+ }
+
+ public Long getDeptId()
+ {
+ return deptId;
+ }
+
+ public void setDeptId(Long deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("roleId", getRoleId())
+ .append("deptId", getDeptId())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java
new file mode 100644
index 0000000..de10a74
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java
@@ -0,0 +1,46 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 角色和菜单关联 sys_role_menu
+ *
+ * @author ruoyi
+ */
+public class SysRoleMenu
+{
+ /** 角色ID */
+ private Long roleId;
+
+ /** 菜单ID */
+ private Long menuId;
+
+ public Long getRoleId()
+ {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId)
+ {
+ this.roleId = roleId;
+ }
+
+ public Long getMenuId()
+ {
+ return menuId;
+ }
+
+ public void setMenuId(Long menuId)
+ {
+ this.menuId = menuId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("roleId", getRoleId())
+ .append("menuId", getMenuId())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java
new file mode 100644
index 0000000..e13506e
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java
@@ -0,0 +1,177 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.domain.BaseEntity;
+import com.ruoyi.common.enums.OnlineStatus;
+
+/**
+ * 当前在线会话 sys_user_online
+ *
+ * @author ruoyi
+ */
+public class SysUserOnline extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 用户会话id */
+ private String sessionId;
+
+ /** 部门名称 */
+ private String deptName;
+
+ /** 登录名称 */
+ private String loginName;
+
+ /** 登录IP地址 */
+ private String ipaddr;
+
+ /** 登录地址 */
+ private String loginLocation;
+
+ /** 浏览器类型 */
+ private String browser;
+
+ /** 操作系统 */
+ private String os;
+
+ /** session创建时间 */
+ private Date startTimestamp;
+
+ /** session最后访问时间 */
+ private Date lastAccessTime;
+
+ /** 超时时间,单位为分钟 */
+ private Long expireTime;
+
+ /** 在线状态 */
+ private OnlineStatus status = OnlineStatus.on_line;
+
+ public String getSessionId()
+ {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId)
+ {
+ this.sessionId = sessionId;
+ }
+
+ public String getDeptName()
+ {
+ return deptName;
+ }
+
+ public void setDeptName(String deptName)
+ {
+ this.deptName = deptName;
+ }
+
+ public String getLoginName()
+ {
+ return loginName;
+ }
+
+ public void setLoginName(String loginName)
+ {
+ this.loginName = loginName;
+ }
+
+ public String getIpaddr()
+ {
+ return ipaddr;
+ }
+
+ public void setIpaddr(String ipaddr)
+ {
+ this.ipaddr = ipaddr;
+ }
+
+ public String getLoginLocation()
+ {
+ return loginLocation;
+ }
+
+ public void setLoginLocation(String loginLocation)
+ {
+ this.loginLocation = loginLocation;
+ }
+
+ public String getBrowser()
+ {
+ return browser;
+ }
+
+ public void setBrowser(String browser)
+ {
+ this.browser = browser;
+ }
+
+ public String getOs()
+ {
+ return os;
+ }
+
+ public void setOs(String os)
+ {
+ this.os = os;
+ }
+
+ public Date getStartTimestamp()
+ {
+ return startTimestamp;
+ }
+
+ public void setStartTimestamp(Date startTimestamp)
+ {
+ this.startTimestamp = startTimestamp;
+ }
+
+ public Date getLastAccessTime()
+ {
+ return lastAccessTime;
+ }
+
+ public void setLastAccessTime(Date lastAccessTime)
+ {
+ this.lastAccessTime = lastAccessTime;
+ }
+
+ public Long getExpireTime()
+ {
+ return expireTime;
+ }
+
+ public void setExpireTime(Long expireTime)
+ {
+ this.expireTime = expireTime;
+ }
+
+ public OnlineStatus getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus(OnlineStatus status)
+ {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("sessionId", getSessionId())
+ .append("loginName", getLoginName())
+ .append("deptName", getDeptName())
+ .append("ipaddr", getIpaddr())
+ .append("loginLocation", getLoginLocation())
+ .append("browser", getBrowser())
+ .append("os", getOs())
+ .append("status", getStatus())
+ .append("startTimestamp", getStartTimestamp())
+ .append("lastAccessTime", getLastAccessTime())
+ .append("expireTime", getExpireTime())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java
new file mode 100644
index 0000000..6e8c416
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java
@@ -0,0 +1,46 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 用户和岗位关联 sys_user_post
+ *
+ * @author ruoyi
+ */
+public class SysUserPost
+{
+ /** 用户ID */
+ private Long userId;
+
+ /** 岗位ID */
+ private Long postId;
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getPostId()
+ {
+ return postId;
+ }
+
+ public void setPostId(Long postId)
+ {
+ this.postId = postId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("userId", getUserId())
+ .append("postId", getPostId())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java
new file mode 100644
index 0000000..4d15810
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java
@@ -0,0 +1,46 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 用户和角色关联 sys_user_role
+ *
+ * @author ruoyi
+ */
+public class SysUserRole
+{
+ /** 用户ID */
+ private Long userId;
+
+ /** 角色ID */
+ private Long roleId;
+
+ public Long getUserId()
+ {
+ return userId;
+ }
+
+ public void setUserId(Long userId)
+ {
+ this.userId = userId;
+ }
+
+ public Long getRoleId()
+ {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId)
+ {
+ this.roleId = roleId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("userId", getUserId())
+ .append("roleId", getRoleId())
+ .toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SSMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SSMapper.java
new file mode 100644
index 0000000..83c9130
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SSMapper.java
@@ -0,0 +1,22 @@
+package com.ruoyi.system.mapper;
+
+import java.math.BigDecimal;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+
+/**
+ * 用户表 数据层
+ *
+ * @author ruoyi
+ */
+@DataSource(value = DataSourceType.SLAVE)
+public interface SSMapper
+{
+ public List> selectDetail(String sql);
+
+ public BigDecimal selectSum(String sql);
+
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
new file mode 100644
index 0000000..63f806d
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java
@@ -0,0 +1,68 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysConfig;
+
+/**
+ * 参数配置 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysConfigMapper
+{
+ /**
+ * 查询参数配置信息
+ *
+ * @param config 参数配置信息
+ * @return 参数配置信息
+ */
+ public SysConfig selectConfig(SysConfig config);
+
+ /**
+ * 查询参数配置列表
+ *
+ * @param config 参数配置信息
+ * @return 参数配置集合
+ */
+ public List selectConfigList(SysConfig config);
+
+ /**
+ * 根据键名查询参数配置信息
+ *
+ * @param configKey 参数键名
+ * @return 参数配置信息
+ */
+ public SysConfig checkConfigKeyUnique(String configKey);
+
+ /**
+ * 新增参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ public int insertConfig(SysConfig config);
+
+ /**
+ * 修改参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ public int updateConfig(SysConfig config);
+
+ /**
+ * 删除参数配置
+ *
+ * @param configId 参数主键
+ * @return 结果
+ */
+ public int deleteConfigById(Long configId);
+
+ /**
+ * 批量删除参数配置
+ *
+ * @param configIds 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteConfigByIds(String[] configIds);
+}
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
new file mode 100644
index 0000000..c5690fd
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java
@@ -0,0 +1,117 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import com.ruoyi.common.core.domain.entity.SysDept;
+
+/**
+ * 部门管理 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysDeptMapper
+{
+ /**
+ * 查询部门人数
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public int selectDeptCount(SysDept dept);
+
+ /**
+ * 查询部门是否存在用户
+ *
+ * @param deptId 部门ID
+ * @return 结果
+ */
+ public int checkDeptExistUser(Long deptId);
+
+ /**
+ * 查询部门管理数据
+ *
+ * @param dept 部门信息
+ * @return 部门信息集合
+ */
+ public List selectDeptList(SysDept dept);
+
+ /**
+ * 删除部门管理信息
+ *
+ * @param deptId 部门ID
+ * @return 结果
+ */
+ public int deleteDeptById(Long deptId);
+
+ /**
+ * 新增部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public int insertDept(SysDept dept);
+
+ /**
+ * 修改部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public int updateDept(SysDept dept);
+
+ /**
+ * 修改子元素关系
+ *
+ * @param depts 子元素
+ * @return 结果
+ */
+ public int updateDeptChildren(@Param("depts") List depts);
+
+ /**
+ * 根据部门ID查询信息
+ *
+ * @param deptId 部门ID
+ * @return 部门信息
+ */
+ public SysDept selectDeptById(Long deptId);
+
+ /**
+ * 校验部门名称是否唯一
+ *
+ * @param deptName 部门名称
+ * @param parentId 父部门ID
+ * @return 结果
+ */
+ public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
+
+ /**
+ * 根据角色ID查询部门
+ *
+ * @param roleId 角色ID
+ * @return 部门列表
+ */
+ public List selectRoleDeptTree(Long roleId);
+
+ /**
+ * 修改所在部门正常状态
+ *
+ * @param deptIds 部门ID组
+ */
+ public void updateDeptStatusNormal(Long[] deptIds);
+
+ /**
+ * 根据ID查询所有子部门
+ *
+ * @param deptId 部门ID
+ * @return 部门列表
+ */
+ public List selectChildrenDeptById(Long deptId);
+
+ /**
+ * 根据ID查询所有子部门(正常状态)
+ *
+ * @param deptId 部门ID
+ * @return 子部门数
+ */
+ public int selectNormalChildrenDeptById(Long deptId);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
new file mode 100644
index 0000000..368252a
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java
@@ -0,0 +1,95 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+
+/**
+ * 字典表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysDictDataMapper
+{
+ /**
+ * 根据条件分页查询字典数据
+ *
+ * @param dictData 字典数据信息
+ * @return 字典数据集合信息
+ */
+ public List selectDictDataList(SysDictData dictData);
+
+ /**
+ * 根据字典类型查询字典数据
+ *
+ * @param dictType 字典类型
+ * @return 字典数据集合信息
+ */
+ public List selectDictDataByType(String dictType);
+
+ /**
+ * 根据字典类型和字典键值查询字典数据信息
+ *
+ * @param dictType 字典类型
+ * @param dictValue 字典键值
+ * @return 字典标签
+ */
+ public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
+
+ /**
+ * 根据字典数据ID查询信息
+ *
+ * @param dictCode 字典数据ID
+ * @return 字典数据
+ */
+ public SysDictData selectDictDataById(Long dictCode);
+
+ /**
+ * 查询字典数据
+ *
+ * @param dictType 字典类型
+ * @return 字典数据
+ */
+ public int countDictDataByType(String dictType);
+
+ /**
+ * 通过字典ID删除字典数据信息
+ *
+ * @param dictCode 字典数据ID
+ * @return 结果
+ */
+ public int deleteDictDataById(Long dictCode);
+
+ /**
+ * 批量删除字典数据
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public int deleteDictDataByIds(String[] ids);
+
+ /**
+ * 新增字典数据信息
+ *
+ * @param dictData 字典数据信息
+ * @return 结果
+ */
+ public int insertDictData(SysDictData dictData);
+
+ /**
+ * 修改字典数据信息
+ *
+ * @param dictData 字典数据信息
+ * @return 结果
+ */
+ public int updateDictData(SysDictData dictData);
+
+ /**
+ * 同步修改字典类型
+ *
+ * @param oldDictType 旧字典类型
+ * @param newDictType 新旧字典类型
+ * @return 结果
+ */
+ public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
new file mode 100644
index 0000000..25be4f4
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
@@ -0,0 +1,83 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysDictType;
+
+/**
+ * 字典表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysDictTypeMapper
+{
+ /**
+ * 根据条件分页查询字典类型
+ *
+ * @param dictType 字典类型信息
+ * @return 字典类型集合信息
+ */
+ public List selectDictTypeList(SysDictType dictType);
+
+ /**
+ * 根据所有字典类型
+ *
+ * @return 字典类型集合信息
+ */
+ public List selectDictTypeAll();
+
+ /**
+ * 根据字典类型ID查询信息
+ *
+ * @param dictId 字典类型ID
+ * @return 字典类型
+ */
+ public SysDictType selectDictTypeById(Long dictId);
+
+ /**
+ * 根据字典类型查询信息
+ *
+ * @param dictType 字典类型
+ * @return 字典类型
+ */
+ public SysDictType selectDictTypeByType(String dictType);
+
+ /**
+ * 通过字典ID删除字典信息
+ *
+ * @param dictId 字典ID
+ * @return 结果
+ */
+ public int deleteDictTypeById(Long dictId);
+
+ /**
+ * 批量删除字典类型
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public int deleteDictTypeByIds(Long[] ids);
+
+ /**
+ * 新增字典类型信息
+ *
+ * @param dictType 字典类型信息
+ * @return 结果
+ */
+ public int insertDictType(SysDictType dictType);
+
+ /**
+ * 修改字典类型信息
+ *
+ * @param dictType 字典类型信息
+ * @return 结果
+ */
+ public int updateDictType(SysDictType dictType);
+
+ /**
+ * 校验字典类型称是否唯一
+ *
+ * @param dictType 字典类型
+ * @return 结果
+ */
+ public SysDictType checkDictTypeUnique(String dictType);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
new file mode 100644
index 0000000..7ee47dc
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java
@@ -0,0 +1,42 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysLogininfor;
+
+/**
+ * 系统访问日志情况信息 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysLogininforMapper
+{
+ /**
+ * 新增系统登录日志
+ *
+ * @param logininfor 访问日志对象
+ */
+ public void insertLogininfor(SysLogininfor logininfor);
+
+ /**
+ * 查询系统登录日志集合
+ *
+ * @param logininfor 访问日志对象
+ * @return 登录记录集合
+ */
+ public List selectLogininforList(SysLogininfor logininfor);
+
+ /**
+ * 批量删除系统登录日志
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public int deleteLogininforByIds(String[] ids);
+
+ /**
+ * 清空系统登录日志
+ *
+ * @return 结果
+ */
+ public int cleanLogininfor();
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
new file mode 100644
index 0000000..62361f7
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java
@@ -0,0 +1,124 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import com.ruoyi.common.core.domain.entity.SysMenu;
+
+/**
+ * 菜单表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysMenuMapper
+{
+ /**
+ * 查询系统所有菜单(含按钮)
+ *
+ * @return 菜单列表
+ */
+ public List selectMenuAll();
+
+ /**
+ * 根据用户ID查询菜单
+ *
+ * @param userId 用户ID
+ * @return 菜单列表
+ */
+ public List selectMenuAllByUserId(Long userId);
+
+ /**
+ * 查询系统正常显示菜单(不含按钮)
+ *
+ * @return 菜单列表
+ */
+ public List selectMenuNormalAll();
+
+ /**
+ * 根据用户ID查询菜单
+ *
+ * @param userId 用户ID
+ * @return 菜单列表
+ */
+ public List selectMenusByUserId(Long userId);
+
+ /**
+ * 根据用户ID查询权限
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ public List selectPermsByUserId(Long userId);
+
+ /**
+ * 根据角色ID查询菜单
+ *
+ * @param roleId 角色ID
+ * @return 菜单列表
+ */
+ public List selectMenuTree(Long roleId);
+
+ /**
+ * 查询系统菜单列表
+ *
+ * @param menu 菜单信息
+ * @return 菜单列表
+ */
+ public List selectMenuList(SysMenu menu);
+
+ /**
+ * 查询系统菜单列表
+ *
+ * @param menu 菜单信息
+ * @return 菜单列表
+ */
+ public List selectMenuListByUserId(SysMenu menu);
+
+ /**
+ * 删除菜单管理信息
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ public int deleteMenuById(Long menuId);
+
+ /**
+ * 根据菜单ID查询信息
+ *
+ * @param menuId 菜单ID
+ * @return 菜单信息
+ */
+ public SysMenu selectMenuById(Long menuId);
+
+ /**
+ * 查询菜单数量
+ *
+ * @param parentId 菜单父ID
+ * @return 结果
+ */
+ public int selectCountMenuByParentId(Long parentId);
+
+ /**
+ * 新增菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ public int insertMenu(SysMenu menu);
+
+ /**
+ * 修改菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ public int updateMenu(SysMenu menu);
+
+ /**
+ * 校验菜单名称是否唯一
+ *
+ * @param menuName 菜单名称
+ * @param parentId 父菜单ID
+ * @return 结果
+ */
+ public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java
new file mode 100644
index 0000000..dd402e2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java
@@ -0,0 +1,52 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysNotice;
+
+/**
+ * 公告 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysNoticeMapper
+{
+ /**
+ * 查询公告信息
+ *
+ * @param noticeId 公告ID
+ * @return 公告信息
+ */
+ public SysNotice selectNoticeById(Long noticeId);
+
+ /**
+ * 查询公告列表
+ *
+ * @param notice 公告信息
+ * @return 公告集合
+ */
+ public List selectNoticeList(SysNotice notice);
+
+ /**
+ * 新增公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ public int insertNotice(SysNotice notice);
+
+ /**
+ * 修改公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ public int updateNotice(SysNotice notice);
+
+ /**
+ * 批量删除公告
+ *
+ * @param noticeIds 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteNoticeByIds(String[] noticeIds);
+}
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java
new file mode 100644
index 0000000..b40bd29
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java
@@ -0,0 +1,48 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysOperLog;
+
+/**
+ * 操作日志 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysOperLogMapper
+{
+ /**
+ * 新增操作日志
+ *
+ * @param operLog 操作日志对象
+ */
+ public void insertOperlog(SysOperLog operLog);
+
+ /**
+ * 查询系统操作日志集合
+ *
+ * @param operLog 操作日志对象
+ * @return 操作日志集合
+ */
+ public List selectOperLogList(SysOperLog operLog);
+
+ /**
+ * 批量删除系统操作日志
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public int deleteOperLogByIds(String[] ids);
+
+ /**
+ * 查询操作日志详细
+ *
+ * @param operId 操作ID
+ * @return 操作日志对象
+ */
+ public SysOperLog selectOperLogById(Long operId);
+
+ /**
+ * 清空操作日志
+ */
+ public void cleanOperLog();
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java
new file mode 100644
index 0000000..188f335
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java
@@ -0,0 +1,83 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysPost;
+
+/**
+ * 岗位信息 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysPostMapper
+{
+ /**
+ * 查询岗位数据集合
+ *
+ * @param post 岗位信息
+ * @return 岗位数据集合
+ */
+ public List selectPostList(SysPost post);
+
+ /**
+ * 查询所有岗位
+ *
+ * @return 岗位列表
+ */
+ public List selectPostAll();
+
+ /**
+ * 根据用户ID查询岗位
+ *
+ * @param userId 用户ID
+ * @return 岗位列表
+ */
+ public List selectPostsByUserId(Long userId);
+
+ /**
+ * 通过岗位ID查询岗位信息
+ *
+ * @param postId 岗位ID
+ * @return 角色对象信息
+ */
+ public SysPost selectPostById(Long postId);
+
+ /**
+ * 批量删除岗位信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deletePostByIds(Long[] ids);
+
+ /**
+ * 修改岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public int updatePost(SysPost post);
+
+ /**
+ * 新增岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public int insertPost(SysPost post);
+
+ /**
+ * 校验岗位名称
+ *
+ * @param postName 岗位名称
+ * @return 结果
+ */
+ public SysPost checkPostNameUnique(String postName);
+
+ /**
+ * 校验岗位编码
+ *
+ * @param postCode 岗位编码
+ * @return 结果
+ */
+ public SysPost checkPostCodeUnique(String postCode);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java
new file mode 100644
index 0000000..f9d3a2f
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java
@@ -0,0 +1,44 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysRoleDept;
+
+/**
+ * 角色与部门关联表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysRoleDeptMapper
+{
+ /**
+ * 通过角色ID删除角色和部门关联
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public int deleteRoleDeptByRoleId(Long roleId);
+
+ /**
+ * 批量删除角色部门关联信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteRoleDept(Long[] ids);
+
+ /**
+ * 查询部门使用数量
+ *
+ * @param deptId 部门ID
+ * @return 结果
+ */
+ public int selectCountRoleDeptByDeptId(Long deptId);
+
+ /**
+ * 批量新增角色部门信息
+ *
+ * @param roleDeptList 角色部门列表
+ * @return 结果
+ */
+ public int batchRoleDept(List roleDeptList);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
new file mode 100644
index 0000000..78a3ec7
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java
@@ -0,0 +1,84 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysRole;
+
+/**
+ * 角色表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysRoleMapper
+{
+ /**
+ * 根据条件分页查询角色数据
+ *
+ * @param role 角色信息
+ * @return 角色数据集合信息
+ */
+ public List selectRoleList(SysRole role);
+
+ /**
+ * 根据用户ID查询角色
+ *
+ * @param userId 用户ID
+ * @return 角色列表
+ */
+ public List selectRolesByUserId(Long userId);
+
+ /**
+ * 通过角色ID查询角色
+ *
+ * @param roleId 角色ID
+ * @return 角色对象信息
+ */
+ public SysRole selectRoleById(Long roleId);
+
+ /**
+ * 通过角色ID删除角色
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public int deleteRoleById(Long roleId);
+
+ /**
+ * 批量角色用户信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteRoleByIds(Long[] ids);
+
+ /**
+ * 修改角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int updateRole(SysRole role);
+
+ /**
+ * 新增角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int insertRole(SysRole role);
+
+ /**
+ * 校验角色名称是否唯一
+ *
+ * @param roleName 角色名称
+ * @return 角色信息
+ */
+ public SysRole checkRoleNameUnique(String roleName);
+
+ /**
+ * 校验角色权限是否唯一
+ *
+ * @param roleKey 角色权限
+ * @return 角色信息
+ */
+ public SysRole checkRoleKeyUnique(String roleKey);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java
new file mode 100644
index 0000000..9b88796
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java
@@ -0,0 +1,44 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysRoleMenu;
+
+/**
+ * 角色与菜单关联表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysRoleMenuMapper
+{
+ /**
+ * 通过角色ID删除角色和菜单关联
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public int deleteRoleMenuByRoleId(Long roleId);
+
+ /**
+ * 批量删除角色菜单关联信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteRoleMenu(Long[] ids);
+
+ /**
+ * 查询菜单使用数量
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ public int selectCountRoleMenuByMenuId(Long menuId);
+
+ /**
+ * 批量新增角色菜单信息
+ *
+ * @param roleMenuList 角色菜单列表
+ * @return 结果
+ */
+ public int batchRoleMenu(List roleMenuList);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
new file mode 100644
index 0000000..6f96934
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -0,0 +1,124 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysUser;
+
+/**
+ * 用户表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysUserMapper
+{
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param sysUser 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUserList(SysUser sysUser);
+
+ /**
+ * 根据条件分页查询未已配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectAllocatedList(SysUser user);
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUnallocatedList(SysUser user);
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByLoginName(String userName);
+
+ /**
+ * 通过手机号码查询用户
+ *
+ * @param phoneNumber 手机号码
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByPhoneNumber(String phoneNumber);
+
+ /**
+ * 通过邮箱查询用户
+ *
+ * @param email 邮箱
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByEmail(String email);
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ public SysUser selectUserById(Long userId);
+
+ /**
+ * 通过用户ID删除用户
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public int deleteUserById(Long userId);
+
+ /**
+ * 批量删除用户信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteUserByIds(Long[] ids);
+
+ /**
+ * 修改用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUser(SysUser user);
+
+ /**
+ * 新增用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int insertUser(SysUser user);
+
+ /**
+ * 校验用户名称是否唯一
+ *
+ * @param loginName 登录名称
+ * @return 结果
+ */
+ public int checkLoginNameUnique(String loginName);
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param phonenumber 手机号码
+ * @return 结果
+ */
+ public SysUser checkPhoneUnique(String phonenumber);
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param email 用户邮箱
+ * @return 结果
+ */
+ public SysUser checkEmailUnique(String email);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java
new file mode 100644
index 0000000..5bd68ed
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java
@@ -0,0 +1,52 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysUserOnline;
+
+/**
+ * 在线用户 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysUserOnlineMapper
+{
+ /**
+ * 通过会话序号查询信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ public SysUserOnline selectOnlineById(String sessionId);
+
+ /**
+ * 通过会话序号删除信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ public int deleteOnlineById(String sessionId);
+
+ /**
+ * 保存会话信息
+ *
+ * @param online 会话信息
+ * @return 结果
+ */
+ public int saveOnline(SysUserOnline online);
+
+ /**
+ * 查询会话集合
+ *
+ * @param userOnline 会话参数
+ * @return 会话集合
+ */
+ public List selectUserOnlineList(SysUserOnline userOnline);
+
+ /**
+ * 查询过期会话集合
+ *
+ * @param lastAccessTime 过期时间
+ * @return 会话集合
+ */
+ public List selectOnlineByExpired(String lastAccessTime);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
new file mode 100644
index 0000000..d72ac45
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
@@ -0,0 +1,44 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysUserPost;
+
+/**
+ * 用户与岗位关联表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysUserPostMapper
+{
+ /**
+ * 通过用户ID删除用户和岗位关联
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public int deleteUserPostByUserId(Long userId);
+
+ /**
+ * 通过岗位ID查询岗位使用数量
+ *
+ * @param postId 岗位ID
+ * @return 结果
+ */
+ public int countUserPostById(Long postId);
+
+ /**
+ * 批量删除用户和岗位关联
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteUserPost(Long[] ids);
+
+ /**
+ * 批量新增用户岗位信息
+ *
+ * @param userPostList 用户角色列表
+ * @return 结果
+ */
+ public int batchUserPost(List userPostList);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
new file mode 100644
index 0000000..669d1ec
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
@@ -0,0 +1,70 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+import com.ruoyi.system.domain.SysUserRole;
+
+/**
+ * 用户与角色关联表 数据层
+ *
+ * @author ruoyi
+ */
+public interface SysUserRoleMapper
+{
+ /**
+ * 通过用户ID查询用户和角色关联
+ *
+ * @param userId 用户ID
+ * @return 用户和角色关联列表
+ */
+ public List selectUserRoleByUserId(Long userId);
+
+ /**
+ * 通过用户ID删除用户和角色关联
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public int deleteUserRoleByUserId(Long userId);
+
+ /**
+ * 批量删除用户和角色关联
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteUserRole(Long[] ids);
+
+ /**
+ * 通过角色ID查询角色使用数量
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public int countUserRoleByRoleId(Long roleId);
+
+ /**
+ * 批量新增用户角色信息
+ *
+ * @param userRoleList 用户角色列表
+ * @return 结果
+ */
+ public int batchUserRole(List userRoleList);
+
+ /**
+ * 删除用户和角色关联信息
+ *
+ * @param userRole 用户和角色关联信息
+ * @return 结果
+ */
+ public int deleteUserRoleInfo(SysUserRole userRole);
+
+ /**
+ * 批量取消授权用户角色
+ *
+ * @param roleId 角色ID
+ * @param userIds 需要删除的用户数据ID
+ * @return 结果
+ */
+ public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
new file mode 100644
index 0000000..cab4d23
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java
@@ -0,0 +1,83 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysConfig;
+
+/**
+ * 参数配置 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysConfigService
+{
+ /**
+ * 查询参数配置信息
+ *
+ * @param configId 参数配置ID
+ * @return 参数配置信息
+ */
+ public SysConfig selectConfigById(Long configId);
+
+ /**
+ * 根据键名查询参数配置信息
+ *
+ * @param configKey 参数键名
+ * @return 参数键值
+ */
+ public String selectConfigByKey(String configKey);
+
+ /**
+ * 查询参数配置列表
+ *
+ * @param config 参数配置信息
+ * @return 参数配置集合
+ */
+ public List selectConfigList(SysConfig config);
+
+ /**
+ * 新增参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ public int insertConfig(SysConfig config);
+
+ /**
+ * 修改参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ public int updateConfig(SysConfig config);
+
+ /**
+ * 批量删除参数配置信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public void deleteConfigByIds(String ids);
+
+ /**
+ * 加载参数缓存数据
+ */
+ public void loadingConfigCache();
+
+ /**
+ * 清空参数缓存数据
+ */
+ public void clearConfigCache();
+
+ /**
+ * 重置参数缓存数据
+ */
+ public void resetConfigCache();
+
+ /**
+ * 校验参数键名是否唯一
+ *
+ * @param config 参数信息
+ * @return 结果
+ */
+ public String checkConfigKeyUnique(SysConfig config);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
new file mode 100644
index 0000000..19a5fca
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java
@@ -0,0 +1,117 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysRole;
+
+/**
+ * 部门管理 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysDeptService
+{
+ /**
+ * 查询部门管理数据
+ *
+ * @param dept 部门信息
+ * @return 部门信息集合
+ */
+ public List selectDeptList(SysDept dept);
+
+ /**
+ * 查询部门管理树
+ *
+ * @param dept 部门信息
+ * @return 所有部门信息
+ */
+ public List selectDeptTree(SysDept dept);
+
+ /**
+ * 查询部门管理树(排除下级)
+ *
+ * @param dept 部门信息
+ * @return 所有部门信息
+ */
+ public List selectDeptTreeExcludeChild(SysDept dept);
+
+ /**
+ * 根据角色ID查询菜单
+ *
+ * @param role 角色对象
+ * @return 菜单列表
+ */
+ public List roleDeptTreeData(SysRole role);
+
+ /**
+ * 查询部门人数
+ *
+ * @param parentId 父部门ID
+ * @return 结果
+ */
+ public int selectDeptCount(Long parentId);
+
+ /**
+ * 查询部门是否存在用户
+ *
+ * @param deptId 部门ID
+ * @return 结果 true 存在 false 不存在
+ */
+ public boolean checkDeptExistUser(Long deptId);
+
+ /**
+ * 删除部门管理信息
+ *
+ * @param deptId 部门ID
+ * @return 结果
+ */
+ public int deleteDeptById(Long deptId);
+
+ /**
+ * 新增保存部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public int insertDept(SysDept dept);
+
+ /**
+ * 修改保存部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public int updateDept(SysDept dept);
+
+ /**
+ * 根据部门ID查询信息
+ *
+ * @param deptId 部门ID
+ * @return 部门信息
+ */
+ public SysDept selectDeptById(Long deptId);
+
+ /**
+ * 根据ID查询所有子部门(正常状态)
+ *
+ * @param deptId 部门ID
+ * @return 子部门数
+ */
+ public int selectNormalChildrenDeptById(Long deptId);
+
+ /**
+ * 校验部门名称是否唯一
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ public String checkDeptNameUnique(SysDept dept);
+
+ /**
+ * 校验部门是否有数据权限
+ *
+ * @param deptId 部门id
+ */
+ public void checkDeptDataScope(Long deptId);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java
new file mode 100644
index 0000000..eecabf6
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+
+/**
+ * 字典 业务层
+ *
+ * @author ruoyi
+ */
+public interface ISysDictDataService
+{
+ /**
+ * 根据条件分页查询字典数据
+ *
+ * @param dictData 字典数据信息
+ * @return 字典数据集合信息
+ */
+ public List selectDictDataList(SysDictData dictData);
+
+ /**
+ * 根据字典类型和字典键值查询字典数据信息
+ *
+ * @param dictType 字典类型
+ * @param dictValue 字典键值
+ * @return 字典标签
+ */
+ public String selectDictLabel(String dictType, String dictValue);
+
+ /**
+ * 根据字典数据ID查询信息
+ *
+ * @param dictCode 字典数据ID
+ * @return 字典数据
+ */
+ public SysDictData selectDictDataById(Long dictCode);
+
+ /**
+ * 批量删除字典数据
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public void deleteDictDataByIds(String ids);
+
+ /**
+ * 新增保存字典数据信息
+ *
+ * @param dictData 字典数据信息
+ * @return 结果
+ */
+ public int insertDictData(SysDictData dictData);
+
+ /**
+ * 修改保存字典数据信息
+ *
+ * @param dictData 字典数据信息
+ * @return 结果
+ */
+ public int updateDictData(SysDictData dictData);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
new file mode 100644
index 0000000..3307202
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
@@ -0,0 +1,109 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.domain.entity.SysDictType;
+
+/**
+ * 字典 业务层
+ *
+ * @author ruoyi
+ */
+public interface ISysDictTypeService
+{
+ /**
+ * 根据条件分页查询字典类型
+ *
+ * @param dictType 字典类型信息
+ * @return 字典类型集合信息
+ */
+ public List selectDictTypeList(SysDictType dictType);
+
+ /**
+ * 根据所有字典类型
+ *
+ * @return 字典类型集合信息
+ */
+ public List selectDictTypeAll();
+
+ /**
+ * 根据字典类型查询字典数据
+ *
+ * @param dictType 字典类型
+ * @return 字典数据集合信息
+ */
+ public List selectDictDataByType(String dictType);
+
+ /**
+ * 根据字典类型ID查询信息
+ *
+ * @param dictId 字典类型ID
+ * @return 字典类型
+ */
+ public SysDictType selectDictTypeById(Long dictId);
+
+ /**
+ * 根据字典类型查询信息
+ *
+ * @param dictType 字典类型
+ * @return 字典类型
+ */
+ public SysDictType selectDictTypeByType(String dictType);
+
+ /**
+ * 批量删除字典类型
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ * @throws Exception 异常
+ */
+ public void deleteDictTypeByIds(String ids);
+
+ /**
+ * 加载字典缓存数据
+ */
+ public void loadingDictCache();
+
+ /**
+ * 清空字典缓存数据
+ */
+ public void clearDictCache();
+
+ /**
+ * 重置字典缓存数据
+ */
+ public void resetDictCache();
+
+ /**
+ * 新增保存字典类型信息
+ *
+ * @param dictType 字典类型信息
+ * @return 结果
+ */
+ public int insertDictType(SysDictType dictType);
+
+ /**
+ * 修改保存字典类型信息
+ *
+ * @param dictType 字典类型信息
+ * @return 结果
+ */
+ public int updateDictType(SysDictType dictType);
+
+ /**
+ * 校验字典类型称是否唯一
+ *
+ * @param dictType 字典类型
+ * @return 结果
+ */
+ public String checkDictTypeUnique(SysDictType dictType);
+
+ /**
+ * 查询字典类型树
+ *
+ * @param dictType 字典类型
+ * @return 所有字典类型
+ */
+ public List selectDictTree(SysDictType dictType);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
new file mode 100644
index 0000000..159bb45
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java
@@ -0,0 +1,40 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysLogininfor;
+
+/**
+ * 系统访问日志情况信息 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysLogininforService
+{
+ /**
+ * 新增系统登录日志
+ *
+ * @param logininfor 访问日志对象
+ */
+ public void insertLogininfor(SysLogininfor logininfor);
+
+ /**
+ * 查询系统登录日志集合
+ *
+ * @param logininfor 访问日志对象
+ * @return 登录记录集合
+ */
+ public List selectLogininforList(SysLogininfor logininfor);
+
+ /**
+ * 批量删除系统登录日志
+ *
+ * @param ids 需要删除的数据
+ * @return
+ */
+ public int deleteLogininforByIds(String ids);
+
+ /**
+ * 清空系统登录日志
+ */
+ public void cleanLogininfor();
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java
new file mode 100644
index 0000000..237d06f
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java
@@ -0,0 +1,131 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysMenu;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+
+/**
+ * 菜单 业务层
+ *
+ * @author ruoyi
+ */
+public interface ISysMenuService
+{
+ /**
+ * 根据用户ID查询菜单
+ *
+ * @param user 用户信息
+ * @return 菜单列表
+ */
+ public List selectMenusByUser(SysUser user);
+
+ /**
+ * 查询系统菜单列表
+ *
+ * @param menu 菜单信息
+ * @param userId 用户ID
+ * @return 菜单列表
+ */
+ public List selectMenuList(SysMenu menu, Long userId);
+
+ /**
+ * 查询菜单集合
+ *
+ * @param userId 用户ID
+ * @return 所有菜单信息
+ */
+ public List selectMenuAll(Long userId);
+
+ /**
+ * 根据用户ID查询权限
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ public Set selectPermsByUserId(Long userId);
+
+ /**
+ * 根据角色ID查询菜单
+ *
+ * @param role 角色对象
+ * @param userId 用户ID
+ * @return 菜单列表
+ */
+ public List roleMenuTreeData(SysRole role, Long userId);
+
+ /**
+ * 查询所有菜单信息
+ *
+ * @param userId 用户ID
+ * @return 菜单列表
+ */
+ public List menuTreeData(Long userId);
+
+ /**
+ * 查询系统所有权限
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ public Map selectPermsAll(Long userId);
+
+ /**
+ * 删除菜单管理信息
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ public int deleteMenuById(Long menuId);
+
+ /**
+ * 根据菜单ID查询信息
+ *
+ * @param menuId 菜单ID
+ * @return 菜单信息
+ */
+ public SysMenu selectMenuById(Long menuId);
+
+ /**
+ * 查询菜单数量
+ *
+ * @param parentId 菜单父ID
+ * @return 结果
+ */
+ public int selectCountMenuByParentId(Long parentId);
+
+ /**
+ * 查询菜单使用数量
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ public int selectCountRoleMenuByMenuId(Long menuId);
+
+ /**
+ * 新增保存菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ public int insertMenu(SysMenu menu);
+
+ /**
+ * 修改保存菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ public int updateMenu(SysMenu menu);
+
+ /**
+ * 校验菜单名称是否唯一
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ public String checkMenuNameUnique(SysMenu menu);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java
new file mode 100644
index 0000000..6398b5a
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java
@@ -0,0 +1,52 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysNotice;
+
+/**
+ * 公告 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysNoticeService
+{
+ /**
+ * 查询公告信息
+ *
+ * @param noticeId 公告ID
+ * @return 公告信息
+ */
+ public SysNotice selectNoticeById(Long noticeId);
+
+ /**
+ * 查询公告列表
+ *
+ * @param notice 公告信息
+ * @return 公告集合
+ */
+ public List selectNoticeList(SysNotice notice);
+
+ /**
+ * 新增公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ public int insertNotice(SysNotice notice);
+
+ /**
+ * 修改公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ public int updateNotice(SysNotice notice);
+
+ /**
+ * 删除公告信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteNoticeByIds(String ids);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
new file mode 100644
index 0000000..3cdc5d2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java
@@ -0,0 +1,48 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysOperLog;
+
+/**
+ * 操作日志 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysOperLogService
+{
+ /**
+ * 新增操作日志
+ *
+ * @param operLog 操作日志对象
+ */
+ public void insertOperlog(SysOperLog operLog);
+
+ /**
+ * 查询系统操作日志集合
+ *
+ * @param operLog 操作日志对象
+ * @return 操作日志集合
+ */
+ public List selectOperLogList(SysOperLog operLog);
+
+ /**
+ * 批量删除系统操作日志
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ public int deleteOperLogByIds(String ids);
+
+ /**
+ * 查询操作日志详细
+ *
+ * @param operId 操作ID
+ * @return 操作日志对象
+ */
+ public SysOperLog selectOperLogById(Long operId);
+
+ /**
+ * 清空操作日志
+ */
+ public void cleanOperLog();
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
new file mode 100644
index 0000000..53013cb
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
@@ -0,0 +1,92 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.SysPost;
+
+/**
+ * 岗位信息 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysPostService
+{
+ /**
+ * 查询岗位信息集合
+ *
+ * @param post 岗位信息
+ * @return 岗位信息集合
+ */
+ public List selectPostList(SysPost post);
+
+ /**
+ * 查询所有岗位
+ *
+ * @return 岗位列表
+ */
+ public List selectPostAll();
+
+ /**
+ * 根据用户ID查询岗位
+ *
+ * @param userId 用户ID
+ * @return 岗位列表
+ */
+ public List selectPostsByUserId(Long userId);
+
+ /**
+ * 通过岗位ID查询岗位信息
+ *
+ * @param postId 岗位ID
+ * @return 角色对象信息
+ */
+ public SysPost selectPostById(Long postId);
+
+ /**
+ * 批量删除岗位信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ * @throws Exception 异常
+ */
+ public int deletePostByIds(String ids) throws Exception;
+
+ /**
+ * 新增保存岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public int insertPost(SysPost post);
+
+ /**
+ * 修改保存岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public int updatePost(SysPost post);
+
+ /**
+ * 通过岗位ID查询岗位使用数量
+ *
+ * @param postId 岗位ID
+ * @return 结果
+ */
+ public int countUserPostById(Long postId);
+
+ /**
+ * 校验岗位名称
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public String checkPostNameUnique(SysPost post);
+
+ /**
+ * 校验岗位编码
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ public String checkPostCodeUnique(SysPost post);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
new file mode 100644
index 0000000..d2fc3a7
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java
@@ -0,0 +1,166 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import java.util.Set;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.system.domain.SysUserRole;
+
+/**
+ * 角色业务层
+ *
+ * @author ruoyi
+ */
+public interface ISysRoleService
+{
+ /**
+ * 根据条件分页查询角色数据
+ *
+ * @param role 角色信息
+ * @return 角色数据集合信息
+ */
+ public List selectRoleList(SysRole role);
+
+ /**
+ * 根据用户ID查询角色列表
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ public Set selectRoleKeys(Long userId);
+
+ /**
+ * 根据用户ID查询角色权限
+ *
+ * @param userId 用户ID
+ * @return 角色列表
+ */
+ public List selectRolesByUserId(Long userId);
+
+ /**
+ * 查询所有角色
+ *
+ * @return 角色列表
+ */
+ public List selectRoleAll();
+
+ /**
+ * 通过角色ID查询角色
+ *
+ * @param roleId 角色ID
+ * @return 角色对象信息
+ */
+ public SysRole selectRoleById(Long roleId);
+
+ /**
+ * 通过角色ID删除角色
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public boolean deleteRoleById(Long roleId);
+
+ /**
+ * 批量删除角色用户信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ * @throws Exception 异常
+ */
+ public int deleteRoleByIds(String ids);
+
+ /**
+ * 新增保存角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int insertRole(SysRole role);
+
+ /**
+ * 修改保存角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int updateRole(SysRole role);
+
+ /**
+ * 修改数据权限信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int authDataScope(SysRole role);
+
+ /**
+ * 校验角色名称是否唯一
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public String checkRoleNameUnique(SysRole role);
+
+ /**
+ * 校验角色权限是否唯一
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public String checkRoleKeyUnique(SysRole role);
+
+ /**
+ * 校验角色是否允许操作
+ *
+ * @param role 角色信息
+ */
+ public void checkRoleAllowed(SysRole role);
+
+ /**
+ * 校验角色是否有数据权限
+ *
+ * @param roleId 角色id
+ */
+ public void checkRoleDataScope(Long roleId);
+
+ /**
+ * 通过角色ID查询角色使用数量
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ public int countUserRoleByRoleId(Long roleId);
+
+ /**
+ * 角色状态修改
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ public int changeStatus(SysRole role);
+
+ /**
+ * 取消授权用户角色
+ *
+ * @param userRole 用户和角色关联信息
+ * @return 结果
+ */
+ public int deleteAuthUser(SysUserRole userRole);
+
+ /**
+ * 批量取消授权用户角色
+ *
+ * @param roleId 角色ID
+ * @param userIds 需要删除的用户数据ID
+ * @return 结果
+ */
+ public int deleteAuthUsers(Long roleId, String userIds);
+
+ /**
+ * 批量选择授权用户角色
+ *
+ * @param roleId 角色ID
+ * @param userIds 需要删除的用户数据ID
+ * @return 结果
+ */
+ public int insertAuthUsers(Long roleId, String userIds);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java
new file mode 100644
index 0000000..50c99a1
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java
@@ -0,0 +1,75 @@
+package com.ruoyi.system.service;
+
+import java.util.Date;
+import java.util.List;
+import com.ruoyi.system.domain.SysUserOnline;
+
+/**
+ * 在线用户 服务层
+ *
+ * @author ruoyi
+ */
+public interface ISysUserOnlineService
+{
+ /**
+ * 通过会话序号查询信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ public SysUserOnline selectOnlineById(String sessionId);
+
+ /**
+ * 通过会话序号删除信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ public void deleteOnlineById(String sessionId);
+
+ /**
+ * 通过会话序号删除信息
+ *
+ * @param sessions 会话ID集合
+ * @return 在线用户信息
+ */
+ public void batchDeleteOnline(List sessions);
+
+ /**
+ * 保存会话信息
+ *
+ * @param online 会话信息
+ */
+ public void saveOnline(SysUserOnline online);
+
+ /**
+ * 查询会话集合
+ *
+ * @param userOnline 分页参数
+ * @return 会话集合
+ */
+ public List selectUserOnlineList(SysUserOnline userOnline);
+
+ /**
+ * 强退用户
+ *
+ * @param sessionId 会话ID
+ */
+ public void forceLogout(String sessionId);
+
+ /**
+ * 清理用户缓存
+ *
+ * @param loginName 登录名称
+ * @param sessionId 会话ID
+ */
+ public void removeUserCache(String loginName, String sessionId);
+
+ /**
+ * 查询会话集合
+ *
+ * @param expiredDate 有效期
+ * @return 会话集合
+ */
+ public List selectOnlineByExpired(Date expiredDate);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
new file mode 100644
index 0000000..7832165
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -0,0 +1,214 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.domain.SysUserRole;
+
+/**
+ * 用户 业务层
+ *
+ * @author ruoyi
+ */
+public interface ISysUserService
+{
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUserList(SysUser user);
+
+ /**
+ * 根据条件分页查询已分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectAllocatedList(SysUser user);
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ public List selectUnallocatedList(SysUser user);
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByLoginName(String userName);
+
+ /**
+ * 通过手机号码查询用户
+ *
+ * @param phoneNumber 手机号码
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByPhoneNumber(String phoneNumber);
+
+ /**
+ * 通过邮箱查询用户
+ *
+ * @param email 邮箱
+ * @return 用户对象信息
+ */
+ public SysUser selectUserByEmail(String email);
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ public SysUser selectUserById(Long userId);
+
+ /**
+ * 通过用户ID查询用户和角色关联
+ *
+ * @param userId 用户ID
+ * @return 用户和角色关联列表
+ */
+ public List selectUserRoleByUserId(Long userId);
+
+ /**
+ * 通过用户ID删除用户
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public int deleteUserById(Long userId);
+
+ /**
+ * 批量删除用户信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ * @throws Exception 异常
+ */
+ public int deleteUserByIds(String ids);
+
+ /**
+ * 保存用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int insertUser(SysUser user);
+
+ /**
+ * 注册用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public boolean registerUser(SysUser user);
+
+ /**
+ * 保存用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUser(SysUser user);
+
+ /**
+ * 修改用户详细信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int updateUserInfo(SysUser user);
+
+ /**
+ * 用户授权角色
+ *
+ * @param userId 用户ID
+ * @param roleIds 角色组
+ */
+ public void insertUserAuth(Long userId, Long[] roleIds);
+
+ /**
+ * 修改用户密码信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int resetUserPwd(SysUser user);
+
+ /**
+ * 校验用户名称是否唯一
+ *
+ * @param loginName 登录名称
+ * @return 结果
+ */
+ public String checkLoginNameUnique(String loginName);
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public String checkPhoneUnique(SysUser user);
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public String checkEmailUnique(SysUser user);
+
+ /**
+ * 校验用户是否允许操作
+ *
+ * @param user 用户信息
+ */
+ public void checkUserAllowed(SysUser user);
+
+ /**
+ * 校验用户是否有数据权限
+ *
+ * @param userId 用户id
+ */
+ public void checkUserDataScope(Long userId);
+
+ /**
+ * 根据用户ID查询用户所属角色组
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public String selectUserRoleGroup(Long userId);
+
+ /**
+ * 根据用户ID查询用户所属岗位组
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ public String selectUserPostGroup(Long userId);
+
+ /**
+ * 导入用户数据
+ *
+ * @param userList 用户数据列表
+ * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+ * @param operName 操作用户
+ * @return 结果
+ */
+ public String importUser(List userList, Boolean isUpdateSupport, String operName);
+
+ /**
+ * 用户状态修改
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ public int changeStatus(SysUser user);
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
new file mode 100644
index 0000000..73c4991
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java
@@ -0,0 +1,214 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import javax.annotation.PostConstruct;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.CacheUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.service.ISysConfigService;
+
+/**
+ * 参数配置 服务层实现
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysConfigServiceImpl implements ISysConfigService
+{
+ @Autowired
+ private SysConfigMapper configMapper;
+
+ /**
+ * 项目启动时,初始化参数到缓存
+ */
+ @PostConstruct
+ public void init()
+ {
+ loadingConfigCache();
+ }
+
+ /**
+ * 查询参数配置信息
+ *
+ * @param configId 参数配置ID
+ * @return 参数配置信息
+ */
+ @Override
+ public SysConfig selectConfigById(Long configId)
+ {
+ SysConfig config = new SysConfig();
+ config.setConfigId(configId);
+ return configMapper.selectConfig(config);
+ }
+
+ /**
+ * 根据键名查询参数配置信息
+ *
+ * @param configKey 参数key
+ * @return 参数键值
+ */
+ @Override
+ public String selectConfigByKey(String configKey)
+ {
+ String configValue = Convert.toStr(CacheUtils.get(getCacheName(), getCacheKey(configKey)));
+ if (StringUtils.isNotEmpty(configValue))
+ {
+ return configValue;
+ }
+ SysConfig config = new SysConfig();
+ config.setConfigKey(configKey);
+ SysConfig retConfig = configMapper.selectConfig(config);
+ if (StringUtils.isNotNull(retConfig))
+ {
+ CacheUtils.put(getCacheName(), getCacheKey(configKey), retConfig.getConfigValue());
+ return retConfig.getConfigValue();
+ }
+ return StringUtils.EMPTY;
+ }
+
+ /**
+ * 查询参数配置列表
+ *
+ * @param config 参数配置信息
+ * @return 参数配置集合
+ */
+ @Override
+ public List selectConfigList(SysConfig config)
+ {
+ return configMapper.selectConfigList(config);
+ }
+
+ /**
+ * 新增参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ @Override
+ public int insertConfig(SysConfig config)
+ {
+ int row = configMapper.insertConfig(config);
+ if (row > 0)
+ {
+ CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue());
+ }
+ return row;
+ }
+
+ /**
+ * 修改参数配置
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ @Override
+ public int updateConfig(SysConfig config)
+ {
+ int row = configMapper.updateConfig(config);
+ if (row > 0)
+ {
+ CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue());
+ }
+ return row;
+ }
+
+ /**
+ * 批量删除参数配置对象
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ @Override
+ public void deleteConfigByIds(String ids)
+ {
+ Long[] configIds = Convert.toLongArray(ids);
+ for (Long configId : configIds)
+ {
+ SysConfig config = selectConfigById(configId);
+ if (StringUtils.equals(UserConstants.YES, config.getConfigType()))
+ {
+ throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
+ }
+ configMapper.deleteConfigById(configId);
+ CacheUtils.remove(getCacheName(), getCacheKey(config.getConfigKey()));
+ }
+ }
+
+ /**
+ * 加载参数缓存数据
+ */
+ @Override
+ public void loadingConfigCache()
+ {
+ List configsList = configMapper.selectConfigList(new SysConfig());
+ for (SysConfig config : configsList)
+ {
+ CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue());
+ }
+ }
+
+ /**
+ * 清空参数缓存数据
+ */
+ @Override
+ public void clearConfigCache()
+ {
+ CacheUtils.removeAll(getCacheName());
+ }
+
+ /**
+ * 重置参数缓存数据
+ */
+ @Override
+ public void resetConfigCache()
+ {
+ clearConfigCache();
+ loadingConfigCache();
+ }
+
+ /**
+ * 校验参数键名是否唯一
+ *
+ * @param config 参数配置信息
+ * @return 结果
+ */
+ @Override
+ public String checkConfigKeyUnique(SysConfig config)
+ {
+ Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
+ SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
+ if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
+ {
+ return UserConstants.CONFIG_KEY_NOT_UNIQUE;
+ }
+ return UserConstants.CONFIG_KEY_UNIQUE;
+ }
+
+ /**
+ * 获取cache name
+ *
+ * @return 缓存名
+ */
+ private String getCacheName()
+ {
+ return Constants.SYS_CONFIG_CACHE;
+ }
+
+ /**
+ * 设置cache key
+ *
+ * @param configKey 参数键
+ * @return 缓存键key
+ */
+ private String getCacheKey(String configKey)
+ {
+ return Constants.SYS_CONFIG_KEY + configKey;
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
new file mode 100644
index 0000000..b8c7802
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
@@ -0,0 +1,335 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.ShiroUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.system.mapper.SysDeptMapper;
+import com.ruoyi.system.service.ISysDeptService;
+
+/**
+ * 部门管理 服务实现
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysDeptServiceImpl implements ISysDeptService
+{
+ @Autowired
+ private SysDeptMapper deptMapper;
+
+ /**
+ * 查询部门管理数据
+ *
+ * @param dept 部门信息
+ * @return 部门信息集合
+ */
+ @Override
+ @DataScope(deptAlias = "d")
+ public List selectDeptList(SysDept dept)
+ {
+ return deptMapper.selectDeptList(dept);
+ }
+
+ /**
+ * 查询部门管理树
+ *
+ * @param dept 部门信息
+ * @return 所有部门信息
+ */
+ @Override
+ @DataScope(deptAlias = "d")
+ public List selectDeptTree(SysDept dept)
+ {
+ List deptList = deptMapper.selectDeptList(dept);
+ List ztrees = initZtree(deptList);
+ return ztrees;
+ }
+
+ /**
+ * 查询部门管理树(排除下级)
+ *
+ * @param deptId 部门ID
+ * @return 所有部门信息
+ */
+ @Override
+ @DataScope(deptAlias = "d")
+ public List selectDeptTreeExcludeChild(SysDept dept)
+ {
+ Long excludeId = dept.getExcludeId();
+ List deptList = deptMapper.selectDeptList(dept);
+ Iterator it = deptList.iterator();
+ while (it.hasNext())
+ {
+ SysDept d = (SysDept) it.next();
+ if (d.getDeptId().intValue() == excludeId
+ || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), excludeId + ""))
+ {
+ it.remove();
+ }
+ }
+ List ztrees = initZtree(deptList);
+ return ztrees;
+ }
+
+ /**
+ * 根据角色ID查询部门(数据权限)
+ *
+ * @param role 角色对象
+ * @return 部门列表(数据权限)
+ */
+ @Override
+ public List roleDeptTreeData(SysRole role)
+ {
+ Long roleId = role.getRoleId();
+ List ztrees = new ArrayList();
+ List deptList = selectDeptList(new SysDept());
+ if (StringUtils.isNotNull(roleId))
+ {
+ List roleDeptList = deptMapper.selectRoleDeptTree(roleId);
+ ztrees = initZtree(deptList, roleDeptList);
+ }
+ else
+ {
+ ztrees = initZtree(deptList);
+ }
+ return ztrees;
+ }
+
+ /**
+ * 对象转部门树
+ *
+ * @param deptList 部门列表
+ * @return 树结构列表
+ */
+ public List initZtree(List deptList)
+ {
+ return initZtree(deptList, null);
+ }
+
+ /**
+ * 对象转部门树
+ *
+ * @param deptList 部门列表
+ * @param roleDeptList 角色已存在菜单列表
+ * @return 树结构列表
+ */
+ public List initZtree(List deptList, List roleDeptList)
+ {
+
+ List ztrees = new ArrayList();
+ boolean isCheck = StringUtils.isNotNull(roleDeptList);
+ for (SysDept dept : deptList)
+ {
+ if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()))
+ {
+ Ztree ztree = new Ztree();
+ ztree.setId(dept.getDeptId());
+ ztree.setpId(dept.getParentId());
+ ztree.setName(dept.getDeptName());
+ ztree.setTitle(dept.getDeptName());
+ if (isCheck)
+ {
+ ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName()));
+ }
+ ztrees.add(ztree);
+ }
+ }
+ return ztrees;
+ }
+
+ /**
+ * 查询部门人数
+ *
+ * @param parentId 部门ID
+ * @return 结果
+ */
+ @Override
+ public int selectDeptCount(Long parentId)
+ {
+ SysDept dept = new SysDept();
+ dept.setParentId(parentId);
+ return deptMapper.selectDeptCount(dept);
+ }
+
+ /**
+ * 查询部门是否存在用户
+ *
+ * @param deptId 部门ID
+ * @return 结果 true 存在 false 不存在
+ */
+ @Override
+ public boolean checkDeptExistUser(Long deptId)
+ {
+ int result = deptMapper.checkDeptExistUser(deptId);
+ return result > 0 ? true : false;
+ }
+
+ /**
+ * 删除部门管理信息
+ *
+ * @param deptId 部门ID
+ * @return 结果
+ */
+ @Override
+ public int deleteDeptById(Long deptId)
+ {
+ return deptMapper.deleteDeptById(deptId);
+ }
+
+ /**
+ * 新增保存部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ @Override
+ public int insertDept(SysDept dept)
+ {
+ SysDept info = deptMapper.selectDeptById(dept.getParentId());
+ // 如果父节点不为"正常"状态,则不允许新增子节点
+ if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
+ {
+ throw new ServiceException("部门停用,不允许新增");
+ }
+ dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
+ return deptMapper.insertDept(dept);
+ }
+
+ /**
+ * 修改保存部门信息
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int updateDept(SysDept dept)
+ {
+ SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
+ SysDept oldDept = selectDeptById(dept.getDeptId());
+ if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
+ {
+ String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
+ String oldAncestors = oldDept.getAncestors();
+ dept.setAncestors(newAncestors);
+ updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
+ }
+ int result = deptMapper.updateDept(dept);
+ if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
+ && !StringUtils.equals("0", dept.getAncestors()))
+ {
+ // 如果该部门是启用状态,则启用该部门的所有上级部门
+ updateParentDeptStatusNormal(dept);
+ }
+ return result;
+ }
+
+ /**
+ * 修改该部门的父级部门状态
+ *
+ * @param dept 当前部门
+ */
+ private void updateParentDeptStatusNormal(SysDept dept)
+ {
+ String ancestors = dept.getAncestors();
+ Long[] deptIds = Convert.toLongArray(ancestors);
+ deptMapper.updateDeptStatusNormal(deptIds);
+ }
+
+ /**
+ * 修改子元素关系
+ *
+ * @param deptId 被修改的部门ID
+ * @param newAncestors 新的父ID集合
+ * @param oldAncestors 旧的父ID集合
+ */
+ public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
+ {
+ List children = deptMapper.selectChildrenDeptById(deptId);
+ for (SysDept child : children)
+ {
+ child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
+ }
+ if (children.size() > 0)
+ {
+ deptMapper.updateDeptChildren(children);
+ }
+ }
+
+ /**
+ * 根据部门ID查询信息
+ *
+ * @param deptId 部门ID
+ * @return 部门信息
+ */
+ @Override
+ public SysDept selectDeptById(Long deptId)
+ {
+ return deptMapper.selectDeptById(deptId);
+ }
+
+ /**
+ * 根据ID查询所有子部门(正常状态)
+ *
+ * @param deptId 部门ID
+ * @return 子部门数
+ */
+ @Override
+ public int selectNormalChildrenDeptById(Long deptId)
+ {
+ return deptMapper.selectNormalChildrenDeptById(deptId);
+ }
+
+ /**
+ * 校验部门名称是否唯一
+ *
+ * @param dept 部门信息
+ * @return 结果
+ */
+ @Override
+ public String checkDeptNameUnique(SysDept dept)
+ {
+ Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
+ SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
+ if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
+ {
+ return UserConstants.DEPT_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.DEPT_NAME_UNIQUE;
+ }
+
+ /**
+ * 校验部门是否有数据权限
+ *
+ * @param deptId 部门id
+ */
+ @Override
+ public void checkDeptDataScope(Long deptId)
+ {
+ if (!SysUser.isAdmin(ShiroUtils.getUserId()))
+ {
+ SysDept dept = new SysDept();
+ dept.setDeptId(deptId);
+ List depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
+ if (StringUtils.isEmpty(depts))
+ {
+ throw new ServiceException("没有权限访问部门数据!");
+ }
+ }
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
new file mode 100644
index 0000000..410b6fd
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java
@@ -0,0 +1,114 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.DictUtils;
+import com.ruoyi.system.mapper.SysDictDataMapper;
+import com.ruoyi.system.service.ISysDictDataService;
+
+/**
+ * 字典 业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysDictDataServiceImpl implements ISysDictDataService
+{
+ @Autowired
+ private SysDictDataMapper dictDataMapper;
+
+ /**
+ * 根据条件分页查询字典数据
+ *
+ * @param dictData 字典数据信息
+ * @return 字典数据集合信息
+ */
+ @Override
+ public List selectDictDataList(SysDictData dictData)
+ {
+ return dictDataMapper.selectDictDataList(dictData);
+ }
+
+ /**
+ * 根据字典类型和字典键值查询字典数据信息
+ *
+ * @param dictType 字典类型
+ * @param dictValue 字典键值
+ * @return 字典标签
+ */
+ @Override
+ public String selectDictLabel(String dictType, String dictValue)
+ {
+ return dictDataMapper.selectDictLabel(dictType, dictValue);
+ }
+
+ /**
+ * 根据字典数据ID查询信息
+ *
+ * @param dictCode 字典数据ID
+ * @return 字典数据
+ */
+ @Override
+ public SysDictData selectDictDataById(Long dictCode)
+ {
+ return dictDataMapper.selectDictDataById(dictCode);
+ }
+
+ /**
+ * 批量删除字典数据
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ @Override
+ public void deleteDictDataByIds(String ids)
+ {
+ Long[] dictCodes = Convert.toLongArray(ids);
+ for (Long dictCode : dictCodes)
+ {
+ SysDictData data = selectDictDataById(dictCode);
+ dictDataMapper.deleteDictDataById(dictCode);
+ List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
+ DictUtils.setDictCache(data.getDictType(), dictDatas);
+ }
+ }
+
+ /**
+ * 新增保存字典数据信息
+ *
+ * @param data 字典数据信息
+ * @return 结果
+ */
+ @Override
+ public int insertDictData(SysDictData data)
+ {
+ int row = dictDataMapper.insertDictData(data);
+ if (row > 0)
+ {
+ List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
+ DictUtils.setDictCache(data.getDictType(), dictDatas);
+ }
+ return row;
+ }
+
+ /**
+ * 修改保存字典数据信息
+ *
+ * @param data 字典数据信息
+ * @return 结果
+ */
+ @Override
+ public int updateDictData(SysDictData data)
+ {
+ int row = dictDataMapper.updateDictData(data);
+ if (row > 0)
+ {
+ List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
+ DictUtils.setDictCache(data.getDictType(), dictDatas);
+ }
+ return row;
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
new file mode 100644
index 0000000..985d119
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
@@ -0,0 +1,257 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.domain.entity.SysDictType;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.DictUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.mapper.SysDictDataMapper;
+import com.ruoyi.system.mapper.SysDictTypeMapper;
+import com.ruoyi.system.service.ISysDictTypeService;
+
+/**
+ * 字典 业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysDictTypeServiceImpl implements ISysDictTypeService
+{
+ @Autowired
+ private SysDictTypeMapper dictTypeMapper;
+
+ @Autowired
+ private SysDictDataMapper dictDataMapper;
+
+ /**
+ * 项目启动时,初始化字典到缓存
+ */
+ @PostConstruct
+ public void init()
+ {
+ loadingDictCache();
+ }
+
+ /**
+ * 根据条件分页查询字典类型
+ *
+ * @param dictType 字典类型信息
+ * @return 字典类型集合信息
+ */
+ @Override
+ public List selectDictTypeList(SysDictType dictType)
+ {
+ return dictTypeMapper.selectDictTypeList(dictType);
+ }
+
+ /**
+ * 根据所有字典类型
+ *
+ * @return 字典类型集合信息
+ */
+ @Override
+ public List selectDictTypeAll()
+ {
+ return dictTypeMapper.selectDictTypeAll();
+ }
+
+ /**
+ * 根据字典类型查询字典数据
+ *
+ * @param dictType 字典类型
+ * @return 字典数据集合信息
+ */
+ @Override
+ public List selectDictDataByType(String dictType)
+ {
+ List dictDatas = DictUtils.getDictCache(dictType);
+ if (StringUtils.isNotEmpty(dictDatas))
+ {
+ return dictDatas;
+ }
+ dictDatas = dictDataMapper.selectDictDataByType(dictType);
+ if (StringUtils.isNotEmpty(dictDatas))
+ {
+ DictUtils.setDictCache(dictType, dictDatas);
+ return dictDatas;
+ }
+ return null;
+ }
+
+ /**
+ * 根据字典类型ID查询信息
+ *
+ * @param dictId 字典类型ID
+ * @return 字典类型
+ */
+ @Override
+ public SysDictType selectDictTypeById(Long dictId)
+ {
+ return dictTypeMapper.selectDictTypeById(dictId);
+ }
+
+ /**
+ * 根据字典类型查询信息
+ *
+ * @param dictType 字典类型
+ * @return 字典类型
+ */
+ @Override
+ public SysDictType selectDictTypeByType(String dictType)
+ {
+ return dictTypeMapper.selectDictTypeByType(dictType);
+ }
+
+ /**
+ * 批量删除字典类型
+ *
+ * @param ids 需要删除的数据
+ * @return 结果
+ */
+ @Override
+ public void deleteDictTypeByIds(String ids)
+ {
+ Long[] dictIds = Convert.toLongArray(ids);
+ for (Long dictId : dictIds)
+ {
+ SysDictType dictType = selectDictTypeById(dictId);
+ if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
+ {
+ throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
+ }
+ dictTypeMapper.deleteDictTypeById(dictId);
+ DictUtils.removeDictCache(dictType.getDictType());
+ }
+ }
+
+ /**
+ * 加载字典缓存数据
+ */
+ @Override
+ public void loadingDictCache()
+ {
+ List dictTypeList = dictTypeMapper.selectDictTypeAll();
+ for (SysDictType dict : dictTypeList)
+ {
+ List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
+ DictUtils.setDictCache(dict.getDictType(), dictDatas);
+ }
+ }
+
+ /**
+ * 清空字典缓存数据
+ */
+ @Override
+ public void clearDictCache()
+ {
+ DictUtils.clearDictCache();
+ }
+
+ /**
+ * 重置字典缓存数据
+ */
+ @Override
+ public void resetDictCache()
+ {
+ clearDictCache();
+ loadingDictCache();
+ }
+
+ /**
+ * 新增保存字典类型信息
+ *
+ * @param dict 字典类型信息
+ * @return 结果
+ */
+ @Override
+ public int insertDictType(SysDictType dict)
+ {
+ int row = dictTypeMapper.insertDictType(dict);
+ if (row > 0)
+ {
+ DictUtils.setDictCache(dict.getDictType(), null);
+ }
+ return row;
+ }
+
+ /**
+ * 修改保存字典类型信息
+ *
+ * @param dict 字典类型信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int updateDictType(SysDictType dict)
+ {
+ SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
+ dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
+ int row = dictTypeMapper.updateDictType(dict);
+ if (row > 0)
+ {
+ List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
+ DictUtils.setDictCache(dict.getDictType(), dictDatas);
+ }
+ return row;
+ }
+
+ /**
+ * 校验字典类型称是否唯一
+ *
+ * @param dict 字典类型
+ * @return 结果
+ */
+ @Override
+ public String checkDictTypeUnique(SysDictType dict)
+ {
+ Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
+ SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
+ if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
+ {
+ return UserConstants.DICT_TYPE_NOT_UNIQUE;
+ }
+ return UserConstants.DICT_TYPE_UNIQUE;
+ }
+
+ /**
+ * 查询字典类型树
+ *
+ * @param dictType 字典类型
+ * @return 所有字典类型
+ */
+ @Override
+ public List selectDictTree(SysDictType dictType)
+ {
+ List ztrees = new ArrayList();
+ List dictList = dictTypeMapper.selectDictTypeList(dictType);
+ for (SysDictType dict : dictList)
+ {
+ if (UserConstants.DICT_NORMAL.equals(dict.getStatus()))
+ {
+ Ztree ztree = new Ztree();
+ ztree.setId(dict.getDictId());
+ ztree.setName(transDictName(dict));
+ ztree.setTitle(dict.getDictType());
+ ztrees.add(ztree);
+ }
+ }
+ return ztrees;
+ }
+
+ public String transDictName(SysDictType dictType)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("(" + dictType.getDictName() + ")");
+ sb.append(" " + dictType.getDictType());
+ return sb.toString();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
new file mode 100644
index 0000000..f225fe9
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java
@@ -0,0 +1,66 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.system.domain.SysLogininfor;
+import com.ruoyi.system.mapper.SysLogininforMapper;
+import com.ruoyi.system.service.ISysLogininforService;
+
+/**
+ * 系统访问日志情况信息 服务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysLogininforServiceImpl implements ISysLogininforService
+{
+
+ @Autowired
+ private SysLogininforMapper logininforMapper;
+
+ /**
+ * 新增系统登录日志
+ *
+ * @param logininfor 访问日志对象
+ */
+ @Override
+ public void insertLogininfor(SysLogininfor logininfor)
+ {
+ logininforMapper.insertLogininfor(logininfor);
+ }
+
+ /**
+ * 查询系统登录日志集合
+ *
+ * @param logininfor 访问日志对象
+ * @return 登录记录集合
+ */
+ @Override
+ public List selectLogininforList(SysLogininfor logininfor)
+ {
+ return logininforMapper.selectLogininforList(logininfor);
+ }
+
+ /**
+ * 批量删除系统登录日志
+ *
+ * @param ids 需要删除的数据
+ * @return
+ */
+ @Override
+ public int deleteLogininforByIds(String ids)
+ {
+ return logininforMapper.deleteLogininforByIds(Convert.toStrArray(ids));
+ }
+
+ /**
+ * 清空系统登录日志
+ */
+ @Override
+ public void cleanLogininfor()
+ {
+ logininforMapper.cleanLogininfor();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
new file mode 100644
index 0000000..70885c9
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -0,0 +1,389 @@
+package com.ruoyi.system.service.impl;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.Ztree;
+import com.ruoyi.common.core.domain.entity.SysMenu;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.mapper.SysMenuMapper;
+import com.ruoyi.system.mapper.SysRoleMenuMapper;
+import com.ruoyi.system.service.ISysMenuService;
+
+/**
+ * 菜单 业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysMenuServiceImpl implements ISysMenuService
+{
+ public static final String PREMISSION_STRING = "perms[\"{0}\"]";
+
+ @Autowired
+ private SysMenuMapper menuMapper;
+
+ @Autowired
+ private SysRoleMenuMapper roleMenuMapper;
+
+ /**
+ * 根据用户查询菜单
+ *
+ * @param user 用户信息
+ * @return 菜单列表
+ */
+ @Override
+ public List selectMenusByUser(SysUser user)
+ {
+ List menus = new LinkedList();
+ // 管理员显示所有菜单信息
+ if (user.isAdmin())
+ {
+ menus = menuMapper.selectMenuNormalAll();
+ }
+ else
+ {
+ menus = menuMapper.selectMenusByUserId(user.getUserId());
+ }
+ return getChildPerms(menus, 0);
+ }
+
+ /**
+ * 查询菜单集合
+ *
+ * @return 所有菜单信息
+ */
+ @Override
+ public List selectMenuList(SysMenu menu, Long userId)
+ {
+ List menuList = null;
+ if (SysUser.isAdmin(userId))
+ {
+ menuList = menuMapper.selectMenuList(menu);
+ }
+ else
+ {
+ menu.getParams().put("userId", userId);
+ menuList = menuMapper.selectMenuListByUserId(menu);
+ }
+ return menuList;
+ }
+
+ /**
+ * 查询菜单集合
+ *
+ * @return 所有菜单信息
+ */
+ @Override
+ public List selectMenuAll(Long userId)
+ {
+ List menuList = null;
+ if (SysUser.isAdmin(userId))
+ {
+ menuList = menuMapper.selectMenuAll();
+ }
+ else
+ {
+ menuList = menuMapper.selectMenuAllByUserId(userId);
+ }
+ return menuList;
+ }
+
+ /**
+ * 根据用户ID查询权限
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ @Override
+ public Set selectPermsByUserId(Long userId)
+ {
+ List perms = menuMapper.selectPermsByUserId(userId);
+ Set permsSet = new HashSet<>();
+ for (String perm : perms)
+ {
+ if (StringUtils.isNotEmpty(perm))
+ {
+ permsSet.addAll(Arrays.asList(perm.trim().split(",")));
+ }
+ }
+ return permsSet;
+ }
+
+ /**
+ * 根据角色ID查询菜单
+ *
+ * @param role 角色对象
+ * @return 菜单列表
+ */
+ @Override
+ public List roleMenuTreeData(SysRole role, Long userId)
+ {
+ Long roleId = role.getRoleId();
+ List ztrees = new ArrayList();
+ List menuList = selectMenuAll(userId);
+ if (StringUtils.isNotNull(roleId))
+ {
+ List roleMenuList = menuMapper.selectMenuTree(roleId);
+ ztrees = initZtree(menuList, roleMenuList, true);
+ }
+ else
+ {
+ ztrees = initZtree(menuList, null, true);
+ }
+ return ztrees;
+ }
+
+ /**
+ * 查询所有菜单
+ *
+ * @return 菜单列表
+ */
+ @Override
+ public List menuTreeData(Long userId)
+ {
+ List menuList = selectMenuAll(userId);
+ List ztrees = initZtree(menuList);
+ return ztrees;
+ }
+
+ /**
+ * 查询系统所有权限
+ *
+ * @return 权限列表
+ */
+ @Override
+ public LinkedHashMap selectPermsAll(Long userId)
+ {
+ LinkedHashMap section = new LinkedHashMap<>();
+ List permissions = selectMenuAll(userId);
+ if (StringUtils.isNotEmpty(permissions))
+ {
+ for (SysMenu menu : permissions)
+ {
+ section.put(menu.getUrl(), MessageFormat.format(PREMISSION_STRING, menu.getPerms()));
+ }
+ }
+ return section;
+ }
+
+ /**
+ * 对象转菜单树
+ *
+ * @param menuList 菜单列表
+ * @return 树结构列表
+ */
+ public List initZtree(List menuList)
+ {
+ return initZtree(menuList, null, false);
+ }
+
+ /**
+ * 对象转菜单树
+ *
+ * @param menuList 菜单列表
+ * @param roleMenuList 角色已存在菜单列表
+ * @param permsFlag 是否需要显示权限标识
+ * @return 树结构列表
+ */
+ public List initZtree(List menuList, List roleMenuList, boolean permsFlag)
+ {
+ List ztrees = new ArrayList();
+ boolean isCheck = StringUtils.isNotNull(roleMenuList);
+ for (SysMenu menu : menuList)
+ {
+ Ztree ztree = new Ztree();
+ ztree.setId(menu.getMenuId());
+ ztree.setpId(menu.getParentId());
+ ztree.setName(transMenuName(menu, permsFlag));
+ ztree.setTitle(menu.getMenuName());
+ if (isCheck)
+ {
+ ztree.setChecked(roleMenuList.contains(menu.getMenuId() + menu.getPerms()));
+ }
+ ztrees.add(ztree);
+ }
+ return ztrees;
+ }
+
+ public String transMenuName(SysMenu menu, boolean permsFlag)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(menu.getMenuName());
+ if (permsFlag)
+ {
+ sb.append(" " + menu.getPerms() + "");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 删除菜单管理信息
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ @Override
+ public int deleteMenuById(Long menuId)
+ {
+ return menuMapper.deleteMenuById(menuId);
+ }
+
+ /**
+ * 根据菜单ID查询信息
+ *
+ * @param menuId 菜单ID
+ * @return 菜单信息
+ */
+ @Override
+ public SysMenu selectMenuById(Long menuId)
+ {
+ return menuMapper.selectMenuById(menuId);
+ }
+
+ /**
+ * 查询子菜单数量
+ *
+ * @param parentId 父级菜单ID
+ * @return 结果
+ */
+ @Override
+ public int selectCountMenuByParentId(Long parentId)
+ {
+ return menuMapper.selectCountMenuByParentId(parentId);
+ }
+
+ /**
+ * 查询菜单使用数量
+ *
+ * @param menuId 菜单ID
+ * @return 结果
+ */
+ @Override
+ public int selectCountRoleMenuByMenuId(Long menuId)
+ {
+ return roleMenuMapper.selectCountRoleMenuByMenuId(menuId);
+ }
+
+ /**
+ * 新增保存菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ @Override
+ public int insertMenu(SysMenu menu)
+ {
+ return menuMapper.insertMenu(menu);
+ }
+
+ /**
+ * 修改保存菜单信息
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ @Override
+ public int updateMenu(SysMenu menu)
+ {
+ return menuMapper.updateMenu(menu);
+ }
+
+ /**
+ * 校验菜单名称是否唯一
+ *
+ * @param menu 菜单信息
+ * @return 结果
+ */
+ @Override
+ public String checkMenuNameUnique(SysMenu menu)
+ {
+ Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
+ SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
+ if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
+ {
+ return UserConstants.MENU_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.MENU_NAME_UNIQUE;
+ }
+
+ /**
+ * 根据父节点的ID获取所有子节点
+ *
+ * @param list 分类表
+ * @param parentId 传入的父节点ID
+ * @return String
+ */
+ public List getChildPerms(List list, int parentId)
+ {
+ List returnList = new ArrayList();
+ for (Iterator iterator = list.iterator(); iterator.hasNext();)
+ {
+ SysMenu t = (SysMenu) iterator.next();
+ // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点
+ if (t.getParentId() == parentId)
+ {
+ recursionFn(list, t);
+ returnList.add(t);
+ }
+ }
+ return returnList;
+ }
+
+ /**
+ * 递归列表
+ *
+ * @param list
+ * @param t
+ */
+ private void recursionFn(List list, SysMenu t)
+ {
+ // 得到子节点列表
+ List childList = getChildList(list, t);
+ t.setChildren(childList);
+ for (SysMenu tChild : childList)
+ {
+ if (hasChild(list, tChild))
+ {
+ recursionFn(list, tChild);
+ }
+ }
+ }
+
+ /**
+ * 得到子节点列表
+ */
+ private List getChildList(List list, SysMenu t)
+ {
+ List tlist = new ArrayList();
+ Iterator it = list.iterator();
+ while (it.hasNext())
+ {
+ SysMenu n = (SysMenu) it.next();
+ if (n.getParentId().longValue() == t.getMenuId().longValue())
+ {
+ tlist.add(n);
+ }
+ }
+ return tlist;
+ }
+
+ /**
+ * 判断是否有子节点
+ */
+ private boolean hasChild(List list, SysMenu t)
+ {
+ return getChildList(list, t).size() > 0 ? true : false;
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java
new file mode 100644
index 0000000..7968b9a
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java
@@ -0,0 +1,82 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.system.domain.SysNotice;
+import com.ruoyi.system.mapper.SysNoticeMapper;
+import com.ruoyi.system.service.ISysNoticeService;
+
+/**
+ * 公告 服务层实现
+ *
+ * @author ruoyi
+ * @date 2018-06-25
+ */
+@Service
+public class SysNoticeServiceImpl implements ISysNoticeService
+{
+ @Autowired
+ private SysNoticeMapper noticeMapper;
+
+ /**
+ * 查询公告信息
+ *
+ * @param noticeId 公告ID
+ * @return 公告信息
+ */
+ @Override
+ public SysNotice selectNoticeById(Long noticeId)
+ {
+ return noticeMapper.selectNoticeById(noticeId);
+ }
+
+ /**
+ * 查询公告列表
+ *
+ * @param notice 公告信息
+ * @return 公告集合
+ */
+ @Override
+ public List selectNoticeList(SysNotice notice)
+ {
+ return noticeMapper.selectNoticeList(notice);
+ }
+
+ /**
+ * 新增公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ @Override
+ public int insertNotice(SysNotice notice)
+ {
+ return noticeMapper.insertNotice(notice);
+ }
+
+ /**
+ * 修改公告
+ *
+ * @param notice 公告信息
+ * @return 结果
+ */
+ @Override
+ public int updateNotice(SysNotice notice)
+ {
+ return noticeMapper.updateNotice(notice);
+ }
+
+ /**
+ * 删除公告对象
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ @Override
+ public int deleteNoticeByIds(String ids)
+ {
+ return noticeMapper.deleteNoticeByIds(Convert.toStrArray(ids));
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
new file mode 100644
index 0000000..78ae353
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
@@ -0,0 +1,77 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.system.domain.SysOperLog;
+import com.ruoyi.system.mapper.SysOperLogMapper;
+import com.ruoyi.system.service.ISysOperLogService;
+
+/**
+ * 操作日志 服务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysOperLogServiceImpl implements ISysOperLogService
+{
+ @Autowired
+ private SysOperLogMapper operLogMapper;
+
+ /**
+ * 新增操作日志
+ *
+ * @param operLog 操作日志对象
+ */
+ @Override
+ public void insertOperlog(SysOperLog operLog)
+ {
+ operLogMapper.insertOperlog(operLog);
+ }
+
+ /**
+ * 查询系统操作日志集合
+ *
+ * @param operLog 操作日志对象
+ * @return 操作日志集合
+ */
+ @Override
+ public List selectOperLogList(SysOperLog operLog)
+ {
+ return operLogMapper.selectOperLogList(operLog);
+ }
+
+ /**
+ * 批量删除系统操作日志
+ *
+ * @param ids 需要删除的数据
+ * @return
+ */
+ @Override
+ public int deleteOperLogByIds(String ids)
+ {
+ return operLogMapper.deleteOperLogByIds(Convert.toStrArray(ids));
+ }
+
+ /**
+ * 查询操作日志详细
+ *
+ * @param operId 操作ID
+ * @return 操作日志对象
+ */
+ @Override
+ public SysOperLog selectOperLogById(Long operId)
+ {
+ return operLogMapper.selectOperLogById(operId);
+ }
+
+ /**
+ * 清空操作日志
+ */
+ @Override
+ public void cleanOperLog()
+ {
+ operLogMapper.cleanOperLog();
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
new file mode 100644
index 0000000..4c63ac2
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
@@ -0,0 +1,181 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysPost;
+import com.ruoyi.system.mapper.SysPostMapper;
+import com.ruoyi.system.mapper.SysUserPostMapper;
+import com.ruoyi.system.service.ISysPostService;
+
+/**
+ * 岗位信息 服务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysPostServiceImpl implements ISysPostService
+{
+ @Autowired
+ private SysPostMapper postMapper;
+
+ @Autowired
+ private SysUserPostMapper userPostMapper;
+
+ /**
+ * 查询岗位信息集合
+ *
+ * @param post 岗位信息
+ * @return 岗位信息集合
+ */
+ @Override
+ public List selectPostList(SysPost post)
+ {
+ return postMapper.selectPostList(post);
+ }
+
+ /**
+ * 查询所有岗位
+ *
+ * @return 岗位列表
+ */
+ @Override
+ public List selectPostAll()
+ {
+ return postMapper.selectPostAll();
+ }
+
+ /**
+ * 根据用户ID查询岗位
+ *
+ * @param userId 用户ID
+ * @return 岗位列表
+ */
+ @Override
+ public List selectPostsByUserId(Long userId)
+ {
+ List userPosts = postMapper.selectPostsByUserId(userId);
+ List posts = postMapper.selectPostAll();
+ for (SysPost post : posts)
+ {
+ for (SysPost userRole : userPosts)
+ {
+ if (post.getPostId().longValue() == userRole.getPostId().longValue())
+ {
+ post.setFlag(true);
+ break;
+ }
+ }
+ }
+ return posts;
+ }
+
+ /**
+ * 通过岗位ID查询岗位信息
+ *
+ * @param postId 岗位ID
+ * @return 角色对象信息
+ */
+ @Override
+ public SysPost selectPostById(Long postId)
+ {
+ return postMapper.selectPostById(postId);
+ }
+
+ /**
+ * 批量删除岗位信息
+ *
+ * @param ids 需要删除的数据ID
+ * @throws Exception
+ */
+ @Override
+ public int deletePostByIds(String ids)
+ {
+ Long[] postIds = Convert.toLongArray(ids);
+ for (Long postId : postIds)
+ {
+ SysPost post = selectPostById(postId);
+ if (countUserPostById(postId) > 0)
+ {
+ throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
+ }
+ }
+ return postMapper.deletePostByIds(postIds);
+ }
+
+ /**
+ * 新增保存岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public int insertPost(SysPost post)
+ {
+ return postMapper.insertPost(post);
+ }
+
+ /**
+ * 修改保存岗位信息
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public int updatePost(SysPost post)
+ {
+ return postMapper.updatePost(post);
+ }
+
+ /**
+ * 通过岗位ID查询岗位使用数量
+ *
+ * @param postId 岗位ID
+ * @return 结果
+ */
+ @Override
+ public int countUserPostById(Long postId)
+ {
+ return userPostMapper.countUserPostById(postId);
+ }
+
+ /**
+ * 校验岗位名称是否唯一
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public String checkPostNameUnique(SysPost post)
+ {
+ Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
+ SysPost info = postMapper.checkPostNameUnique(post.getPostName());
+ if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
+ {
+ return UserConstants.POST_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.POST_NAME_UNIQUE;
+ }
+
+ /**
+ * 校验岗位编码是否唯一
+ *
+ * @param post 岗位信息
+ * @return 结果
+ */
+ @Override
+ public String checkPostCodeUnique(SysPost post)
+ {
+ Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
+ SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
+ if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue())
+ {
+ return UserConstants.POST_CODE_NOT_UNIQUE;
+ }
+ return UserConstants.POST_CODE_UNIQUE;
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
new file mode 100644
index 0000000..e457d38
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java
@@ -0,0 +1,414 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.ShiroUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.system.domain.SysRoleDept;
+import com.ruoyi.system.domain.SysRoleMenu;
+import com.ruoyi.system.domain.SysUserRole;
+import com.ruoyi.system.mapper.SysRoleDeptMapper;
+import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.system.mapper.SysRoleMenuMapper;
+import com.ruoyi.system.mapper.SysUserRoleMapper;
+import com.ruoyi.system.service.ISysRoleService;
+
+/**
+ * 角色 业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysRoleServiceImpl implements ISysRoleService
+{
+ @Autowired
+ private SysRoleMapper roleMapper;
+
+ @Autowired
+ private SysRoleMenuMapper roleMenuMapper;
+
+ @Autowired
+ private SysUserRoleMapper userRoleMapper;
+
+ @Autowired
+ private SysRoleDeptMapper roleDeptMapper;
+
+ /**
+ * 根据条件分页查询角色数据
+ *
+ * @param role 角色信息
+ * @return 角色数据集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d")
+ public List selectRoleList(SysRole role)
+ {
+ return roleMapper.selectRoleList(role);
+ }
+
+ /**
+ * 根据用户ID查询权限
+ *
+ * @param userId 用户ID
+ * @return 权限列表
+ */
+ @Override
+ public Set selectRoleKeys(Long userId)
+ {
+ List perms = roleMapper.selectRolesByUserId(userId);
+ Set permsSet = new HashSet<>();
+ for (SysRole perm : perms)
+ {
+ if (StringUtils.isNotNull(perm))
+ {
+ permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
+ }
+ }
+ return permsSet;
+ }
+
+ /**
+ * 根据用户ID查询角色
+ *
+ * @param userId 用户ID
+ * @return 角色列表
+ */
+ @Override
+ public List selectRolesByUserId(Long userId)
+ {
+ List userRoles = roleMapper.selectRolesByUserId(userId);
+ List roles = selectRoleAll();
+ for (SysRole role : roles)
+ {
+ for (SysRole userRole : userRoles)
+ {
+ if (role.getRoleId().longValue() == userRole.getRoleId().longValue())
+ {
+ role.setFlag(true);
+ break;
+ }
+ }
+ }
+ return roles;
+ }
+
+ /**
+ * 查询所有角色
+ *
+ * @return 角色列表
+ */
+ @Override
+ public List selectRoleAll()
+ {
+ return SpringUtils.getAopProxy(this).selectRoleList(new SysRole());
+ }
+
+ /**
+ * 通过角色ID查询角色
+ *
+ * @param roleId 角色ID
+ * @return 角色对象信息
+ */
+ @Override
+ public SysRole selectRoleById(Long roleId)
+ {
+ return roleMapper.selectRoleById(roleId);
+ }
+
+ /**
+ * 通过角色ID删除角色
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public boolean deleteRoleById(Long roleId)
+ {
+ // 删除角色与菜单关联
+ roleMenuMapper.deleteRoleMenuByRoleId(roleId);
+ // 删除角色与部门关联
+ roleDeptMapper.deleteRoleDeptByRoleId(roleId);
+ return roleMapper.deleteRoleById(roleId) > 0 ? true : false;
+ }
+
+ /**
+ * 批量删除角色信息
+ *
+ * @param ids 需要删除的数据ID
+ * @throws Exception
+ */
+ @Override
+ @Transactional
+ public int deleteRoleByIds(String ids)
+ {
+ Long[] roleIds = Convert.toLongArray(ids);
+ for (Long roleId : roleIds)
+ {
+ checkRoleAllowed(new SysRole(roleId));
+ SysRole role = selectRoleById(roleId);
+ if (countUserRoleByRoleId(roleId) > 0)
+ {
+ throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
+ }
+ }
+ // 删除角色与菜单关联
+ roleMenuMapper.deleteRoleMenu(roleIds);
+ // 删除角色与部门关联
+ roleDeptMapper.deleteRoleDept(roleIds);
+ return roleMapper.deleteRoleByIds(roleIds);
+ }
+
+ /**
+ * 新增保存角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int insertRole(SysRole role)
+ {
+ // 新增角色信息
+ roleMapper.insertRole(role);
+ return insertRoleMenu(role);
+ }
+
+ /**
+ * 修改保存角色信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int updateRole(SysRole role)
+ {
+ // 修改角色信息
+ roleMapper.updateRole(role);
+ // 删除角色与菜单关联
+ roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
+ return insertRoleMenu(role);
+ }
+
+ /**
+ * 修改数据权限信息
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int authDataScope(SysRole role)
+ {
+ // 修改角色信息
+ roleMapper.updateRole(role);
+ // 删除角色与部门关联
+ roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
+ // 新增角色和部门信息(数据权限)
+ return insertRoleDept(role);
+ }
+
+ /**
+ * 新增角色菜单信息
+ *
+ * @param role 角色对象
+ */
+ public int insertRoleMenu(SysRole role)
+ {
+ int rows = 1;
+ // 新增用户与角色管理
+ List list = new ArrayList();
+ for (Long menuId : role.getMenuIds())
+ {
+ SysRoleMenu rm = new SysRoleMenu();
+ rm.setRoleId(role.getRoleId());
+ rm.setMenuId(menuId);
+ list.add(rm);
+ }
+ if (list.size() > 0)
+ {
+ rows = roleMenuMapper.batchRoleMenu(list);
+ }
+ return rows;
+ }
+
+ /**
+ * 新增角色部门信息(数据权限)
+ *
+ * @param role 角色对象
+ */
+ public int insertRoleDept(SysRole role)
+ {
+ int rows = 1;
+ // 新增角色与部门(数据权限)管理
+ List list = new ArrayList();
+ for (Long deptId : role.getDeptIds())
+ {
+ SysRoleDept rd = new SysRoleDept();
+ rd.setRoleId(role.getRoleId());
+ rd.setDeptId(deptId);
+ list.add(rd);
+ }
+ if (list.size() > 0)
+ {
+ rows = roleDeptMapper.batchRoleDept(list);
+ }
+ return rows;
+ }
+
+ /**
+ * 校验角色名称是否唯一
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ public String checkRoleNameUnique(SysRole role)
+ {
+ Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
+ SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
+ if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
+ {
+ return UserConstants.ROLE_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.ROLE_NAME_UNIQUE;
+ }
+
+ /**
+ * 校验角色权限是否唯一
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ public String checkRoleKeyUnique(SysRole role)
+ {
+ Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
+ SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
+ if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
+ {
+ return UserConstants.ROLE_KEY_NOT_UNIQUE;
+ }
+ return UserConstants.ROLE_KEY_UNIQUE;
+ }
+
+ /**
+ * 校验角色是否允许操作
+ *
+ * @param role 角色信息
+ */
+ @Override
+ public void checkRoleAllowed(SysRole role)
+ {
+ if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin())
+ {
+ throw new ServiceException("不允许操作超级管理员角色");
+ }
+ }
+
+ /**
+ * 校验角色是否有数据权限
+ *
+ * @param roleId 角色id
+ */
+ @Override
+ public void checkRoleDataScope(Long roleId)
+ {
+ if (!SysUser.isAdmin(ShiroUtils.getUserId()))
+ {
+ SysRole role = new SysRole();
+ role.setRoleId(roleId);
+ List roles = SpringUtils.getAopProxy(this).selectRoleList(role);
+ if (StringUtils.isEmpty(roles))
+ {
+ throw new ServiceException("没有权限访问角色数据!");
+ }
+ }
+ }
+
+ /**
+ * 通过角色ID查询角色使用数量
+ *
+ * @param roleId 角色ID
+ * @return 结果
+ */
+ @Override
+ public int countUserRoleByRoleId(Long roleId)
+ {
+ return userRoleMapper.countUserRoleByRoleId(roleId);
+ }
+
+ /**
+ * 角色状态修改
+ *
+ * @param role 角色信息
+ * @return 结果
+ */
+ @Override
+ public int changeStatus(SysRole role)
+ {
+ return roleMapper.updateRole(role);
+ }
+
+ /**
+ * 取消授权用户角色
+ *
+ * @param userRole 用户和角色关联信息
+ * @return 结果
+ */
+ @Override
+ public int deleteAuthUser(SysUserRole userRole)
+ {
+ return userRoleMapper.deleteUserRoleInfo(userRole);
+ }
+
+ /**
+ * 批量取消授权用户角色
+ *
+ * @param roleId 角色ID
+ * @param userIds 需要删除的用户数据ID
+ * @return 结果
+ */
+ @Override
+ public int deleteAuthUsers(Long roleId, String userIds)
+ {
+ return userRoleMapper.deleteUserRoleInfos(roleId, Convert.toLongArray(userIds));
+ }
+
+ /**
+ * 批量选择授权用户角色
+ *
+ * @param roleId 角色ID
+ * @param userIds 需要删除的用户数据ID
+ * @return 结果
+ */
+ @Override
+ public int insertAuthUsers(Long roleId, String userIds)
+ {
+ Long[] users = Convert.toLongArray(userIds);
+ // 新增用户与角色管理
+ List list = new ArrayList();
+ for (Long userId : users)
+ {
+ SysUserRole ur = new SysUserRole();
+ ur.setUserId(userId);
+ ur.setRoleId(roleId);
+ list.add(ur);
+ }
+ return userRoleMapper.batchUserRole(list);
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
new file mode 100644
index 0000000..c170d42
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java
@@ -0,0 +1,141 @@
+package com.ruoyi.system.service.impl;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Deque;
+import java.util.List;
+import org.apache.shiro.cache.Cache;
+import org.apache.shiro.cache.ehcache.EhCacheManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.common.constant.ShiroConstants;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysUserOnline;
+import com.ruoyi.system.mapper.SysUserOnlineMapper;
+import com.ruoyi.system.service.ISysUserOnlineService;
+
+/**
+ * 在线用户 服务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysUserOnlineServiceImpl implements ISysUserOnlineService
+{
+ @Autowired
+ private SysUserOnlineMapper userOnlineDao;
+
+ @Autowired
+ private EhCacheManager ehCacheManager;
+
+ /**
+ * 通过会话序号查询信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ @Override
+ public SysUserOnline selectOnlineById(String sessionId)
+ {
+ return userOnlineDao.selectOnlineById(sessionId);
+ }
+
+ /**
+ * 通过会话序号删除信息
+ *
+ * @param sessionId 会话ID
+ * @return 在线用户信息
+ */
+ @Override
+ public void deleteOnlineById(String sessionId)
+ {
+ SysUserOnline userOnline = selectOnlineById(sessionId);
+ if (StringUtils.isNotNull(userOnline))
+ {
+ userOnlineDao.deleteOnlineById(sessionId);
+ }
+ }
+
+ /**
+ * 通过会话序号删除信息
+ *
+ * @param sessions 会话ID集合
+ * @return 在线用户信息
+ */
+ @Override
+ public void batchDeleteOnline(List sessions)
+ {
+ for (String sessionId : sessions)
+ {
+ SysUserOnline userOnline = selectOnlineById(sessionId);
+ if (StringUtils.isNotNull(userOnline))
+ {
+ userOnlineDao.deleteOnlineById(sessionId);
+ }
+ }
+ }
+
+ /**
+ * 保存会话信息
+ *
+ * @param online 会话信息
+ */
+ @Override
+ public void saveOnline(SysUserOnline online)
+ {
+ userOnlineDao.saveOnline(online);
+ }
+
+ /**
+ * 查询会话集合
+ *
+ * @param userOnline 在线用户
+ */
+ @Override
+ public List selectUserOnlineList(SysUserOnline userOnline)
+ {
+ return userOnlineDao.selectUserOnlineList(userOnline);
+ }
+
+ /**
+ * 强退用户
+ *
+ * @param sessionId 会话ID
+ */
+ @Override
+ public void forceLogout(String sessionId)
+ {
+ userOnlineDao.deleteOnlineById(sessionId);
+ }
+
+ /**
+ * 清理用户缓存
+ *
+ * @param loginName 登录名称
+ * @param sessionId 会话ID
+ */
+ @Override
+ public void removeUserCache(String loginName, String sessionId)
+ {
+ Cache> cache = ehCacheManager.getCache(ShiroConstants.SYS_USERCACHE);
+ Deque deque = cache.get(loginName);
+ if (StringUtils.isEmpty(deque) || deque.size() == 0)
+ {
+ return;
+ }
+ deque.remove(sessionId);
+ }
+
+ /**
+ * 查询会话集合
+ *
+ * @param expiredDate 失效日期
+ */
+ @Override
+ public List selectOnlineByExpired(Date expiredDate)
+ {
+ String lastAccessTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, expiredDate);
+ return userOnlineDao.selectOnlineByExpired(lastAccessTime);
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
new file mode 100644
index 0000000..7f22200
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -0,0 +1,549 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.validation.Validator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.ShiroUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.bean.BeanValidators;
+import com.ruoyi.common.utils.security.Md5Utils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.system.domain.SysPost;
+import com.ruoyi.system.domain.SysUserPost;
+import com.ruoyi.system.domain.SysUserRole;
+import com.ruoyi.system.mapper.SysPostMapper;
+import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.system.mapper.SysUserMapper;
+import com.ruoyi.system.mapper.SysUserPostMapper;
+import com.ruoyi.system.mapper.SysUserRoleMapper;
+import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.system.service.ISysUserService;
+
+/**
+ * 用户 业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class SysUserServiceImpl implements ISysUserService
+{
+ private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
+
+ @Autowired
+ private SysUserMapper userMapper;
+
+ @Autowired
+ private SysRoleMapper roleMapper;
+
+ @Autowired
+ private SysPostMapper postMapper;
+
+ @Autowired
+ private SysUserPostMapper userPostMapper;
+
+ @Autowired
+ private SysUserRoleMapper userRoleMapper;
+
+ @Autowired
+ private ISysConfigService configService;
+
+ @Autowired
+ protected Validator validator;
+
+ /**
+ * 根据条件分页查询用户列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectUserList(SysUser user)
+ {
+ return userMapper.selectUserList(user);
+ }
+
+ /**
+ * 根据条件分页查询已分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectAllocatedList(SysUser user)
+ {
+ return userMapper.selectAllocatedList(user);
+ }
+
+ /**
+ * 根据条件分页查询未分配用户角色列表
+ *
+ * @param user 用户信息
+ * @return 用户信息集合信息
+ */
+ @Override
+ @DataScope(deptAlias = "d", userAlias = "u")
+ public List selectUnallocatedList(SysUser user)
+ {
+ return userMapper.selectUnallocatedList(user);
+ }
+
+ /**
+ * 通过用户名查询用户
+ *
+ * @param userName 用户名
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserByLoginName(String userName)
+ {
+ return userMapper.selectUserByLoginName(userName);
+ }
+
+ /**
+ * 通过手机号码查询用户
+ *
+ * @param phoneNumber 手机号码
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserByPhoneNumber(String phoneNumber)
+ {
+ return userMapper.selectUserByPhoneNumber(phoneNumber);
+ }
+
+ /**
+ * 通过邮箱查询用户
+ *
+ * @param email 邮箱
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserByEmail(String email)
+ {
+ return userMapper.selectUserByEmail(email);
+ }
+
+ /**
+ * 通过用户ID查询用户
+ *
+ * @param userId 用户ID
+ * @return 用户对象信息
+ */
+ @Override
+ public SysUser selectUserById(Long userId)
+ {
+ return userMapper.selectUserById(userId);
+ }
+
+ /**
+ * 通过用户ID查询用户和角色关联
+ *
+ * @param userId 用户ID
+ * @return 用户和角色关联列表
+ */
+ @Override
+ public List selectUserRoleByUserId(Long userId)
+ {
+ return userRoleMapper.selectUserRoleByUserId(userId);
+ }
+
+ /**
+ * 通过用户ID删除用户
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int deleteUserById(Long userId)
+ {
+ // 删除用户与角色关联
+ userRoleMapper.deleteUserRoleByUserId(userId);
+ // 删除用户与岗位表
+ userPostMapper.deleteUserPostByUserId(userId);
+ return userMapper.deleteUserById(userId);
+ }
+
+ /**
+ * 批量删除用户信息
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int deleteUserByIds(String ids)
+ {
+ Long[] userIds = Convert.toLongArray(ids);
+ for (Long userId : userIds)
+ {
+ checkUserAllowed(new SysUser(userId));
+ }
+ // 删除用户与角色关联
+ userRoleMapper.deleteUserRole(userIds);
+ // 删除用户与岗位关联
+ userPostMapper.deleteUserPost(userIds);
+ return userMapper.deleteUserByIds(userIds);
+ }
+
+ /**
+ * 新增保存用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int insertUser(SysUser user)
+ {
+ // 新增用户信息
+ int rows = userMapper.insertUser(user);
+ // 新增用户岗位关联
+ insertUserPost(user);
+ // 新增用户与角色管理
+ insertUserRole(user.getUserId(), user.getRoleIds());
+ return rows;
+ }
+
+ /**
+ * 注册用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public boolean registerUser(SysUser user)
+ {
+ user.setUserType(UserConstants.REGISTER_USER_TYPE);
+ return userMapper.insertUser(user) > 0;
+ }
+
+ /**
+ * 修改保存用户信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ @Transactional
+ public int updateUser(SysUser user)
+ {
+ Long userId = user.getUserId();
+ // 删除用户与角色关联
+ userRoleMapper.deleteUserRoleByUserId(userId);
+ // 新增用户与角色管理
+ insertUserRole(user.getUserId(), user.getRoleIds());
+ // 删除用户与岗位关联
+ userPostMapper.deleteUserPostByUserId(userId);
+ // 新增用户与岗位管理
+ insertUserPost(user);
+ return userMapper.updateUser(user);
+ }
+
+ /**
+ * 修改用户个人详细信息
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int updateUserInfo(SysUser user)
+ {
+ return userMapper.updateUser(user);
+ }
+
+ /**
+ * 用户授权角色
+ *
+ * @param userId 用户ID
+ * @param roleIds 角色组
+ */
+ @Override
+ @Transactional
+ public void insertUserAuth(Long userId, Long[] roleIds)
+ {
+ userRoleMapper.deleteUserRoleByUserId(userId);
+ insertUserRole(userId, roleIds);
+ }
+
+ /**
+ * 修改用户密码
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int resetUserPwd(SysUser user)
+ {
+ return updateUserInfo(user);
+ }
+
+ /**
+ * 新增用户角色信息
+ *
+ * @param userId 用户ID
+ * @param roleIds 角色组
+ */
+ public void insertUserRole(Long userId, Long[] roleIds)
+ {
+ if (StringUtils.isNotNull(roleIds))
+ {
+ // 新增用户与角色管理
+ List list = new ArrayList();
+ for (Long roleId : roleIds)
+ {
+ SysUserRole ur = new SysUserRole();
+ ur.setUserId(userId);
+ ur.setRoleId(roleId);
+ list.add(ur);
+ }
+ if (list.size() > 0)
+ {
+ userRoleMapper.batchUserRole(list);
+ }
+ }
+ }
+
+ /**
+ * 新增用户岗位信息
+ *
+ * @param user 用户对象
+ */
+ public void insertUserPost(SysUser user)
+ {
+ Long[] posts = user.getPostIds();
+ if (StringUtils.isNotNull(posts))
+ {
+ // 新增用户与岗位管理
+ List list = new ArrayList();
+ for (Long postId : posts)
+ {
+ SysUserPost up = new SysUserPost();
+ up.setUserId(user.getUserId());
+ up.setPostId(postId);
+ list.add(up);
+ }
+ if (list.size() > 0)
+ {
+ userPostMapper.batchUserPost(list);
+ }
+ }
+ }
+
+ /**
+ * 校验登录名称是否唯一
+ *
+ * @param loginName 用户名
+ * @return
+ */
+ @Override
+ public String checkLoginNameUnique(String loginName)
+ {
+ int count = userMapper.checkLoginNameUnique(loginName);
+ if (count > 0)
+ {
+ return UserConstants.USER_NAME_NOT_UNIQUE;
+ }
+ return UserConstants.USER_NAME_UNIQUE;
+ }
+
+ /**
+ * 校验手机号码是否唯一
+ *
+ * @param user 用户信息
+ * @return
+ */
+ @Override
+ public String checkPhoneUnique(SysUser user)
+ {
+ Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
+ SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
+ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
+ {
+ return UserConstants.USER_PHONE_NOT_UNIQUE;
+ }
+ return UserConstants.USER_PHONE_UNIQUE;
+ }
+
+ /**
+ * 校验email是否唯一
+ *
+ * @param user 用户信息
+ * @return
+ */
+ @Override
+ public String checkEmailUnique(SysUser user)
+ {
+ Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
+ SysUser info = userMapper.checkEmailUnique(user.getEmail());
+ if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
+ {
+ return UserConstants.USER_EMAIL_NOT_UNIQUE;
+ }
+ return UserConstants.USER_EMAIL_UNIQUE;
+ }
+
+ /**
+ * 校验用户是否允许操作
+ *
+ * @param user 用户信息
+ */
+ @Override
+ public void checkUserAllowed(SysUser user)
+ {
+ if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
+ {
+ throw new ServiceException("不允许操作超级管理员用户");
+ }
+ }
+
+ /**
+ * 校验用户是否有数据权限
+ *
+ * @param userId 用户id
+ */
+ @Override
+ public void checkUserDataScope(Long userId)
+ {
+ if (!SysUser.isAdmin(ShiroUtils.getUserId()))
+ {
+ SysUser user = new SysUser();
+ user.setUserId(userId);
+ List users = SpringUtils.getAopProxy(this).selectUserList(user);
+ if (StringUtils.isEmpty(users))
+ {
+ throw new ServiceException("没有权限访问用户数据!");
+ }
+ }
+ }
+
+ /**
+ * 查询用户所属角色组
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ @Override
+ public String selectUserRoleGroup(Long userId)
+ {
+ List list = roleMapper.selectRolesByUserId(userId);
+ if (CollectionUtils.isEmpty(list))
+ {
+ return StringUtils.EMPTY;
+ }
+ return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
+ }
+
+ /**
+ * 查询用户所属岗位组
+ *
+ * @param userId 用户ID
+ * @return 结果
+ */
+ @Override
+ public String selectUserPostGroup(Long userId)
+ {
+ List list = postMapper.selectPostsByUserId(userId);
+ if (CollectionUtils.isEmpty(list))
+ {
+ return StringUtils.EMPTY;
+ }
+ return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
+ }
+
+ /**
+ * 导入用户数据
+ *
+ * @param userList 用户数据列表
+ * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
+ * @param operName 操作用户
+ * @return 结果
+ */
+ @Override
+ public String importUser(List userList, Boolean isUpdateSupport, String operName)
+ {
+ if (StringUtils.isNull(userList) || userList.size() == 0)
+ {
+ throw new ServiceException("导入用户数据不能为空!");
+ }
+ int successNum = 0;
+ int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ String password = configService.selectConfigByKey("sys.user.initPassword");
+ for (SysUser user : userList)
+ {
+ try
+ {
+ // 验证是否存在这个用户
+ SysUser u = userMapper.selectUserByLoginName(user.getLoginName());
+ if (StringUtils.isNull(u))
+ {
+ BeanValidators.validateWithException(validator, user);
+ user.setPassword(Md5Utils.hash(user.getLoginName() + password));
+ user.setCreateBy(operName);
+ this.insertUser(user);
+ successNum++;
+ successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 导入成功");
+ }
+ else if (isUpdateSupport)
+ {
+ BeanValidators.validateWithException(validator, user);
+ user.setUpdateBy(operName);
+ this.updateUser(user);
+ successNum++;
+ successMsg.append("
" + successNum + "、账号 " + user.getLoginName() + " 更新成功");
+ }
+ else
+ {
+ failureNum++;
+ failureMsg.append("
" + failureNum + "、账号 " + user.getLoginName() + " 已存在");
+ }
+ }
+ catch (Exception e)
+ {
+ failureNum++;
+ String msg = "
" + failureNum + "、账号 " + user.getLoginName() + " 导入失败:";
+ failureMsg.append(msg + e.getMessage());
+ log.error(msg, e);
+ }
+ }
+ if (failureNum > 0)
+ {
+ failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
+ throw new ServiceException(failureMsg.toString());
+ }
+ else
+ {
+ successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
+ }
+ return successMsg.toString();
+ }
+
+ /**
+ * 用户状态修改
+ *
+ * @param user 用户信息
+ * @return 结果
+ */
+ @Override
+ public int changeStatus(SysUser user)
+ {
+ return userMapper.updateUser(user);
+ }
+}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SSMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SSMapper.xml
new file mode 100644
index 0000000..aabb3e0
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SSMapper.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
new file mode 100644
index 0000000..2142303
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
+ from sys_config
+
+
+
+
+
+
+ and config_id = #{configId}
+
+
+ and config_key = #{configKey}
+
+
+
+
+
+
+
+
+
+
+
+ insert into sys_config (
+ config_name,
+ config_key,
+ config_value,
+ config_type,
+ create_by,
+ remark,
+ create_time
+ )values(
+ #{configName},
+ #{configKey},
+ #{configValue},
+ #{configType},
+ #{createBy},
+ #{remark},
+ sysdate()
+ )
+
+
+
+ update sys_config
+
+ config_name = #{configName},
+ config_key = #{configKey},
+ config_value = #{configValue},
+ config_type = #{configType},
+ update_by = #{updateBy},
+ remark = #{remark},
+ update_time = sysdate()
+
+ where config_id = #{configId}
+
+
+
+ delete from sys_config where config_id = #{configId}
+
+
+
+ delete from sys_config where config_id in
+
+ #{configId}
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
new file mode 100644
index 0000000..2f0df5c
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
+ from sys_dept d
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into sys_dept(
+ dept_id,
+ parent_id,
+ dept_name,
+ ancestors,
+ order_num,
+ leader,
+ phone,
+ email,
+ status,
+ create_by,
+ create_time
+ )values(
+ #{deptId},
+ #{parentId},
+ #{deptName},
+ #{ancestors},
+ #{orderNum},
+ #{leader},
+ #{phone},
+ #{email},
+ #{status},
+ #{createBy},
+ sysdate()
+ )
+
+
+
+ update sys_dept
+
+ parent_id = #{parentId},
+ dept_name = #{deptName},
+ ancestors = #{ancestors},
+ order_num = #{orderNum},
+ leader = #{leader},
+ phone = #{phone},
+ email = #{email},
+ status = #{status},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where dept_id = #{deptId}
+
+
+
+ update sys_dept set ancestors =
+
+ when #{item.deptId} then #{item.ancestors}
+
+ where dept_id in
+
+ #{item.deptId}
+
+
+
+
+ update sys_dept set del_flag = '2' where dept_id = #{deptId}
+
+
+
+ update sys_dept set status = '0' where dept_id in
+
+ #{deptId}
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
new file mode 100644
index 0000000..b26e075
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
+ from sys_dict_data
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from sys_dict_data where dict_code = #{dictCode}
+
+
+
+ delete from sys_dict_data where dict_code in
+
+ #{dictCode}
+
+
+
+
+ update sys_dict_data
+
+ dict_sort = #{dictSort},
+ dict_label = #{dictLabel},
+ dict_value = #{dictValue},
+ dict_type = #{dictType},
+ css_class = #{cssClass},
+ list_class = #{listClass},
+ is_default = #{isDefault},
+ status = #{status},
+ remark = #{remark},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where dict_code = #{dictCode}
+
+
+
+ update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
+
+
+
+ insert into sys_dict_data(
+ dict_sort,
+ dict_label,
+ dict_value,
+ dict_type,
+ css_class,
+ list_class,
+ is_default,
+ status,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{dictSort},
+ #{dictLabel},
+ #{dictValue},
+ #{dictType},
+ #{cssClass},
+ #{listClass},
+ #{isDefault},
+ #{status},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
new file mode 100644
index 0000000..15de8cc
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select dict_id, dict_name, dict_type, status, create_by, create_time, remark
+ from sys_dict_type
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from sys_dict_type where dict_id = #{dictId}
+
+
+
+ delete from sys_dict_type where dict_id in
+
+ #{dictId}
+
+
+
+
+ update sys_dict_type
+
+ dict_name = #{dictName},
+ dict_type = #{dictType},
+ status = #{status},
+ remark = #{remark},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where dict_id = #{dictId}
+
+
+
+ insert into sys_dict_type(
+ dict_name,
+ dict_type,
+ status,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{dictName},
+ #{dictType},
+ #{status},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
new file mode 100644
index 0000000..cd42fff
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into sys_logininfor (login_name, status, ipaddr, login_location, browser, os, msg, login_time)
+ values (#{loginName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
+
+
+
+
+
+ delete from sys_logininfor where info_id in
+
+ #{infoId}
+
+
+
+
+ truncate table sys_logininfor
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
new file mode 100644
index 0000000..f9af0dc
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
new file mode 100644
index 0000000..5883573
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark
+ from sys_notice
+
+
+
+
+
+
+
+ insert into sys_notice (
+ notice_title,
+ notice_type,
+ notice_content,
+ status,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{noticeTitle},
+ #{noticeType},
+ #{noticeContent},
+ #{status},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
+ update sys_notice
+
+ notice_title = #{noticeTitle},
+ notice_type = #{noticeType},
+ notice_content = #{noticeContent},
+ status = #{status},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where notice_id = #{noticeId}
+
+
+
+ delete from sys_notice where notice_id in
+
+ #{noticeId}
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
new file mode 100644
index 0000000..4634551
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
+ from sys_oper_log
+
+
+
+ insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
+ values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
+
+
+
+
+
+ delete from sys_oper_log where oper_id in
+
+ #{operId}
+
+
+
+
+
+
+ truncate table sys_oper_log
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
new file mode 100644
index 0000000..86e4751
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
+ from sys_post
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from sys_post where post_id in
+
+ #{postId}
+
+
+
+
+ update sys_post
+
+ post_code = #{postCode},
+ post_name = #{postName},
+ post_sort = #{postSort},
+ status = #{status},
+ remark = #{remark},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where post_id = #{postId}
+
+
+
+ insert into sys_post(
+ post_id,
+ post_code,
+ post_name,
+ post_sort,
+ status,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{postId},
+ #{postCode},
+ #{postName},
+ #{postSort},
+ #{status},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
new file mode 100644
index 0000000..7c4139b
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+ delete from sys_role_dept where role_id=#{roleId}
+
+
+
+
+
+ delete from sys_role_dept where role_id in
+
+ #{roleId}
+
+
+
+
+ insert into sys_role_dept(role_id, dept_id) values
+
+ (#{item.roleId},#{item.deptId})
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
new file mode 100644
index 0000000..4422bb0
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope,
+ r.status, r.del_flag, r.create_time, r.remark
+ from sys_role r
+ left join sys_user_role ur on ur.role_id = r.role_id
+ left join sys_user u on u.user_id = ur.user_id
+ left join sys_dept d on u.dept_id = d.dept_id
+
+
+
+ select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, r.del_flag, r.create_time, r.remark
+ from sys_role r
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update sys_role set del_flag = '2' where role_id = #{roleId}
+
+
+
+ update sys_role set del_flag = '2' where role_id in
+
+ #{roleId}
+
+
+
+
+ update sys_role
+
+ role_name = #{roleName},
+ role_key = #{roleKey},
+ role_sort = #{roleSort},
+ data_scope = #{dataScope},
+ status = #{status},
+ remark = #{remark},
+ update_by = #{updateBy},
+ update_time = sysdate()
+
+ where role_id = #{roleId}
+
+
+
+ insert into sys_role(
+ role_id,
+ role_name,
+ role_key,
+ role_sort,
+ data_scope,
+ status,
+ remark,
+ create_by,
+ create_time
+ )values(
+ #{roleId},
+ #{roleName},
+ #{roleKey},
+ #{roleSort},
+ #{dataScope},
+ #{status},
+ #{remark},
+ #{createBy},
+ sysdate()
+ )
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
new file mode 100644
index 0000000..d213bdd
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
new file mode 100644
index 0000000..9fc35c9
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_time, u.remark,
+ d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
+ r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
+ from sys_user u
+ left join sys_dept d on u.dept_id = d.dept_id
+ left join sys_user_role ur on u.user_id = ur.user_id
+ left join sys_role r on r.role_id = ur.role_id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update sys_user set del_flag = '2' where user_id = #{userId}
+
+
+
+ update sys_user set del_flag = '2' where user_id in
+
+ #{userId}
+
+
+
+
+ update sys_user
+
+ dept_id = #{deptId},
+ login_name = #{loginName},
+ user_name = #{userName},
+ user_type = #{userType},
+ email = #{email},
+ phonenumber = #{phonenumber},
+ sex = #{sex},
+ avatar = #{avatar},
+ password = #{password},
+ salt = #{salt},
+ status = #{status},
+ login_ip = #{loginIp},
+ login_date = #{loginDate},
+ pwd_update_date = #{pwdUpdateDate},
+ update_by = #{updateBy},
+ remark = #{remark},
+ update_time = sysdate()
+
+ where user_id = #{userId}
+
+
+
+ insert into sys_user(
+ user_id,
+ dept_id,
+ login_name,
+ user_name,
+ user_type,
+ email,
+ avatar,
+ phonenumber,
+ sex,
+ password,
+ salt,
+ status,
+ pwd_update_date,
+ create_by,
+ remark,
+ create_time
+ )values(
+ #{userId},
+ #{deptId},
+ #{loginName},
+ #{userName},
+ #{userType},
+ #{email},
+ #{avatar},
+ #{phonenumber},
+ #{sex},
+ #{password},
+ #{salt},
+ #{status},
+ #{pwdUpdateDate},
+ #{createBy},
+ #{remark},
+ sysdate()
+ )
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml
new file mode 100644
index 0000000..ff85fd8
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time
+ from sys_user_online
+
+
+
+
+
+ replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time)
+ values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime})
+
+
+
+ delete from sys_user_online where sessionId = #{sessionId}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
new file mode 100644
index 0000000..2b90bc4
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+ delete from sys_user_post where user_id=#{userId}
+
+
+
+
+
+ delete from sys_user_post where user_id in
+
+ #{userId}
+
+
+
+
+ insert into sys_user_post(user_id, post_id) values
+
+ (#{item.userId},#{item.postId})
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
new file mode 100644
index 0000000..7606692
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from sys_user_role where user_id = #{userId}
+
+
+
+
+
+ delete from sys_user_role where user_id in
+
+ #{userId}
+
+
+
+
+ insert into sys_user_role(user_id, role_id) values
+
+ (#{item.userId},#{item.roleId})
+
+
+
+
+ delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
+
+
+
+ delete from sys_user_role where role_id=#{roleId} and user_id in
+
+ #{userId}
+
+
+
\ No newline at end of file