feat: 初始化
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?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="com.yida.data.auth.mapper.MenuMapper">
|
||||
|
||||
<select id="findUserPermissions" resultType="java.lang.String">
|
||||
select distinct m.perms
|
||||
from t_role r
|
||||
left join t_user_role ur on (r.role_id = ur.role_id)
|
||||
left join t_user u on (u.user_id = ur.user_id)
|
||||
left join t_role_menu rm on (rm.role_id = r.role_id)
|
||||
left join t_menu m on (m.menu_id = rm.menu_id)
|
||||
where u.username = #{userName}
|
||||
and m.perms is not null
|
||||
and m.perms <> ''
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?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="com.yida.data.auth.mapper.UserMapper">
|
||||
<select id="findByName" parameterType="string"
|
||||
resultType="com.yida.data.common.core.entity.system.SystemUser">
|
||||
SELECT u.user_id userId,
|
||||
u.username,
|
||||
u.nickname,
|
||||
u.email,
|
||||
u.mobile,
|
||||
u.password,
|
||||
u.status,
|
||||
u.create_time createTime,
|
||||
u.ssex sex,
|
||||
u.dept_id deptId,
|
||||
u.last_login_time lastLoginTime,
|
||||
u.modify_time modifyTime,
|
||||
u.description,
|
||||
u.avatar,
|
||||
d.dept_type deptType,
|
||||
d.school_nature schoolNature,
|
||||
d.dept_name deptName,
|
||||
u.agent_id agentId,
|
||||
GROUP_CONCAT(r.role_id) roleId,
|
||||
GROUP_CONCAT(r.ROLE_NAME) roleName,
|
||||
GROUP_CONCAT( r.ROLE_PERMS ) rolePerms,
|
||||
u.create_id,
|
||||
u.create_dept_id,
|
||||
u.main_dept_id,
|
||||
u.open_id
|
||||
FROM t_user u
|
||||
LEFT JOIN t_dept d ON (u.dept_id = d.dept_id)
|
||||
LEFT JOIN t_user_role ur ON (u.user_id = ur.user_id)
|
||||
LEFT JOIN t_role r ON r.role_id = ur.role_id
|
||||
WHERE u.username = #{username}
|
||||
group by u.username, u.user_id, u.email, u.mobile, u.password, u.status, u.create_time, u.ssex,
|
||||
u.dept_id
|
||||
, u.last_login_time, u.modify_time, u.description, u.avatar
|
||||
</select>
|
||||
|
||||
<select id="findUserDataPermissions" parameterType="long"
|
||||
resultType="com.yida.data.common.core.entity.system.UserDataPermission">
|
||||
select user_id userId, dept_id deptId
|
||||
from t_user_data_permission
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="listUserByPerms" resultType="com.yida.data.common.core.entity.system.SystemUser">
|
||||
select a.*
|
||||
from t_user a left join t_user_role b on a.USER_ID=b.USER_ID
|
||||
left join t_role c on b.ROLE_ID=c.ROLE_ID
|
||||
where c.ROLE_PERMS=#{perms}
|
||||
<if test="deptId != null">
|
||||
and a.DEPT_ID=#{deptId}
|
||||
</if>
|
||||
order by a.USER_ID
|
||||
</select>
|
||||
|
||||
<!-- 查询主角色code字符串 -->
|
||||
<select id="findMainRole"
|
||||
resultType="java.lang.String">
|
||||
SELECT
|
||||
distinct
|
||||
r.ROLE_PERMS
|
||||
FROM
|
||||
t_user u
|
||||
INNER JOIN t_user_role ur ON u.USER_ID = ur.USER_ID
|
||||
INNER JOIN t_role r ON ur.ROLE_ID = r.ROLE_ID
|
||||
WHERE
|
||||
u.DEPT_ID = #{mainDeptId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="com.yida.data.auth.mapper.UserMenuMapper">
|
||||
|
||||
<select id="findUserPermissions" resultType="com.yida.data.common.core.entity.system.SystemUserMenu">
|
||||
select um.*, m.perms
|
||||
from t_user_menu um
|
||||
left join t_user u on (u.user_id = um.user_id)
|
||||
left join t_menu m on (m.menu_id = um.menu_id)
|
||||
where u.username = #{userName}
|
||||
and m.perms is not null
|
||||
and m.perms <![CDATA[!=]]> ''
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user