DataPrivilegeStaffV1ServiceDaoImplMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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="dataPrivilegeStaffV1ServiceDaoImpl">
  6. <!-- 保存数据权限员工关系信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveDataPrivilegeStaffInfo" parameterType="Map">
  8. insert into data_privilege_staff(
  9. dps_id,dp_id,staff_name,remark,community_id,staff_id
  10. ) values (
  11. #{dpsId},#{dpId},#{staffName},#{remark},#{communityId},#{staffId}
  12. )
  13. </insert>
  14. <!-- 查询数据权限员工关系信息 add by wuxw 2018-07-03 -->
  15. <select id="getDataPrivilegeStaffInfo" parameterType="Map" resultType="Map">
  16. select t.dps_id,t.dps_id dpsId,t.dp_id,t.dp_id dpId,t.staff_name,t.staff_name
  17. staffName,t.remark,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id
  18. communityId,t.staff_id,t.staff_id staffId,u.tel,u.email,u.address,u.sex
  19. from data_privilege_staff t
  20. left join u_user u on t.staff_id = u.user_id and u.status_cd = '0'
  21. where 1 =1
  22. <if test="dpsId !=null and dpsId != ''">
  23. and t.dps_id= #{dpsId}
  24. </if>
  25. <if test="dpId !=null and dpId != ''">
  26. and t.dp_id= #{dpId}
  27. </if>
  28. <if test="staffName !=null and staffName != ''">
  29. and t.staff_name= #{staffName}
  30. </if>
  31. <if test="remark !=null and remark != ''">
  32. and t.remark= #{remark}
  33. </if>
  34. <if test="statusCd !=null and statusCd != ''">
  35. and t.status_cd= #{statusCd}
  36. </if>
  37. <if test="communityId !=null and communityId != ''">
  38. and t.community_id= #{communityId}
  39. </if>
  40. <if test="staffId !=null and staffId != ''">
  41. and t.staff_id= #{staffId}
  42. </if>
  43. order by t.create_time desc
  44. <if test="page != -1 and page != null ">
  45. limit #{page}, #{row}
  46. </if>
  47. </select>
  48. <!-- 修改数据权限员工关系信息 add by wuxw 2018-07-03 -->
  49. <update id="updateDataPrivilegeStaffInfo" parameterType="Map">
  50. update data_privilege_staff t set t.status_cd = #{statusCd}
  51. <if test="newBId != null and newBId != ''">
  52. ,t.b_id = #{newBId}
  53. </if>
  54. <if test="dpId !=null and dpId != ''">
  55. , t.dp_id= #{dpId}
  56. </if>
  57. <if test="staffName !=null and staffName != ''">
  58. , t.staff_name= #{staffName}
  59. </if>
  60. <if test="remark !=null and remark != ''">
  61. , t.remark= #{remark}
  62. </if>
  63. <if test="staffId !=null and staffId != ''">
  64. , t.staff_id= #{staffId}
  65. </if>
  66. where 1=1
  67. <if test="communityId !=null and communityId != ''">
  68. and t.community_id= #{communityId}
  69. </if>
  70. <if test="dpsId !=null and dpsId != ''">
  71. and t.dps_id= #{dpsId}
  72. </if>
  73. </update>
  74. <!-- 查询数据权限员工关系数量 add by wuxw 2018-07-03 -->
  75. <select id="queryDataPrivilegeStaffsCount" parameterType="Map" resultType="Map">
  76. select count(1) count
  77. from data_privilege_staff t
  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= #{staffName}
  87. </if>
  88. <if test="remark !=null and remark != ''">
  89. and t.remark= #{remark}
  90. </if>
  91. <if test="statusCd !=null and statusCd != ''">
  92. and t.status_cd= #{statusCd}
  93. </if>
  94. <if test="communityId !=null and communityId != ''">
  95. and t.community_id= #{communityId}
  96. </if>
  97. <if test="staffId !=null and staffId != ''">
  98. and t.staff_id= #{staffId}
  99. </if>
  100. </select>
  101. <!-- 查询用户权限数量 add by wuxw 2018-07-03 -->
  102. <select id="queryStaffsNotInDataPrivilegeCount" parameterType="Map" resultType="Map">
  103. select count(1) count
  104. from u_user t
  105. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  106. left join data_privilege_staff pu on t.user_id = pu.staff_id and pu.status_cd = '0' and pu.dp_id = #{dpId}
  107. where t.status_cd = '0'
  108. and pu.dp_id is null
  109. <if test="userName !=null and userName != ''">
  110. and t.name like concat('%', #{userName},'%')
  111. </if>
  112. and su.store_id = #{storeId}
  113. </select>
  114. <!-- 查询用户权限信息 add by wuxw 2018-07-03 -->
  115. <select id="queryStaffsNotInDataPrivilege" parameterType="Map" resultType="Map">
  116. select
  117. t.user_id,t.user_id userId,
  118. t.address,t.sex,t.user_id,t.user_id userId,t.level_cd,t.level_cd
  119. levelCd,t.location_cd,t.location_cd locationCd,t.score,t.name,t.tel,t.email,t.age
  120. from u_user t
  121. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  122. left join data_privilege_staff pu on t.user_id = pu.staff_id and pu.status_cd = '0' and pu.dp_id = #{dpId}
  123. where t.status_cd = '0'
  124. and pu.dp_id is null
  125. <if test="userName !=null and userName != ''">
  126. and t.name like concat('%', #{userName},'%')
  127. </if>
  128. and su.store_id = #{storeId}
  129. order by t.create_time desc
  130. <if test="page != -1 and page != null ">
  131. limit #{page}, #{row}
  132. </if>
  133. </select>
  134. </mapper>