RoleCommunityV1ServiceDaoImplMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="roleCommunityV1ServiceDaoImpl">
  6. <!-- 保存项目授权信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveRoleCommunityInfo" parameterType="Map">
  8. insert into u_role_community(
  9. role_id,rc_id,community_id,community_name,store_id
  10. ) values (
  11. #{roleId},#{rcId},#{communityId},#{communityName},#{storeId}
  12. )
  13. </insert>
  14. <!-- 查询项目授权信息 add by wuxw 2018-07-03 -->
  15. <select id="getRoleCommunityInfo" parameterType="Map" resultType="Map">
  16. select t.role_id,t.role_id roleId,t.rc_id,t.rc_id rcId,t.status_cd,t.status_cd
  17. statusCd,t.community_id,t.community_id communityId,t.community_name communityName,t.store_id,t.store_id storeId
  18. from u_role_community t
  19. <if test="staffId != null and staffId != ''">
  20. left join p_privilege_group pg on t.role_id = pg.pg_id and pg.status_cd = '0'
  21. left join p_privilege_user pu on pu.p_id = pg.pg_id and pu.privilege_flag = '1' and pu.status_cd = '0'
  22. </if>
  23. where 1 =1
  24. <if test="staffId != null and staffId != ''">
  25. and pu.user_id = #{staffId}
  26. </if>
  27. <if test="roleId !=null and roleId != ''">
  28. and t.role_id= #{roleId}
  29. </if>
  30. <if test="rcId !=null and rcId != ''">
  31. and t.rc_id= #{rcId}
  32. </if>
  33. <if test="statusCd !=null and statusCd != ''">
  34. and t.status_cd= #{statusCd}
  35. </if>
  36. <if test="communityId !=null and communityId != ''">
  37. and t.community_id= #{communityId}
  38. </if>
  39. <if test="storeId !=null and storeId != ''">
  40. and t.store_id= #{storeId}
  41. </if>
  42. order by t.create_time desc
  43. <if test="page != -1 and page != null ">
  44. limit #{page}, #{row}
  45. </if>
  46. </select>
  47. <!-- 修改项目授权信息 add by wuxw 2018-07-03 -->
  48. <update id="updateRoleCommunityInfo" parameterType="Map">
  49. update u_role_community t set t.status_cd = #{statusCd}
  50. <if test="newBId != null and newBId != ''">
  51. ,t.b_id = #{newBId}
  52. </if>
  53. <if test="roleId !=null and roleId != ''">
  54. , t.role_id= #{roleId}
  55. </if>
  56. <if test="communityId !=null and communityId != ''">
  57. , t.community_id= #{communityId}
  58. </if>
  59. <if test="communityName !=null and communityName != ''">
  60. , t.community_name= #{communityName}
  61. </if>
  62. <if test="storeId !=null and storeId != ''">
  63. , t.store_id= #{storeId}
  64. </if>
  65. where 1=1
  66. <if test="rcId !=null and rcId != ''">
  67. and t.rc_id= #{rcId}
  68. </if>
  69. </update>
  70. <!-- 查询项目授权数量 add by wuxw 2018-07-03 -->
  71. <select id="queryRoleCommunitysCount" parameterType="Map" resultType="Map">
  72. select count(1) count
  73. from u_role_community t
  74. <if test="staffId != null and staffId != ''">
  75. left join p_privilege_group pg on t.role_id = pg.pg_id and pg.status_cd = '0'
  76. left join p_privilege_user pu on pu.p_id = pg.pg_id and pu.privilege_flag = '1' and pu.status_cd = '0'
  77. </if>
  78. where 1 =1
  79. <if test="staffId != null and staffId != ''">
  80. and pu.user_id = #{staffId}
  81. </if>
  82. <if test="roleId !=null and roleId != ''">
  83. and t.role_id= #{roleId}
  84. </if>
  85. <if test="rcId !=null and rcId != ''">
  86. and t.rc_id= #{rcId}
  87. </if>
  88. <if test="statusCd !=null and statusCd != ''">
  89. and t.status_cd= #{statusCd}
  90. </if>
  91. <if test="communityId !=null and communityId != ''">
  92. and t.community_id= #{communityId}
  93. </if>
  94. <if test="storeId !=null and storeId != ''">
  95. and t.store_id= #{storeId}
  96. </if>
  97. </select>
  98. <select id="queryRoleCommunitysNameCount" parameterType="Map" resultType="Map">
  99. select count(distinct(t.community_id)) count
  100. from u_role_community t
  101. <if test="staffId != null and staffId != ''">
  102. left join p_privilege_group pg on t.role_id = pg.pg_id and pg.status_cd = '0'
  103. left join p_privilege_user pu on pu.p_id = pg.pg_id and pu.privilege_flag = '1' and pu.status_cd = '0'
  104. </if>
  105. where 1 =1
  106. <if test="staffId != null and staffId != ''">
  107. and pu.user_id = #{staffId}
  108. </if>
  109. <if test="roleId !=null and roleId != ''">
  110. and t.role_id= #{roleId}
  111. </if>
  112. <if test="rcId !=null and rcId != ''">
  113. and t.rc_id= #{rcId}
  114. </if>
  115. <if test="statusCd !=null and statusCd != ''">
  116. and t.status_cd= #{statusCd}
  117. </if>
  118. <if test="communityId !=null and communityId != ''">
  119. and t.community_id= #{communityId}
  120. </if>
  121. <if test="storeId !=null and storeId != ''">
  122. and t.store_id= #{storeId}
  123. </if>
  124. </select>
  125. <select id="queryRoleCommunitysName" parameterType="Map" resultType="Map">
  126. select distinct t.community_id,t.community_id communityId,t.community_name communityName
  127. from u_role_community t
  128. <if test="staffId != null and staffId != ''">
  129. left join p_privilege_group pg on t.role_id = pg.pg_id and pg.status_cd = '0'
  130. left join p_privilege_user pu on pu.p_id = pg.pg_id and pu.privilege_flag = '1' and pu.status_cd = '0'
  131. </if>
  132. where 1 =1
  133. <if test="staffId != null and staffId != ''">
  134. and pu.user_id = #{staffId}
  135. </if>
  136. <if test="roleId !=null and roleId != ''">
  137. and t.role_id= #{roleId}
  138. </if>
  139. <if test="rcId !=null and rcId != ''">
  140. and t.rc_id= #{rcId}
  141. </if>
  142. <if test="statusCd !=null and statusCd != ''">
  143. and t.status_cd= #{statusCd}
  144. </if>
  145. <if test="communityId !=null and communityId != ''">
  146. and t.community_id= #{communityId}
  147. </if>
  148. <if test="storeId !=null and storeId != ''">
  149. and t.store_id= #{storeId}
  150. </if>
  151. order by t.community_id desc
  152. <if test="page != -1 and page != null ">
  153. limit #{page}, #{row}
  154. </if>
  155. </select>
  156. </mapper>