UserV1ServiceDaoImplMapper.xml 6.7 KB

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