From f42983b35c738a28ed4b9d1732d1045c5f2a19bb Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期日, 09 五月 2021 16:57:12 +0800
Subject: [PATCH] 优化代码
---
java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml | 36 ++++++++++++++++++++++++++++--------
1 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml b/java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml
old mode 100644
new mode 100755
index df012b2..2012122
--- a/java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/center/PrivilegeDAOImplMapper.xml
@@ -14,7 +14,11 @@
<!-- 淇濆瓨灞炴�т俊鎭� c_business_attrs -->
<insert id="saveUserDefaultPrivilege" parameterType="Map">
<![CDATA[
- INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},'1',#{userId},#{storeId})
+
+
+ INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},'1',#{userId},#{storeId})
+
+
]]>
</insert>
@@ -149,7 +153,11 @@
<!-- 淇濆瓨灞炴�т俊鎭� c_business_attrs -->
<insert id="addUserPrivilege" parameterType="Map">
<![CDATA[
- INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},#{privilegeFlag},#{userId},#{storeId})
+
+
+ INSERT INTO p_privilege_user(p_id,privilege_flag,user_id,store_id) VALUES(#{pId},#{privilegeFlag},#{userId},#{storeId})
+
+
]]>
</insert>
@@ -170,19 +178,31 @@
</update>
<select id="queryPrivilegeUsers" parameterType="map" resultType="map">
- select t.user_id userId from p_privilege_user t
+ select t.user_id userId
+ from p_privilege_user t
+ INNER JOIN p_privilege p on t.p_id = p.p_id and p.status_cd = '0'
where t.privilege_flag = '0'
and t.status_cd = '0'
- and t.p_id = #{pId}
- and t.store_id = #{storeId}
+ <if test="resource != null and resource != ''">
+ and p.resource = #{resource}
+ </if>
+ <if test="storeId != null and storeId != ''">
+ and t.store_id = #{storeId}
+ </if>
union ALL
- select t.user_id userId from p_privilege_user t
+ select t.user_id userId
+ from p_privilege_user t
inner join p_privilege_group pg on t.p_id = pg.pg_id and pg.status_cd = '0' and pg.pg_id != '600201904002'
inner join p_privilege_rel pr on pg.pg_id = pr.pg_id and pr.status_cd ='0'
+ INNER JOIN p_privilege p on pr.p_id = p.p_id and p.status_cd = '0'
where t.status_cd = '0'
and t.privilege_flag = '1'
- and pr.p_id = #{pId}
- and t.store_id = #{storeId}
+ <if test="resource != null and resource != ''">
+ and p.resource = #{resource}
+ </if>
+ <if test="storeId != null and storeId != ''">
+ and t.store_id = #{storeId}
+ </if>
</select>
</mapper>
--
Gitblit v1.8.0