UserV1ServiceDaoImplMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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="userV1ServiceDaoImpl">
  6. <!-- 保存用户信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveUserInfo" parameterType="Map">
  8. insert into u_user(address, sex, user_id, level_cd, location_cd, score, password, name, tel, b_id, email, age)
  9. values (#{address}, #{sex}, #{userId}, #{levelCd}, #{locationCd}, #{score}, #{password}, #{name}, #{tel},
  10. #{bId}, #{email}, #{age})
  11. </insert>
  12. <!-- 查询用户信息 add by wuxw 2018-07-03 -->
  13. <select id="getUserInfo" parameterType="Map" resultType="Map">
  14. select t.address,t.sex,t.status_cd,t.status_cd statusCd,t.user_id,t.user_id userId,t.level_cd,t.level_cd
  15. levelCd,t.location_cd,t.location_cd locationCd,t.score,t.password,t.name,t.tel,t.b_id,t.b_id bId,t.email,t.age
  16. from u_user t
  17. where 1 =1
  18. <if test="address !=null and address != ''">
  19. and t.address= #{address}
  20. </if>
  21. <if test="sex !=null and sex != ''">
  22. and t.sex= #{sex}
  23. </if>
  24. <if test="statusCd !=null and statusCd != ''">
  25. and t.status_cd= #{statusCd}
  26. </if>
  27. <if test="userId !=null and userId != ''">
  28. and t.user_id= #{userId}
  29. </if>
  30. <if test="levelCd !=null and levelCd != ''">
  31. and t.level_cd= #{levelCd}
  32. </if>
  33. <if test="locationCd !=null and locationCd != ''">
  34. and t.location_cd= #{locationCd}
  35. </if>
  36. <if test="score !=null and score != ''">
  37. and t.score= #{score}
  38. </if>
  39. <if test="password !=null and password != ''">
  40. and t.password= #{password}
  41. </if>
  42. <if test="name !=null and name != ''">
  43. and t.name= #{name}
  44. </if>
  45. <if test="tel !=null and tel != ''">
  46. and t.tel= #{tel}
  47. </if>
  48. <if test="bId !=null and bId != ''">
  49. and t.b_id= #{bId}
  50. </if>
  51. <if test="email !=null and email != ''">
  52. and t.email= #{email}
  53. </if>
  54. <if test="age !=null and age != ''">
  55. and t.age= #{age}
  56. </if>
  57. order by t.create_time desc
  58. <if test="page != -1 and page != null ">
  59. limit #{page}, #{row}
  60. </if>
  61. </select>
  62. <!-- 修改用户信息 add by wuxw 2018-07-03 -->
  63. <update id="updateUserInfo" parameterType="Map">
  64. update u_user t set t.status_cd = #{statusCd}
  65. <if test="newBId != null and newBId != ''">
  66. ,t.b_id = #{newBId}
  67. </if>
  68. <if test="address !=null and address != ''">
  69. , t.address= #{address}
  70. </if>
  71. <if test="sex !=null and sex != ''">
  72. , t.sex= #{sex}
  73. </if>
  74. <if test="levelCd !=null and levelCd != ''">
  75. , t.level_cd= #{levelCd}
  76. </if>
  77. <if test="locationCd !=null and locationCd != ''">
  78. , t.location_cd= #{locationCd}
  79. </if>
  80. <if test="score !=null and score != ''">
  81. , t.score= #{score}
  82. </if>
  83. <if test="password !=null and password != ''">
  84. , t.password= #{password}
  85. </if>
  86. <if test="name !=null and name != ''">
  87. , t.name= #{name}
  88. </if>
  89. <if test="tel !=null and tel != ''">
  90. , t.tel= #{tel}
  91. </if>
  92. , t.email= #{email}
  93. <if test="age !=null and age != ''">
  94. , t.age= #{age}
  95. </if>
  96. where 1=1
  97. <if test="userId !=null and userId != ''">
  98. and t.user_id= #{userId}
  99. </if>
  100. <if test="bId !=null and bId != ''">
  101. and t.b_id= #{bId}
  102. </if>
  103. </update>
  104. <!-- 查询用户数量 add by wuxw 2018-07-03 -->
  105. <select id="queryUsersCount" parameterType="Map" resultType="Map">
  106. select count(1) count
  107. from u_user t
  108. where 1 =1
  109. <if test="address !=null and address != ''">
  110. and t.address= #{address}
  111. </if>
  112. <if test="sex !=null and sex != ''">
  113. and t.sex= #{sex}
  114. </if>
  115. <if test="statusCd !=null and statusCd != ''">
  116. and t.status_cd= #{statusCd}
  117. </if>
  118. <if test="userId !=null and userId != ''">
  119. and t.user_id= #{userId}
  120. </if>
  121. <if test="levelCd !=null and levelCd != ''">
  122. and t.level_cd= #{levelCd}
  123. </if>
  124. <if test="locationCd !=null and locationCd != ''">
  125. and t.location_cd= #{locationCd}
  126. </if>
  127. <if test="score !=null and score != ''">
  128. and t.score= #{score}
  129. </if>
  130. <if test="password !=null and password != ''">
  131. and t.password= #{password}
  132. </if>
  133. <if test="name !=null and name != ''">
  134. and t.name= #{name}
  135. </if>
  136. <if test="tel !=null and tel != ''">
  137. and t.tel= #{tel}
  138. </if>
  139. <if test="bId !=null and bId != ''">
  140. and t.b_id= #{bId}
  141. </if>
  142. <if test="email !=null and email != ''">
  143. and t.email= #{email}
  144. </if>
  145. <if test="age !=null and age != ''">
  146. and t.age= #{age}
  147. </if>
  148. </select>
  149. <select id="queryStaffsNoInOrgCount" parameterType="Map" resultType="Map">
  150. select count(DISTINCT t.user_id) count
  151. from u_user t
  152. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  153. LEFT JOIN u_org_staff_rel osr on su.user_id = osr.staff_id and osr.status_cd = '0'
  154. where t.level_cd = '01'
  155. and su.store_id = #{storeId}
  156. and (osr.org_id != #{orgId} or osr.org_id is null)
  157. <if test="staffName !=null and staffName != ''">
  158. and t.name like concat('%', #{staffName},'%')
  159. </if>
  160. <if test="orgIds != null and orgIds.length > 0">
  161. and osr.org_id in
  162. <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
  163. #{item}
  164. </foreach>
  165. </if>
  166. </select>
  167. <select id="queryStaffsNoInOrg" parameterType="Map" resultType="Map">
  168. select DISTINCT t.address,t.sex,t.status_cd,t.status_cd statusCd,t.user_id,t.user_id
  169. userId,t.level_cd,t.level_cd
  170. levelCd,t.location_cd,t.location_cd locationCd,t.score,t.name,t.tel,t.b_id,t.b_id
  171. bId,t.email,t.age,t.create_time
  172. from u_user t
  173. inner join s_store_user su on t.user_id = su.user_id and su.status_cd = '0'
  174. LEFT JOIN u_org_staff_rel osr on su.user_id = osr.staff_id and osr.status_cd = '0' and osr.org_id = #{orgId}
  175. where t.level_cd = '01'
  176. and su.store_id = #{storeId}
  177. and osr.org_id is null
  178. <if test="staffName !=null and staffName != ''">
  179. and t.name like concat('%', #{staffName},'%')
  180. </if>
  181. <if test="orgIds != null and orgIds.length > 0">
  182. and osr.org_id in
  183. <foreach collection="orgIds" item="item" open="(" close=")" separator=",">
  184. #{item}
  185. </foreach>
  186. </if>
  187. order by t.create_time desc
  188. <if test="page != -1 and page != null ">
  189. limit #{page}, #{row}
  190. </if>
  191. </select>
  192. </mapper>