DataPrivilegeStaffV1ServiceDaoImplMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="dataPrivilegeStaffV1ServiceDaoImpl">
  5. <!-- 保存数据权限员工关系信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveDataPrivilegeStaffInfo" parameterType="Map">
  7. insert into data_privilege_staff(dps_id, dp_id, staff_name, remark, community_id, staff_id)
  8. values (#{dpsId}, #{dpId}, #{staffName}, #{remark}, #{communityId}, #{staffId})
  9. </insert>
  10. <!-- 查询数据权限员工关系信息 add by wuxw 2018-07-03 -->
  11. <select id="getDataPrivilegeStaffInfo" parameterType="Map" resultType="Map">
  12. select t.dps_id,t.dps_id dpsId,t.dp_id,t.dp_id dpId,t.staff_name,t.staff_name
  13. staffName,t.remark,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id
  14. communityId,t.staff_id,t.staff_id staffId,u.tel,u.email,u.address,u.sex
  15. from data_privilege_staff t
  16. left join u_user u on t.staff_id = u.user_id and u.status_cd = '0'
  17. where 1 =1
  18. <if test="dpsId !=null and dpsId != ''">
  19. and t.dps_id= #{dpsId}
  20. </if>
  21. <if test="dpId !=null and dpId != ''">
  22. and t.dp_id= #{dpId}
  23. </if>
  24. <if test="staffName !=null and staffName != ''">
  25. and t.staff_name like '%${staffName}%'
  26. </if>
  27. <if test="tel !=null and tel != ''">
  28. and u.tel= #{tel}
  29. </if>
  30. <if test="remark !=null and remark != ''">
  31. and t.remark= #{remark}
  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="staffId !=null and staffId != ''">
  40. and t.staff_id= #{staffId}
  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="updateDataPrivilegeStaffInfo" parameterType="Map">
  49. update data_privilege_staff t set t.status_cd = #{statusCd}
  50. <if test="newBId != null and newBId != ''">
  51. ,t.b_id = #{newBId}
  52. </if>
  53. <if test="dpId !=null and dpId != ''">
  54. , t.dp_id= #{dpId}
  55. </if>
  56. <if test="staffName !=null and staffName != ''">
  57. , t.staff_name= #{staffName}
  58. </if>
  59. <if test="remark !=null and remark != ''">
  60. , t.remark= #{remark}
  61. </if>
  62. <if test="staffId !=null and staffId != ''">
  63. , t.staff_id= #{staffId}
  64. </if>
  65. where 1=1
  66. <if test="communityId !=null and communityId != ''">
  67. and t.community_id= #{communityId}
  68. </if>
  69. <if test="dpsId !=null and dpsId != ''">
  70. and t.dps_id= #{dpsId}
  71. </if>
  72. </update>
  73. <!-- 查询数据权限员工关系数量 add by wuxw 2018-07-03 -->
  74. <select id="queryDataPrivilegeStaffsCount" parameterType="Map" resultType="Map">
  75. select count(1) count
  76. from data_privilege_staff t
  77. left join u_user u on t.staff_id = u.user_id and u.status_cd = '0'
  78. where 1 =1
  79. <if test="dpsId !=null and dpsId != ''">
  80. and t.dps_id= #{dpsId}
  81. </if>
  82. <if test="dpId !=null and dpId != ''">
  83. and t.dp_id= #{dpId}
  84. </if>
  85. <if test="staffName !=null and staffName != ''">
  86. and t.staff_name like '%${staffName}%'
  87. </if>
  88. <if test="tel !=null and tel != ''">
  89. and u.tel= #{tel}
  90. </if>
  91. <if test="remark !=null and remark != ''">
  92. and t.remark= #{remark}
  93. </if>
  94. <if test="statusCd !=null and statusCd != ''">
  95. and t.status_cd= #{statusCd}
  96. </if>
  97. <if test="communityId !=null and communityId != ''">
  98. and t.community_id= #{communityId}
  99. </if>
  100. <if test="staffId !=null and staffId != ''">
  101. and t.staff_id= #{staffId}
  102. </if>
  103. </select>
  104. <!-- 查询用户权限数量 add by wuxw 2018-07-03 -->
  105. <select id="queryStaffsNotInDataPrivilegeCount" parameterType="Map" resultType="Map">
  106. select count(1) count
  107. from u_user t
  108. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  109. left join data_privilege_staff pu on t.user_id = pu.staff_id and pu.status_cd = '0' and pu.dp_id = #{dpId}
  110. where t.status_cd = '0'
  111. and pu.dp_id is null
  112. <if test="staffId !=null and staffId != ''">
  113. and t.user_id = #{staffId}
  114. </if>
  115. <if test="staffName !=null and staffName != ''">
  116. and t.name like concat('%', #{staffName},'%')
  117. </if>
  118. and su.store_id = #{storeId}
  119. </select>
  120. <!-- 查询用户权限信息 add by wuxw 2018-07-03 -->
  121. <select id="queryStaffsNotInDataPrivilege" parameterType="Map" resultType="Map">
  122. select
  123. t.user_id,t.user_id userId,
  124. t.address,t.sex,t.user_id,t.user_id userId,t.level_cd,t.level_cd
  125. levelCd,t.location_cd,t.location_cd locationCd,t.score,t.name,t.tel,t.email,t.age
  126. from u_user t
  127. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  128. left join data_privilege_staff pu on t.user_id = pu.staff_id and pu.status_cd = '0' and pu.dp_id = #{dpId}
  129. where t.status_cd = '0'
  130. and pu.dp_id is null
  131. <if test="staffId !=null and staffId != ''">
  132. and t.user_id = #{staffId}
  133. </if>
  134. <if test="staffName !=null and staffName != ''">
  135. and t.name like concat('%', #{staffName},'%')
  136. </if>
  137. and su.store_id = #{storeId}
  138. order by t.create_time desc
  139. <if test="page != -1 and page != null ">
  140. limit #{page}, #{row}
  141. </if>
  142. </select>
  143. </mapper>