|
@@ -68,7 +68,13 @@
|
|
</select>
|
|
</select>
|
|
<select id="getRoleList" resultType="com.caimei.model.po.SysRole">
|
|
<select id="getRoleList" resultType="com.caimei.model.po.SysRole">
|
|
SELECT r.id, r.role_name AS roleName, r.role_desc AS roleDesc, r.create_time AS createTime, r.update_time AS updateTime, del_flag AS delFlag
|
|
SELECT r.id, r.role_name AS roleName, r.role_desc AS roleDesc, r.create_time AS createTime, r.update_time AS updateTime, del_flag AS delFlag
|
|
- FROM auth_role r WHERE r.del_flag = 0 and role_type = 1
|
|
|
|
|
|
+ FROM auth_role r WHERE r.del_flag = 0
|
|
|
|
+ <if test="authUserId == null">
|
|
|
|
+ and role_type = 1
|
|
|
|
+ </if>
|
|
|
|
+ <if test="authUserId != null">
|
|
|
|
+ and role_type = 2 and authUserId = #{authUserId}
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
<select id="getRole" resultType="com.caimei.model.po.SysRole">
|
|
<select id="getRole" resultType="com.caimei.model.po.SysRole">
|
|
SELECT r.id, r.role_name AS roleName, r.role_desc AS roleDesc, r.create_time AS createTime, r.update_time AS updateTime, del_flag AS delFlag
|
|
SELECT r.id, r.role_name AS roleName, r.role_desc AS roleDesc, r.create_time AS createTime, r.update_time AS updateTime, del_flag AS delFlag
|
|
@@ -216,7 +222,7 @@
|
|
SELECT id FROM auth_permission WHERE menu_id = #{menuId}
|
|
SELECT id FROM auth_permission WHERE menu_id = #{menuId}
|
|
</select>
|
|
</select>
|
|
<select id="findByUserId" resultType="com.caimei.model.po.SysUser">
|
|
<select id="findByUserId" resultType="com.caimei.model.po.SysUser">
|
|
- select authUserId as id from cm_brand_auth_user where authUserId = #{authUserId} and status = 1
|
|
|
|
|
|
+ select authUserId as id, userIdentity, parentId from cm_brand_auth_user where authUserId = #{authUserId} and status = 1
|
|
</select>
|
|
</select>
|
|
<select id="getVipRoleIdByMenuId" resultType="java.lang.Integer">
|
|
<select id="getVipRoleIdByMenuId" resultType="java.lang.Integer">
|
|
select role_id
|
|
select role_id
|
|
@@ -229,35 +235,44 @@
|
|
limit 1
|
|
limit 1
|
|
</select>
|
|
</select>
|
|
<select id="getUserList" resultType="com.caimei.model.po.SysUser">
|
|
<select id="getUserList" resultType="com.caimei.model.po.SysUser">
|
|
- SELECT u.authUserId as id, u.name as username, u.linkMan, u.mobile, u.createTime, u.status,u.createBy
|
|
|
|
|
|
+ SELECT u.authUserId as id, u.userIdentity, u.parentId, u.name as username, u.linkMan, u.mobile, u.createTime, u.status,u.createBy
|
|
FROM cm_brand_auth_user u
|
|
FROM cm_brand_auth_user u
|
|
- where userIdentity = 1
|
|
|
|
- <if test="username != null and username != ''">
|
|
|
|
- AND u.name like concat('%',#{username},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="linkMan != null and linkMan != ''">
|
|
|
|
- AND u.linkMan like concat('%',#{fullName},'%')
|
|
|
|
- </if>
|
|
|
|
|
|
+ <where>
|
|
|
|
+ <if test="authUserId != null">
|
|
|
|
+ and u.authUserId = #{authUserId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="authUserId == null">
|
|
|
|
+ and u.userIdentity = 1
|
|
|
|
+ </if>
|
|
|
|
+ <if test="username != null and username != ''">
|
|
|
|
+ AND u.name like concat('%',#{username},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="linkMan != null and linkMan != ''">
|
|
|
|
+ AND u.linkMan like concat('%',#{fullName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
</select>
|
|
</select>
|
|
<select id="getVipMenuList" resultType="com.caimei.model.po.SysMenu">
|
|
<select id="getVipMenuList" resultType="com.caimei.model.po.SysMenu">
|
|
select m.title, arm.role_id as roleId
|
|
select m.title, arm.role_id as roleId
|
|
from auth_menu m
|
|
from auth_menu m
|
|
left join auth_role_menu arm on m.id = arm.menu_id
|
|
left join auth_role_menu arm on m.id = arm.menu_id
|
|
|
|
+ left join auth_role r on arm.role_id = r.id
|
|
where menu_type = 2
|
|
where menu_type = 2
|
|
and base_flag = 0
|
|
and base_flag = 0
|
|
and status = 0
|
|
and status = 0
|
|
and m.parent_id = 0
|
|
and m.parent_id = 0
|
|
|
|
+ and r.authUserId is null
|
|
</select>
|
|
</select>
|
|
<select id="getVipRoleIdList" resultType="java.lang.Integer">
|
|
<select id="getVipRoleIdList" resultType="java.lang.Integer">
|
|
select role_id from auth_role_user where user_id = #{authUserId}
|
|
select role_id from auth_role_user where user_id = #{authUserId}
|
|
</select>
|
|
</select>
|
|
<select id="getUser" resultType="com.caimei.model.po.SysUser">
|
|
<select id="getUser" resultType="com.caimei.model.po.SysUser">
|
|
- select authUserId as id, name as username, mobile, linkMan, password,status
|
|
|
|
|
|
+ select authUserId as id, userIdentity, parentId, name as username, mobile, linkMan, password,status
|
|
from cm_brand_auth_user
|
|
from cm_brand_auth_user
|
|
where authUserId = #{id}
|
|
where authUserId = #{id}
|
|
</select>
|
|
</select>
|
|
<select id="findByUsername" resultType="com.caimei.model.po.SysUser">
|
|
<select id="findByUsername" resultType="com.caimei.model.po.SysUser">
|
|
- select authUserId as id from cm_brand_auth_user where name = #{username}
|
|
|
|
|
|
+ select authUserId as id from cm_brand_auth_user where name = #{username} and userIdentity = #{userIdentity}
|
|
</select>
|
|
</select>
|
|
<select id="getMenuParentId" resultType="java.lang.Integer">
|
|
<select id="getMenuParentId" resultType="java.lang.Integer">
|
|
select parent_id from auth_menu where id = #{id}
|
|
select parent_id from auth_menu where id = #{id}
|
|
@@ -274,6 +289,28 @@
|
|
</if>
|
|
</if>
|
|
ORDER BY m.sort
|
|
ORDER BY m.sort
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="getShopRoleList" resultType="com.caimei.model.po.SysRole">
|
|
|
|
+ select * from auth_role where authUserId = #{authUserId}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getBaseMenuList" resultType="com.caimei.model.po.SysMenu">
|
|
|
|
+ select m.id, m.title,m.base_flag as baseFlag, m.move_flag as moveFlag, m.status
|
|
|
|
+ from auth_menu m
|
|
|
|
+ left join auth_role_menu arm on m.id = arm.menu_id
|
|
|
|
+ where m.menu_type = 2
|
|
|
|
+ and m.base_flag = 1
|
|
|
|
+ and m.parent_id = 0
|
|
|
|
+ and arm.role_id = #{roleId}
|
|
|
|
+ </select>
|
|
|
|
+ <select id="getShopRoleIdByMenuId" resultType="java.lang.Integer">
|
|
|
|
+ select role_id
|
|
|
|
+ from auth_role_menu arm
|
|
|
|
+ left join auth_role r on arm.role_id = r.id
|
|
|
|
+ where menu_id = #{menuId}
|
|
|
|
+ and role_id != 2
|
|
|
|
+ and role_type = 2
|
|
|
|
+ and r.id is not null
|
|
|
|
+ limit 1
|
|
|
|
+ </select>
|
|
<update id="updatePermission">
|
|
<update id="updatePermission">
|
|
UPDATE auth_permission SET name=#{name}, title=#{title}, menu_id = #{menuId}
|
|
UPDATE auth_permission SET name=#{name}, title=#{title}, menu_id = #{menuId}
|
|
WHERE id = #{id}
|
|
WHERE id = #{id}
|
|
@@ -288,6 +325,11 @@
|
|
<update id="updateShopMenu">
|
|
<update id="updateShopMenu">
|
|
update auth_menu set base_flag = #{baseFlag},status = #{status} where id = #{id}
|
|
update auth_menu set base_flag = #{baseFlag},status = #{status} where id = #{id}
|
|
</update>
|
|
</update>
|
|
|
|
+ <update id="updateUserStatus">
|
|
|
|
+ update cm_brand_auth_user
|
|
|
|
+ set status = #{status}
|
|
|
|
+ where authUserId = #{id}
|
|
|
|
+ </update>
|
|
<delete id="deletePermission">
|
|
<delete id="deletePermission">
|
|
DELETE FROM auth_permission WHERE id = #{id}
|
|
DELETE FROM auth_permission WHERE id = #{id}
|
|
</delete>
|
|
</delete>
|
|
@@ -313,13 +355,16 @@
|
|
<delete id="deleteMenuRoleRelation">
|
|
<delete id="deleteMenuRoleRelation">
|
|
delete from auth_role_menu where menu_id = #{menuId}
|
|
delete from auth_role_menu where menu_id = #{menuId}
|
|
</delete>
|
|
</delete>
|
|
|
|
+ <delete id="deleteVipRelation">
|
|
|
|
+ delete
|
|
|
|
+ </delete>
|
|
<insert id="insertPermission" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
|
<insert id="insertPermission" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
|
|
INSERT INTO auth_permission(title, name, menu_id)
|
|
INSERT INTO auth_permission(title, name, menu_id)
|
|
VALUES (#{title}, #{name}, #{menuId})
|
|
VALUES (#{title}, #{name}, #{menuId})
|
|
</insert>
|
|
</insert>
|
|
- <insert id="insertAdminUser" keyProperty="id" keyColumn="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.SysUser">
|
|
|
|
|
|
+ <insert id="insertUser" keyProperty="id" keyColumn="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.SysUser">
|
|
insert into cm_brand_auth_user (name, mobile, password, linkMan, userIdentity, createTime, createBy,
|
|
insert into cm_brand_auth_user (name, mobile, password, linkMan, userIdentity, createTime, createBy,
|
|
status)
|
|
status)
|
|
- values (#{username}, #{mobile}, #{password}, #{linkMan}, 1, NOW(), #{createBy}, 1)
|
|
|
|
|
|
+ values (#{username}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, NOW(), #{createBy}, 1)
|
|
</insert>
|
|
</insert>
|
|
</mapper>
|
|
</mapper>
|