parent
8be96df11e
commit
c5236ad07e
@ -0,0 +1,118 @@ |
||||
package edu.ncst.award.common.constant; |
||||
|
||||
/** |
||||
* 用户常量信息 |
||||
* |
||||
* @author ruoyi |
||||
*/ |
||||
public interface UserConstants { |
||||
|
||||
/** |
||||
* 平台内系统用户的唯一标志 |
||||
*/ |
||||
String SYS_USER = "SYS_USER"; |
||||
|
||||
/** |
||||
* 正常状态 |
||||
*/ |
||||
String NORMAL = "0"; |
||||
|
||||
/** |
||||
* 异常状态 |
||||
*/ |
||||
String EXCEPTION = "1"; |
||||
|
||||
/** |
||||
* 用户封禁状态 |
||||
*/ |
||||
String USER_DISABLE = "1"; |
||||
|
||||
/** |
||||
* 角色封禁状态 |
||||
*/ |
||||
String ROLE_DISABLE = "1"; |
||||
|
||||
/** |
||||
* 部门正常状态 |
||||
*/ |
||||
String DEPT_NORMAL = "0"; |
||||
|
||||
/** |
||||
* 部门停用状态 |
||||
*/ |
||||
String DEPT_DISABLE = "1"; |
||||
|
||||
/** |
||||
* 字典正常状态 |
||||
*/ |
||||
String DICT_NORMAL = "0"; |
||||
|
||||
/** |
||||
* 是否为系统默认(是) |
||||
*/ |
||||
String YES = "Y"; |
||||
|
||||
/** |
||||
* 是否菜单外链(是) |
||||
*/ |
||||
String YES_FRAME = "0"; |
||||
|
||||
/** |
||||
* 是否菜单外链(否) |
||||
*/ |
||||
String NO_FRAME = "1"; |
||||
|
||||
/** |
||||
* 菜单类型(目录) |
||||
*/ |
||||
String TYPE_DIR = "M"; |
||||
|
||||
/** |
||||
* 菜单类型(菜单) |
||||
*/ |
||||
String TYPE_MENU = "C"; |
||||
|
||||
/** |
||||
* 菜单类型(按钮) |
||||
*/ |
||||
String TYPE_BUTTON = "F"; |
||||
|
||||
/** |
||||
* Layout组件标识 |
||||
*/ |
||||
String LAYOUT = "Layout"; |
||||
|
||||
/** |
||||
* ParentView组件标识 |
||||
*/ |
||||
String PARENT_VIEW = "ParentView"; |
||||
|
||||
/** |
||||
* InnerLink组件标识 |
||||
*/ |
||||
String INNER_LINK = "InnerLink"; |
||||
|
||||
/** |
||||
* 校验返回结果码 |
||||
*/ |
||||
String UNIQUE = "0"; |
||||
String NOT_UNIQUE = "1"; |
||||
|
||||
/** |
||||
* 用户名长度限制 |
||||
*/ |
||||
int USERNAME_MIN_LENGTH = 2; |
||||
int USERNAME_MAX_LENGTH = 20; |
||||
|
||||
/** |
||||
* 密码长度限制 |
||||
*/ |
||||
int PASSWORD_MIN_LENGTH = 5; |
||||
int PASSWORD_MAX_LENGTH = 20; |
||||
|
||||
/** |
||||
* 管理员ID |
||||
*/ |
||||
Long ADMIN_ID = 1L; |
||||
|
||||
} |
||||
@ -0,0 +1,100 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
||||
<mapper namespace="edu.ncst.award.mapper.system.UserMapper"> |
||||
|
||||
<resultMap type="edu.ncst.award.model.system.User" id="SysUserResult"> |
||||
<id property="id" column="id"/> |
||||
<result property="deptId" column="dept_id"/> |
||||
<result property="username" column="username"/> |
||||
<result property="nickname" column="nickname"/> |
||||
<result property="email" column="email"/> |
||||
<result property="mobilePhone" column="mobile_phone"/> |
||||
<result property="sex" column="sex"/> |
||||
<result property="password" column="password"/> |
||||
<result property="enable" column="enable"/> |
||||
<result property="createUserId" column="create_user_id"/> |
||||
<result property="createTime" column="create_time"/> |
||||
<result property="lastModifyUserId" column="last_modify_user_id"/> |
||||
<result property="lastModifyTime" column="last_modify_time"/> |
||||
<result property="sign" column="sign"/> |
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
||||
</resultMap> |
||||
|
||||
<resultMap id="RoleResult" type="edu.ncst.award.model.system.Role"> |
||||
<id property="roleId" column="id"/> |
||||
<result property="name" column="name"/> |
||||
<result property="enable" column="true"/> |
||||
</resultMap> |
||||
|
||||
<sql id="selectUserVo"> |
||||
SELECT u.`id`, |
||||
u.`dept_id`, |
||||
u.`username`, |
||||
u.`nickname`, |
||||
u.`email`, |
||||
u.`mobile_phone`, |
||||
u.`password`, |
||||
u.`sex`, |
||||
u.`enable`, |
||||
u.`create_user_id`, |
||||
u.`create_time`, |
||||
u.`sign`, |
||||
d.`parent_id`, |
||||
d.`enable` AS dept_status, |
||||
r.`id`, |
||||
r.`name`, |
||||
r.`enable` AS role_status |
||||
FROM sys_user u |
||||
LEFT JOIN sys_dept d ON u.`dept_id` = d.`id` |
||||
LEFT JOIN sys_user_role ur ON u.`id` = ur.`user_id` |
||||
LEFT JOIN sys_role r ON r.`id` = ur.role_id |
||||
</sql> |
||||
|
||||
|
||||
<select id="getUserRolesById" resultType="edu.ncst.award.model.system.Role"> |
||||
SELECT * |
||||
FROM sys_role |
||||
WHERE id in ( |
||||
SELECT `role_id` |
||||
FROM sys_user_role |
||||
INNER JOIN sys_user ON sys_user_role.user_id = sys_user.id |
||||
AND sys_user.id = #{id}) |
||||
</select> |
||||
<select id="selectPageUserList" resultType="edu.ncst.award.model.system.User"> |
||||
select u.id, u.nickname, u.username, u.email, u.mobile_phone, |
||||
u.enable, u.create_time, u.delete_time |
||||
from sys_user u where true |
||||
<if test="user.id != null and user.id != 0"> |
||||
AND u.id = #{user.id} |
||||
</if> |
||||
-- 对userName进行模糊搜索 |
||||
<if test="user.username != null and user.username != ''"> |
||||
AND u.username like concat('%', #{user.username}, '%') |
||||
</if> |
||||
-- 对nickName进行模糊搜索 |
||||
<if test="user.nickname != null and user.nickname != ''"> |
||||
AND u.nickname like concat('%', #{user.nickname}, '%') |
||||
</if> |
||||
<if test="user.enable != null and user.enable != ''"> |
||||
AND u.enable = #{user.enable} |
||||
</if> |
||||
<if test="user.mobilePhone != null and user.mobilePhone != ''"> |
||||
AND u.mobile_phone like concat('%', #{user.mobilePhone}, '%') |
||||
</if> |
||||
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 --> |
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{user.params.beginTime},'%y%m%d') |
||||
</if> |
||||
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 --> |
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{user.params.endTime},'%y%m%d') |
||||
</if> |
||||
-- 等做到权限就有用了 |
||||
<!-- <if test="user.deptId != null and user.deptId != 0">--> |
||||
<!-- AND (u.dept_id = #{user.deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{user.deptId},--> |
||||
<!-- ancestors) ))--> |
||||
<!-- </if>--> |
||||
</select> |
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> |
||||
<include refid="selectUserVo"/> |
||||
where true and u.`id` = #{userId} |
||||
</select> |
||||
</mapper> |
||||
Loading…
Reference in new issue