UserServiceDaoImplMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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="userServiceDaoImpl">
  6. <resultMap type="com.java110.entity.user.Cust" id="custMap">
  7. <id column="custId" jdbcType="VARCHAR" property="custId"/>
  8. <result column="name" jdbcType="VARCHAR" property="name"/>
  9. <result column="email" jdbcType="VARCHAR" property="email"/>
  10. <result column="cellphone" jdbcType="VARCHAR" property="cellphone"/>
  11. <result column="realName" jdbcType="VARCHAR" property="realName"/>
  12. <result column="sex" jdbcType="VARCHAR" property="sex"/>
  13. <result column="password" jdbcType="VARCHAR" property="password"/>
  14. <result column="lanId" jdbcType="VARCHAR" property="lanId"/>
  15. <result column="custAdress" jdbcType="VARCHAR" property="custAdress"/>
  16. <result column="custType" jdbcType="VARCHAR" property="custType"/>
  17. <result column="openId" jdbcType="VARCHAR" property="openId"/>
  18. <!-- 一对多关系 -->
  19. <!-- <collection property="stus" resultMap="Student.StudentResult"></collection> -->
  20. <collection property="custAttrs" javaType="com.java110.entity.user.CustAttr">
  21. <id property="custId" column="custId"/>
  22. <result property="attrCd" column="attrCd"/>
  23. <result property="value" column="value"/>
  24. </collection>
  25. </resultMap>
  26. <!--根据用户Id查询用户角色
  27. <select id="findRolesByUserId" resultType="SysRole">
  28. SELECT
  29. r.*
  30. FROM
  31. t_role r,
  32. t_user_role ur
  33. WHERE ur.uid = #{userId}
  34. AND ur.roleId = r.roleId
  35. AND ur.status_cd = '1'
  36. </select>
  37. -->
  38. <!--保存数据至过程表 bo_cust 中 -->
  39. <insert id="saveDataToBoCust" parameterType="com.java110.entity.user.BoCust">
  40. <![CDATA[
  41. insert into bo_cust(boId,custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,state)
  42. values(#{boId},#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{state})
  43. ]]>
  44. </insert>
  45. <!-- 保存数据至过程表bo_cust_attr 中-->
  46. <insert id="saveDataToBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr">
  47. <![CDATA[
  48. insert into bo_cust_attr(boId,custId,attrCd,value,state)
  49. values(#{boId},#{custId},#{attrCd},#{value},#{state})
  50. ]]>
  51. </insert>
  52. <!-- 保存 实例客户信息 cust -->
  53. <insert id="saveDataToCust" parameterType="com.java110.entity.user.Cust">
  54. <![CDATA[
  55. insert into cust(custId,name,email,cellphone,realName,sex,password,lanId,custAdress,custType,openId,status_cd)
  56. values(#{custId},#{name},#{email},#{cellphone},#{realName},#{sex},#{password},#{lanId},#{custAdress},#{custType},#{openId},#{status_cd})
  57. ]]>
  58. </insert>
  59. <!-- 删除实例客户信息 cust -->
  60. <insert id="deleteDataToCust" parameterType="com.java110.entity.user.Cust">
  61. <![CDATA[
  62. delete * from cust c where c.custId = #{custId}
  63. ]]>
  64. </insert>
  65. <!-- 保存 实例客户属性信息 cust_attr -->
  66. <insert id="saveDataToCustAttr" parameterType="com.java110.entity.user.CustAttr">
  67. <![CDATA[
  68. insert into cust_attr(custId,attrCd,value,status_cd)
  69. values(#{custId},#{attrCd},#{value},#{status_cd})
  70. ]]>
  71. </insert>
  72. <!-- 删除实例客户信息 cust -->
  73. <update id="deleteDataToCustAttr" parameterType="com.java110.entity.user.CustAttr">
  74. delete * from cust_attr ct where 1=1
  75. <if test="custId != null and custId != ''">
  76. and ct.custId = #{custId}
  77. </if>
  78. <if test="attrCd != null and attrCd != ''">
  79. and ct.attrCd = #{attrCd}
  80. </if>
  81. </update>
  82. <!--根据客户ID 查询客户信息,其中包括 cust 和custAttr 数据-->
  83. <select id="queryDataToCust" parameterType="com.java110.entity.user.Cust" resultMap="custMap">
  84. select c.custId,c.name,c.email,c.cellphone,c.realName,c.sex,c.password,c.lanId,c.custAdress,c.custType,c.openId,
  85. ca.custId,ca.attrCd,ca.value
  86. from cust c, cust_attr ca where c.custId= ca.custId
  87. <if test="custId != null and custId != ''">
  88. and c.custId = #{custId}
  89. </if>
  90. <if test="versionId != null and versionId != ''">
  91. and c.versionId = #{versionId}
  92. </if>
  93. and c.status_cd = '0'
  94. </select>
  95. <!-- 查询客户过程数据 -->
  96. <select id="queryBoCust" parameterType="com.java110.entity.user.BoCust" resultType="com.java110.entity.user.BoCust">
  97. select
  98. bc.boId,bc.custId,bc.name,bc.email,bc.cellphone,bc.realName,bc.sex,bc.password,bc.lanId,bc.custAdress,bc.custType,bc.openId,bc.create_dt
  99. from bo_cust bc where 1=1
  100. <if test="boId != null and boId != ''">
  101. and bc.boId = #{boId}
  102. </if>
  103. <if test="custId != null and custId != ''">
  104. and bc.custId = #{custId}
  105. </if>
  106. <if test="versionId != null and versionId != ''">
  107. and c.versionId = #{versionId}
  108. </if>
  109. and bc.state in ('ADD','DEL','KIP')
  110. <if test="create_dt != null and create_dt != ''">
  111. order by bc.create_dt desc
  112. </if>
  113. </select>
  114. <!-- 查询客户属性过程表-->
  115. <select id="queryBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr"
  116. resultType="com.java110.entity.user.BoCustAttr">
  117. select bca.boId,bca.custId,bca.attrCd,bca.value,bca.state,bca.create_dt from bo_cust_attr bca where 1=1
  118. <if test="boId !=null and boId != ''">
  119. and bca.boId = #{boId}
  120. </if>
  121. <if test="custId != null and custId != ''">
  122. and bca.custId = #{custId}
  123. </if>
  124. <if test="versionId != null and versionId != ''">
  125. and bca.versionId = #{versionId}
  126. </if>
  127. <if test="create_dt != null and create_dt != ''">
  128. order by bca.create_dt desc
  129. </if>
  130. </select>
  131. <!-- 查询客户属性信息 -->
  132. <select id="queryDataToCustAttr" parameterType="com.java110.entity.user.CustAttr"
  133. resultType="com.java110.entity.user.CustAttr">
  134. select * from cust_attr ca where 1=1
  135. <if test="custId != null and custId != ''">
  136. and ca.custId = #{custId}
  137. </if>
  138. <if test="versionId != null and versionId != ''">
  139. and ca.versionId = #{versionId}
  140. </if>
  141. <if test="attrCd != null and attrCd != ''">
  142. and ca.attrCd = #{attrCd}
  143. </if>
  144. and status_cd = '0'
  145. </select>
  146. <!-- 保存用户信息 -->
  147. <insert id="saveBusinessUserInfo" parameterType="map">
  148. insert into business_user(b_id,user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,operate)
  149. values(#{bId},#{userId},#{name},#{email},#{address},#{password},#{locationCd},#{age},#{sex},#{tel},#{levelCd},#{operate})
  150. </insert>
  151. <!-- 保存用户属性 -->
  152. <insert id="saveBusinessUserAttr" parameterType="map">
  153. insert into business_user_attr(b_id,user_id,attr_id,spec_cd,value,operate)
  154. values(#{bId},#{userId},#{attrId},#{specCd},#{value},#{operate})
  155. </insert>
  156. <!-- 实例数据 -->
  157. <insert id="saveUserInfoInstance" parameterType="map">
  158. insert into u_user(user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,b_id,status_cd)
  159. select
  160. bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0'
  161. from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id}
  162. </insert>
  163. <insert id="saveUserAttrInstance" parameterType="map">
  164. insert into u_user_attr(attr_id,user_id,spec_cd,value,b_id,status_cd)
  165. select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where
  166. bua.operate='ADD' and bua.b_id=#{b_id}
  167. </insert>
  168. <update id="updateUserInfoInstance" parameterType="map">
  169. update u_user u set u.status_cd = #{statusCd}
  170. <if test="newBId != null and newBId != ''">
  171. ,u.b_id = #{newBId}
  172. </if>
  173. <if test="name !=null and name != ''">
  174. ,u.name= #{name}
  175. </if>
  176. <if test="email !=null and email != ''">
  177. ,u.email= #{email}
  178. </if>
  179. <if test="address !=null and address != ''">
  180. ,u.address= #{address}
  181. </if>
  182. <if test="password !=null and password != ''">
  183. ,u.password= #{password}
  184. </if>
  185. <if test="locationCd !=null and locationCd != ''">
  186. ,u.location_cd= #{locationCd}
  187. </if>
  188. <if test="age !=null and age != ''">
  189. ,u.age= #{age}
  190. </if>
  191. <if test="sex !=null and sex != ''">
  192. ,u.sex= #{sex}
  193. </if>
  194. <if test="tel !=null and tel != ''">
  195. ,u.tel= #{tel}
  196. </if>
  197. where 1 = 1
  198. <if test="bId != null and bId != ''">
  199. and u.b_id = #{bId}
  200. </if>
  201. <if test="userId != null and userId !=''">
  202. and u.user_id = #{userId}
  203. </if>
  204. <if test="attrId != null and attrId != ''">
  205. and u.attr_id = #{attrId}
  206. </if>
  207. </update>
  208. <update id="updateUserAttrInstance" parameterType="map">
  209. update u_user_attr ua set ua.status_cd = #{statusCd} where 1 = 1
  210. <if test="bId != null and bId != ''">
  211. and ua.b_id = #{bId}
  212. </if>
  213. <if test="userId != null and userId !=''">
  214. and ua.user_id = #{userId}
  215. </if>
  216. </update>
  217. <!-- 查询用户信息 Business -->
  218. <select id="queryBusinessUserInfo" parameterType="map" resultType="map">
  219. select u.user_id,u.name,u.email,u.address,u.password,u.location_cd,
  220. u.age,u.sex,u.tel,u.level_cd,u.b_id,u.operate
  221. from business_user u where 1 = 1
  222. <if test="operate != null and operate != ''">
  223. and u.operate = #{operate}
  224. </if>
  225. <if test="bId != null and bId !=''">
  226. and u.b_id = #{bId}
  227. </if>
  228. <if test="userId != null and userId != ''">
  229. and u.user_id = #{userId}
  230. </if>
  231. </select>
  232. <!-- 查询用户属性信息 Business-->
  233. <select id="queryBusinessUserInfoAttrs" parameterType="map" resultType="map">
  234. select u.attr_id,u.user_id,u.spec_cd,u.value,u.b_id,u.operate
  235. from business_user_attr u where 1 = 1
  236. <if test="operate != null and operate != ''">
  237. and u.operate = #{operate}
  238. </if>
  239. <if test="bId != null and bId !=''">
  240. and u.b_id = #{bId}
  241. </if>
  242. <if test="userId != null and userId != ''">
  243. and u.user_id = #{userId}
  244. </if>
  245. <if test="attrId != null and attrId != ''">
  246. and u.attr_id = #{attrId}
  247. </if>
  248. </select>
  249. <!-- 查询用户信息 -->
  250. <select id="queryUserInfo" parameterType="map" resultType="map">
  251. select u.user_id, u.user_id userId,u.name,u.name
  252. userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd,
  253. u.age,u.sex,u.tel,u.level_cd,u.b_id
  254. from u_user u where 1= 1
  255. <if test="bId != null and bId !=''">
  256. and u.b_id = #{bId}
  257. </if>
  258. <if test="userId != null and userId != ''">
  259. and u.user_id = #{userId}
  260. </if>
  261. <if test="statusCd !=null and statusCd != ''">
  262. and u.status_cd = #{statusCd}
  263. </if>
  264. <if test="userIds != null and userIds != null">
  265. and u.user_id in
  266. <foreach collection="userIds" item="item" open="(" close=")" separator=",">
  267. #{item}
  268. </foreach>
  269. </if>
  270. </select>
  271. <!-- 查询用户属性信息 -->
  272. <select id="queryUserInfoAttrs" parameterType="map" resultType="map">
  273. select u.attr_id,u.user_id,u.spec_cd,u.value,u.b_id,
  274. u.attr_id attrId,u.user_id userId,u.spec_cd specCd,u.b_id bId
  275. from u_user_attr u where u.status_cd = '0'
  276. <if test="bId != null and bId !=''">
  277. and u.b_id = #{bId}
  278. </if>
  279. <if test="userId != null and userId != ''">
  280. and u.user_id = #{userId}
  281. </if>
  282. <if test="attrId != null and attrId != ''">
  283. and u.attr_id = #{attrId}
  284. </if>
  285. </select>
  286. <!--保存用户地址信息 add by wuxw 2018-06-29 -->
  287. <insert id="saveBusinessUserAddress" parameterType="map">
  288. insert into business_user_address(address_id,b_id,user_id,tel,postal_code,address,is_default,operate)
  289. values(#{addressId},#{bId},#{userId},#{tel},#{postalCode},#{address},#{isDefault},#{operate})
  290. </insert>
  291. <!-- 查询用户地址信息 add by wuxw 2018-06-29-->
  292. <select id="queryBusinessUserAddress" parameterType="map" resultType="map">
  293. select ua.address_id,ua.b_id,ua.user_id,ua.tel,ua.postal_code,ua.address,ua.is_default,ua.operate
  294. from business_user_address ua where 1 = 1
  295. <if test="operate != null and operate != ''">
  296. and ua.operate = #{operate}
  297. </if>
  298. <if test="bId != null and bId !=''">
  299. and ua.b_id = #{bId}
  300. </if>
  301. <if test="userId != null and userId != ''">
  302. and ua.user_id = #{userId}
  303. </if>
  304. </select>
  305. <!-- 保存用户地址 Business 数据到 Instance add by wuxw 2018-06-29 -->
  306. <insert id="saveUserAddressInstance" parameterType="map">
  307. insert into u_user_address(address_id,b_id,user_id,tel,postal_code,address,is_default,status_cd)
  308. select ua.address_id,ua.b_id,ua.user_id,ua.tel,ua.postal_code,ua.address,ua.is_default,'0'
  309. from business_user_address ua where 1 = 1
  310. ua.operate = 'ADD' and ua.b_id=#{b_id}
  311. </insert>
  312. <!-- 作废用户地址信息数据 add by wuxw 2018-06-29-->
  313. <update id="updateUserAddressInstance" parameterType="map">
  314. update u_user_address ua set ua.status_cd = #{statusCd} where 1 = 1
  315. <if test="bId != null and bId != ''">
  316. and ua.b_id = #{bId}
  317. </if>
  318. <if test="userId != null and userId !=''">
  319. and ua.user_id = #{userId}
  320. </if>
  321. <if test="addressId != null and addressId != ''">
  322. and ua.address_id = #{addressId}
  323. </if>
  324. </update>
  325. <!--保存用户打标信息 add by wuxw 2018-06-29 -->
  326. <insert id="saveBusinessUserTag" parameterType="map">
  327. insert into business_user_tag(tag_id,b_id,user_id,tag_cd,remark,operate)
  328. values(#{tagId},#{bId},#{userId},#{tagCd},#{remark},#{operate})
  329. </insert>
  330. <!-- 查询用户地址信息 add by wuxw 2018-06-29-->
  331. <select id="queryBusinessUserTag" parameterType="map" resultType="map">
  332. select ut.tag_id,ut.b_id,ut.user_id,ut.tag_cd,ut.remark,ut.operate
  333. from business_user_tag ut where 1 = 1
  334. <if test="operate != null and operate != ''">
  335. and ut.operate = #{operate}
  336. </if>
  337. <if test="bId != null and bId !=''">
  338. and ut.b_id = #{bId}
  339. </if>
  340. <if test="userId != null and userId != ''">
  341. and ut.user_id = #{userId}
  342. </if>
  343. </select>
  344. <!-- 保存用户地址 Business 数据到 Instance add by wuxw 2018-06-29 -->
  345. <insert id="saveUserTagInstance" parameterType="map">
  346. insert into u_user_tag(tag_id,b_id,user_id,tag_cd,remark,status_cd)
  347. select ut.tag_id,ut.b_id,ut.user_id,ut.tag_cd,ut.remark,'0'
  348. from business_user_tag ut where 1 = 1
  349. ut.operate = 'ADD' and ut.b_id=#{b_id}
  350. </insert>
  351. <!-- 作废用户地址信息数据 add by wuxw 2018-06-29-->
  352. <update id="updateUserTagInstance" parameterType="map">
  353. update u_user_tag ut set ut.status_cd = #{statusCd} where 1 = 1
  354. <if test="bId != null and bId != ''">
  355. and ut.b_id = #{bId}
  356. </if>
  357. <if test="userId != null and userId !=''">
  358. and ut.user_id = #{userId}
  359. </if>
  360. <if test="addressId != null and addressId != ''">
  361. and ut.address_id = #{tagId}
  362. </if>
  363. </update>
  364. <!--保存用户证件信息 add by wuxw 2018-06-29 -->
  365. <insert id="saveBusinessUserCredentials" parameterType="map">
  366. insert into business_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,operate)
  367. values(#{credentialsId},#{bId},#{userId},#{credentialsCd},#{value},#{operate})
  368. </insert>
  369. <!-- 查询用户地址信息 add by wuxw 2018-06-29-->
  370. <select id="queryBusinessUserCredentials" parameterType="map" resultType="map">
  371. select uc.credentials_id,uc.b_id,uc.user_id,uc.credentials_cd,uc.value,uc.operate
  372. from business_user_credentials uc where 1 = 1
  373. <if test="operate != null and operate != ''">
  374. and uc.operate = #{operate}
  375. </if>
  376. <if test="bId != null and bId !=''">
  377. and uc.b_id = #{bId}
  378. </if>
  379. <if test="userId != null and userId != ''">
  380. and uc.user_id = #{userId}
  381. </if>
  382. </select>
  383. <!-- 保存用户地址 Business 数据到 Instance add by wuxw 2018-06-29 -->
  384. <insert id="saveUserCredentialsInstance" parameterType="map">
  385. insert into u_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,status_cd)
  386. select uc.credentials_id,uc.b_id,uc.user_id,uc.credentials_cd,uc.value,'0'
  387. from business_user_credentials uc where 1 = 1
  388. uc.operate = 'ADD' and uc.b_id=#{b_id}
  389. </insert>
  390. <!-- 作废用户地址信息数据 add by wuxw 2018-06-29-->
  391. <update id="updateUserCredentialsInstance" parameterType="map">
  392. update u_user_credentials uc set uc.status_cd = #{statusCd} where 1 = 1
  393. <if test="bId != null and bId != ''">
  394. and uc.b_id = #{bId}
  395. </if>
  396. <if test="userId != null and userId !=''">
  397. and uc.user_id = #{userId}
  398. </if>
  399. <if test="addressId != null and addressId != ''">
  400. and uc.credentials_id = #{credentialsId}
  401. </if>
  402. </update>
  403. <!-- 查询员工总量 -->
  404. <select id="getStaffCount" parameterType="Map" resultType="Map">
  405. select count(1) count
  406. from
  407. u_user u
  408. ,u_org uo
  409. ,u_org_staff_rel uosr
  410. ,u_org puo
  411. where u.level_cd = '01'
  412. and u.user_id = uosr.staff_id
  413. and uosr.store_id = #{storeId}
  414. and uosr.org_id = uo.org_id
  415. and uo.parent_org_id = puo.org_id
  416. and puo.status_cd = '0'
  417. and uo.status_cd = '0'
  418. <if test="parentOrgId !=null and parentOrgId != ''">
  419. and uo.parent_org_id = #{parentOrgId}
  420. </if>
  421. and a.status_cd = '0'
  422. and uo.status_cd = '0'
  423. and uosr.status_cd = '0'
  424. <if test="tel !=null and tel != ''">
  425. and a.tel= #{tel}
  426. </if>
  427. <if test="name !=null and name != ''">
  428. and a.name like concat('%',#{name},'%')
  429. </if>
  430. <if test="staffName !=null and staffName != ''">
  431. and a.name like concat('%',#{staffName},'%')
  432. </if>
  433. <if test="staffId != null and staffId !=''">
  434. and uosr.staff_id = #{staffId}
  435. </if>
  436. <if test="orgId !=null and orgId != ''">
  437. and uo.org_id = #{orgId}
  438. </if>
  439. </select>
  440. <!-- 查询员工总量 -->
  441. <select id="getStaffs" parameterType="Map" resultType="Map">
  442. select uo.org_name,uo.org_name orgName,u.user_id, u.user_id userId,u.name,u.name
  443. userName,u.email,u.address,u.location_cd,u.location_cd locationCd,
  444. u.age,u.sex,u.tel,u.level_cd,u.b_id,puo.org_id parentOrgId,puo.org_name parentOrgName
  445. from
  446. u_user u
  447. ,u_org uo
  448. ,u_org_staff_rel uosr
  449. ,u_org puo
  450. where u.level_cd = '01'
  451. and u.user_id = uosr.staff_id
  452. and uosr.store_id = #{storeId}
  453. and uosr.org_id = uo.org_id
  454. and uo.parent_org_id = puo.org_id
  455. and puo.status_cd = '0'
  456. and uo.status_cd = '0'
  457. <if test="parentOrgId !=null and parentOrgId != ''">
  458. and uo.parent_org_id = #{parentOrgId}
  459. </if>
  460. and u.status_cd = '0'
  461. and uo.status_cd = '0'
  462. and uosr.status_cd = '0'
  463. <if test="tel !=null and tel != ''">
  464. and u.tel= #{tel}
  465. </if>
  466. <if test="name !=null and name != ''">
  467. and u.name like concat('%',#{name},'%')
  468. </if>
  469. <if test="staffName !=null and staffName != ''">
  470. and u.name like concat('%',#{staffName},'%')
  471. </if>
  472. <if test="staffId != null and staffId !=''">
  473. and uosr.staff_id = #{staffId}
  474. </if>
  475. <if test="orgId !=null and orgId != ''">
  476. and uo.org_id = #{orgId}
  477. </if>
  478. order by u.create_time desc
  479. <if test="page != -1 and page != null ">
  480. limit #{page}, #{row}
  481. </if>
  482. </select>
  483. <!-- 查询用户 -->
  484. <select id="getUsers" parameterType="Map" resultType="Map">
  485. select u.user_id, u.user_id userId,u.name,u.name
  486. userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd,
  487. u.age,u.sex,u.tel,u.level_cd,u.b_id
  488. from u_user u
  489. <if test="openId != null and openId !=''">
  490. ,u_user_attr ua
  491. </if>
  492. where 1= 1
  493. <if test="openId != null and openId != ''">
  494. and u.user_id = ua.user_id
  495. and ua.spec_cd = '100201911001'
  496. and ua.value = #{openId}
  497. and ua.status_cd = '0'
  498. </if>
  499. <if test="bId != null and bId !=''">
  500. and u.b_id = #{bId}
  501. </if>
  502. <if test="userId != null and userId != ''">
  503. and u.user_id = #{userId}
  504. </if>
  505. <if test="statusCd !=null and statusCd != ''">
  506. and u.status_cd = #{statusCd}
  507. </if>
  508. <if test="userIds != null and userIds != null">
  509. and u.user_id in
  510. <foreach collection="userIds" item="item" open="(" close=")" separator=",">
  511. #{item}
  512. </foreach>
  513. </if>
  514. order by u.create_time desc
  515. <if test="page != -1 and page != null ">
  516. limit #{page}, #{row}
  517. </if>
  518. </select>
  519. <select id="getUserCount" parameterType="Map" resultType="Map">
  520. select count(1) count
  521. from u_user u
  522. <if test="openId != null and openId !=''">
  523. ,u_user_attr ua
  524. </if>
  525. where 1= 1
  526. <if test="openId != null and openId != ''">
  527. and u.user_id = ua.user_id
  528. and ua.spec_cd = '100201911001'
  529. and ua.value = #{openId}
  530. and ua.status_cd = '0'
  531. </if>
  532. <if test="bId != null and bId !=''">
  533. and u.b_id = #{bId}
  534. </if>
  535. <if test="userId != null and userId != ''">
  536. and u.user_id = #{userId}
  537. </if>
  538. <if test="statusCd !=null and statusCd != ''">
  539. and u.status_cd = #{statusCd}
  540. </if>
  541. <if test="userIds != null and userIds != null">
  542. and u.user_id in
  543. <foreach collection="userIds" item="item" open="(" close=")" separator=",">
  544. #{item}
  545. </foreach>
  546. </if>
  547. </select>
  548. <!-- 查询用户密码 -->
  549. <select id="getUserHasPwd" parameterType="Map" resultType="Map">
  550. select u.user_id, u.user_id userId,u.name,u.name
  551. userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd,
  552. u.age,u.sex,u.tel,u.level_cd levelCd,u.b_id,u.password
  553. from u_user u
  554. <if test="openId != null and openId !=''">
  555. ,u_user_attr ua
  556. </if>
  557. where 1= 1
  558. <if test="openId != null and openId != ''">
  559. and u.user_id = ua.user_id
  560. and ua.spec_cd = '100201911001'
  561. and ua.value = #{openId}
  562. and ua.status_cd = '0'
  563. </if>
  564. <if test="bId != null and bId !=''">
  565. and u.b_id = #{bId}
  566. </if>
  567. <if test="userId != null and userId != ''">
  568. and u.user_id = #{userId}
  569. </if>
  570. <if test="statusCd !=null and statusCd != ''">
  571. and u.status_cd = #{statusCd}
  572. </if>
  573. </select>
  574. </mapper>