BaseMapper.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei365.user.mapper.BaseMapper">
  4. <update id="updatePasswordByUserId">
  5. update user
  6. set password = #{password}
  7. where userID = #{userId}
  8. </update>
  9. <update id="updateMobileByUserId">
  10. update user
  11. set bindMobile = #{mobile}
  12. where userID = #{userId}
  13. </update>
  14. <update id="updateImageByUserId">
  15. update user
  16. <trim prefix="SET" suffixOverrides=",">
  17. <if test="image != null and image != ''">image = #{image},</if>
  18. </trim>
  19. where userId = #{userId}
  20. </update>
  21. <update id="updateShopMobileByShopId">
  22. update shop
  23. set contractMobile = #{mobile}
  24. where shopID = #{shopId}
  25. </update>
  26. <update id="updateClubMobileByClubId">
  27. update club
  28. set contractMobile = #{mobile}
  29. where clubID = #{clubId}
  30. </update>
  31. <select id="getUserIdByEmail" resultType="java.lang.Integer">
  32. select userID
  33. from user
  34. where email = #{email}
  35. and userIdentity in (1, 2, 3, 4)
  36. limit 1
  37. </select>
  38. <select id="getUserIdByUserId" resultType="java.lang.Integer">
  39. select userID
  40. from user
  41. where userID = #{userId}
  42. and userIdentity in (1, 2, 3, 4)
  43. limit 1
  44. </select>
  45. <select id="getUserIdByMobile" resultType="java.lang.Integer">
  46. SELECT u.userID
  47. FROM USER u
  48. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  49. WHERE u.bindMobile = #{mobile}
  50. and u.userIdentity in (1, 2, 3, 4,7)
  51. UNION
  52. SELECT u.userID
  53. FROM USER u
  54. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  55. WHERE cu.mobile = #{mobile}
  56. AND cu.delFlag != 1
  57. AND u.userIdentity IN (1, 2, 3, 4)
  58. LIMIT 1
  59. </select>
  60. <select id="getUserIdOrganizeByMobile" resultType="java.lang.Integer">
  61. SELECT u.userID
  62. FROM USER u
  63. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  64. WHERE u.bindMobile = #{mobile} and u.userOrganizeID != 0
  65. and u.userIdentity in (1, 2, 3, 4)
  66. UNION
  67. SELECT u.userID
  68. FROM USER u
  69. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  70. WHERE cu.mobile = #{mobile}
  71. AND cu.delFlag != 1
  72. AND u.userIdentity IN (1, 2, 3, 4) and u.userOrganizeID != 0
  73. LIMIT 1
  74. </select>
  75. <select id="getUserIdByOrganize" resultType="java.lang.Integer">
  76. SELECT u.userID
  77. FROM USER u
  78. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  79. WHERE u.userOrganizeID = #{organizeId}
  80. and u.bindMobile = #{mobile}
  81. and u.userIdentity in (1, 2, 3, 4)
  82. UNION
  83. SELECT u.userID
  84. FROM USER u
  85. LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
  86. WHERE u.userOrganizeID = #{organizeId}
  87. AND cu.mobile = #{mobile}
  88. AND cu.delFlag != 1
  89. AND u.userIdentity IN (1, 2, 3, 4)
  90. LIMIT 1
  91. </select>
  92. <select id="getServiceProvider" resultType="com.caimei365.user.model.vo.UserLoginVo">
  93. SELECT serviceProviderID as serviceProviderId, status as operationStatus FROM serviceprovider WHERE contractMobile = #{mobile} and organizeId = 4 limit 1
  94. </select>
  95. <select id="getUserIdByOrganizeStatus" resultType="com.caimei365.user.model.vo.UserLoginVo">
  96. SELECT userId, userIdentity, (select status from club where userId = USER.userId limit 1) as clubStatus
  97. FROM USER
  98. WHERE userOrganizeID = #{organizeId}
  99. AND bindMobile = #{mobile}
  100. AND userIdentity IN (1, 2, 3, 4)
  101. LIMIT 1
  102. </select>
  103. <select id="getOperationUserIdByMobile" resultType="java.lang.Integer">
  104. select userID
  105. from cm_mall_operation_user
  106. where mobile = #{mobile}
  107. and delFlag = '0'
  108. limit 1
  109. </select>
  110. <select id="getClubStatusByUserId" resultType="java.lang.Integer">
  111. select status
  112. from club
  113. where userID = #{userId}
  114. </select>
  115. <select id="getShopStatusByUserId" resultType="java.lang.Integer">
  116. select manufacturerStatus
  117. from user
  118. where userID = #{userId}
  119. </select>
  120. <select id="getOperationIdByMobile" resultType="java.lang.Integer">
  121. select id
  122. from cm_mall_operation_user
  123. where mobile = #{mobile}
  124. and delFlag = '0'
  125. limit 1
  126. </select>
  127. <select id="getOrganizeOperationIdByMobile" resultType="java.lang.Integer">
  128. select id
  129. from cm_mall_operation_user
  130. where mobile = #{mobile} and userOrganizeID = #{organizeId}
  131. and delFlag = '0'
  132. limit 1
  133. </select>
  134. <select id="getProvince" resultType="com.caimei365.user.model.vo.ProvinceVo">
  135. select provinceID as provinceId, name, validFlag, deliveryFee, freeMinTotalPrice
  136. from province
  137. where provinceID = #{provinceId}
  138. </select>
  139. <select id="getCity" resultType="com.caimei365.user.model.vo.CityVo">
  140. select cityID as cityId, provinceID as provinceId, name, validFlag
  141. from city
  142. where cityID = #{cityId}
  143. </select>
  144. <select id="getTown" resultType="com.caimei365.user.model.vo.TownVo">
  145. select townID as townId, cityID as cityId, name, zip, telZip, validFlag
  146. from town
  147. where townID = #{townID}
  148. </select>
  149. <select id="getUserByUserId" resultType="com.caimei365.user.model.vo.UserVo">
  150. select userID as userId,
  151. registerUserTypeID as registerUserTypeId,
  152. source,
  153. clubID as clubId,
  154. shopID as shopId,
  155. serviceProviderID as serviceProviderId,
  156. name,
  157. userName,
  158. email,
  159. mobile,
  160. bindMobile,
  161. password,
  162. userIdentity,
  163. (select status from club where userId = user.userId limit 1) as clubStatus,
  164. manufacturerStatus,
  165. serviceProviderStatus,
  166. auditNote,
  167. auditStatus,
  168. agreeFlag,
  169. registerTime,
  170. registerIP as registerIp,
  171. guideFlag,
  172. validFlag,
  173. userBeans,
  174. ableUserMoney,
  175. image
  176. from user
  177. where userID = #{userId}
  178. </select>
  179. <select id="getUserNameByUserId" resultType="java.lang.String">
  180. select userName
  181. from user
  182. where userID = #{userId}
  183. </select>
  184. <select id="getAfterSalesPhone" resultType="java.lang.String">
  185. select contactNumber
  186. from cm_mall_organize
  187. where id = 0
  188. and delFlag = '0'
  189. </select>
  190. <select id="getSensitiveWords" resultType="java.lang.String">
  191. select words
  192. from cm_sensitive_words
  193. where id = 1 and status = 1
  194. <if test="checkPoint != null">
  195. and checkPoints like concat('%',#{checkPoint},'%')
  196. </if>
  197. </select>
  198. <select id="findLabelsByLableIds" resultType="java.lang.String">
  199. select keyword
  200. from cm_user_search_frequency
  201. where trueStatus = 1
  202. and delStatus = 1
  203. and id in (#{labelIds})
  204. </select>
  205. <select id="findBankByUserId" resultType="java.lang.Integer">
  206. SELECT COUNT(id)
  207. FROM cm_quickpay_info
  208. WHERE userId = #{userId}
  209. and delflag = 0
  210. </select>
  211. <select id="getByUserId" resultType="java.lang.Integer">
  212. <if test="userType != null">
  213. <if test="userType == 1">
  214. SELECT userID from club WHERE clubId = #{id}
  215. </if>
  216. <if test="userType == 2">
  217. SELECT userID from shop WHERE shopId = #{id}
  218. </if>
  219. <if test="userType == 3">
  220. SELECT userID from serviceprovider WHERE serviceProviderID = #{id}
  221. </if>
  222. </if>
  223. </select>
  224. <select id="getByMobile" resultType="String">
  225. select bindMobile from user where userIdentity=#{userIdentity} and userId=#{userId}
  226. </select>
  227. <select id="getByUserCount" resultType="java.lang.Integer">
  228. SELECT count(1) from user
  229. <where>
  230. <if test="userID != null and userID != ''">
  231. and user.userID
  232. <if test="userID.toUpperCase().indexOf('=')==-1">
  233. = #{userID}
  234. </if>
  235. <if test="userID.toUpperCase().indexOf('=')!=-1">
  236. <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  237. <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
  238. <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
  239. #{userIDIn}
  240. </foreach>
  241. </if>
  242. </if>
  243. <if test="userOrganizeID != null and userOrganizeID != ''">
  244. and user.userOrganizeID
  245. <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
  246. = #{userOrganizeID}
  247. </if>
  248. <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
  249. <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  250. <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
  251. <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
  252. #{typeIn}
  253. </foreach>
  254. </if>
  255. </if>
  256. <if test="account != null and account != ''"> and user.account = #{account}</if>
  257. <if test="mobile != null and mobile != ''"> and user.mobile = #{mobile}</if>
  258. <if test="bindMobile != null and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
  259. <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
  260. <if test="userIdentity != null and userIdentity != ''">
  261. and user.userIdentity
  262. <if test="userIdentity.toUpperCase().indexOf('=')==-1">
  263. = #{userIdentity}
  264. </if>
  265. <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
  266. <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
  267. <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
  268. <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
  269. #{typeIn}
  270. </foreach>
  271. </if>
  272. </if>
  273. <if test="email != null and email != ''"> and user.email = #{email}</if>
  274. <if test="userName != null and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
  275. <if test="realName != null and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
  276. <if test="source != null and source != ''"> and user.source = #{source}</if>
  277. <if test="image != null and image != ''"> and user.image = #{image}</if>
  278. <if test="password != null and password != ''"> and user.password = #{password}</if>
  279. <if test="name != null and name != ''"> and user.name like concat('%', #{name}, '%')</if>
  280. <if test="registerUserTypeID != null and registerUserTypeID != ''">
  281. and user.registerUserTypeID
  282. <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
  283. = #{registerUserTypeID}
  284. </if>
  285. <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
  286. <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  287. <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
  288. <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
  289. #{typeIn}
  290. </foreach>
  291. </if>
  292. </if>
  293. <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
  294. <if test="shopID != null "> and user.shopID = #{shopID}</if>
  295. <if test="auditStatus != null and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
  296. <if test="auditTime != null and auditTime != ''"> and user.auditTime = #{auditTime}</if>
  297. <if test="auditNote != null and auditNote != ''"> and user.auditNote = #{auditNote}</if>
  298. <if test="registerTime != null and registerTime != ''"> and user.registerTime = #{registerTime}</if>
  299. <if test="registerIP != null and registerIP != ''"> and user.registerIP = #{registerIP}</if>
  300. <if test="ipAddress != null and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
  301. <if test="loginTime != null and loginTime != ''"> and user.loginTime = #{loginTime}</if>
  302. <if test="loginIP != null and loginIP != ''"> and user.loginIP = #{loginIP}</if>
  303. <if test="validFlag != null and validFlag != ''"> and user.validFlag = #{validFlag}</if>
  304. <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
  305. <if test="clubID != null "> and user.clubID = #{clubID}</if>
  306. <if test="agreeFlag != null and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
  307. <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
  308. <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
  309. <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
  310. <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
  311. <if test="logoffTime != null and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
  312. <if test="appKey != null and appKey != ''"> and user.appKey = #{appKey}</if>
  313. <if test="appSecret != null and appSecret != ''"> and user.appSecret = #{appSecret}</if>
  314. <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
  315. <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
  316. <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
  317. <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
  318. <if test="tipStatus != null and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
  319. <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
  320. </where>
  321. group by user.userID
  322. order by user.loginTime desc
  323. </select>
  324. <insert id="addUser" parameterType="CmUser" useGeneratedKeys="true" keyProperty="userID">
  325. insert into user
  326. <trim prefix="(" suffix=")" suffixOverrides=",">
  327. <if test="userID != null and userID != ''">userID,</if>
  328. <if test="userOrganizeID != null">userOrganizeID,</if>
  329. <if test="account != null and account != ''">account,</if>
  330. <if test="mobile != null and mobile != ''">mobile,</if>
  331. <if test="bindMobile != null and bindMobile != ''">bindMobile,</if>
  332. <if test="userPermission != null">userPermission,</if>
  333. <if test="userIdentity != null">userIdentity,</if>
  334. <if test="email != null and email != ''">email,</if>
  335. <if test="userName != null and userName != ''">userName,</if>
  336. <if test="realName != null and realName != ''">realName,</if>
  337. <if test="source != null and source != ''">source,</if>
  338. <if test="image != null and image != ''">image,</if>
  339. <if test="password != null and password != ''">password,</if>
  340. <if test="name != null and name != ''">name,</if>
  341. <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID,</if>
  342. <if test="manufacturerStatus != null">manufacturerStatus,</if>
  343. <if test="shopID != null">shopID,</if>
  344. <if test="auditStatus != null and auditStatus != ''">auditStatus,</if>
  345. <if test="auditTime != null and auditTime != ''">auditTime,</if>
  346. <if test="auditNote != null and auditNote != ''">auditNote,</if>
  347. <if test="registerTime != null and registerTime != ''">registerTime,</if>
  348. <if test="registerIP != null and registerIP != ''">registerIP,</if>
  349. <if test="ipAddress != null and ipAddress != ''">ipAddress,</if>
  350. <if test="loginTime != null and loginTime != ''">loginTime,</if>
  351. <if test="loginIP != null and loginIP != ''">loginIP,</if>
  352. <if test="validFlag != null and validFlag != ''">validFlag,</if>
  353. <if test="clubStatus != null">clubStatus,</if>
  354. <if test="clubID != null">clubID,</if>
  355. <if test="agreeFlag != null and agreeFlag != ''">agreeFlag,</if>
  356. <if test="serviceProviderStatus != null">serviceProviderStatus,</if>
  357. <if test="serviceProviderID != null">serviceProviderID,</if>
  358. <if test="userMoney != null">userMoney,</if>
  359. <if test="ableUserMoney != null">ableUserMoney,</if>
  360. <if test="logoffTime != null and logoffTime != ''">logoffTime,</if>
  361. <if test="appKey != null and appKey != ''">appKey,</if>
  362. <if test="appSecret != null and appSecret != ''">appSecret,</if>
  363. <if test="scanFlag != null">scanFlag,</if>
  364. <if test="userBeans != null">userBeans,</if>
  365. <if test="guideFlag != null">guideFlag,</if>
  366. <if test="loginFailTime != null">loginFailTime,</if>
  367. <if test="tipStatus != null and tipStatus != ''">tipStatus,</if>
  368. <if test="onlineMoney != null">onlineMoney,</if>
  369. </trim>
  370. <trim prefix="values (" suffix=")" suffixOverrides=",">
  371. <if test="userID != null and userID != ''">#{userID},</if>
  372. <if test="userOrganizeID != null">#{userOrganizeID},</if>
  373. <if test="account != null and account != ''">#{account},</if>
  374. <if test="mobile != null and mobile != ''">#{mobile},</if>
  375. <if test="bindMobile != null and bindMobile != ''">#{bindMobile},</if>
  376. <if test="userPermission != null">#{userPermission},</if>
  377. <if test="userIdentity != null">#{userIdentity},</if>
  378. <if test="email != null and email != ''">#{email},</if>
  379. <if test="userName != null and userName != ''">#{userName},</if>
  380. <if test="realName != null and realName != ''">#{realName},</if>
  381. <if test="source != null and source != ''">#{source},</if>
  382. <if test="image != null and image != ''">#{image},</if>
  383. <if test="password != null and password != ''">#{password},</if>
  384. <if test="name != null and name != ''">#{name},</if>
  385. <if test="registerUserTypeID != null and registerUserTypeID != ''">#{registerUserTypeID},</if>
  386. <if test="manufacturerStatus != null">#{manufacturerStatus},</if>
  387. <if test="shopID != null">#{shopID},</if>
  388. <if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
  389. <if test="auditTime != null and auditTime != ''">#{auditTime},</if>
  390. <if test="auditNote != null and auditNote != ''">#{auditNote},</if>
  391. <if test="registerTime != null and registerTime != ''">#{registerTime},</if>
  392. <if test="registerIP != null and registerIP != ''">#{registerIP},</if>
  393. <if test="ipAddress != null and ipAddress != ''">#{ipAddress},</if>
  394. <if test="loginTime != null and loginTime != ''">#{loginTime},</if>
  395. <if test="loginIP != null and loginIP != ''">#{loginIP},</if>
  396. <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
  397. <if test="clubStatus != null">#{clubStatus},</if>
  398. <if test="clubID != null">#{clubID},</if>
  399. <if test="agreeFlag != null and agreeFlag != ''">#{agreeFlag},</if>
  400. <if test="serviceProviderStatus != null">#{serviceProviderStatus},</if>
  401. <if test="serviceProviderID != null">#{serviceProviderID},</if>
  402. <if test="userMoney != null">#{userMoney},</if>
  403. <if test="ableUserMoney != null">#{ableUserMoney},</if>
  404. <if test="logoffTime != null and logoffTime != ''">#{logoffTime},</if>
  405. <if test="appKey != null and appKey != ''">#{appKey},</if>
  406. <if test="appSecret != null and appSecret != ''">#{appSecret},</if>
  407. <if test="scanFlag != null">#{scanFlag},</if>
  408. <if test="userBeans != null">#{userBeans},</if>
  409. <if test="guideFlag != null">#{guideFlag},</if>
  410. <if test="loginFailTime != null">#{loginFailTime},</if>
  411. <if test="tipStatus != null and tipStatus != ''">#{tipStatus},</if>
  412. <if test="onlineMoney != null">#{onlineMoney},</if>
  413. </trim>
  414. </insert>
  415. <update id="updateUser" parameterType="CmUser">
  416. update user
  417. <trim prefix="SET" suffixOverrides=",">
  418. <if test="userOrganizeID != null">userOrganizeID = #{userOrganizeID},</if>
  419. <if test="account != null and account != ''">account = #{account},</if>
  420. <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
  421. <if test="bindMobile != null and bindMobile != ''">bindMobile = #{bindMobile},</if>
  422. <if test="userPermission != null">userPermission = #{userPermission},</if>
  423. <if test="userIdentity != null">userIdentity = #{userIdentity},</if>
  424. <if test="email != null and email != ''">email = #{email},</if>
  425. <if test="userName != null and userName != ''">userName = #{userName},</if>
  426. <if test="realName != null and realName != ''">realName = #{realName},</if>
  427. <if test="source != null and source != ''">source = #{source},</if>
  428. <if test="image != null and image != ''">image = #{image},</if>
  429. <if test="password != null and password != ''">password = #{password},</if>
  430. <if test="name != null and name != ''">name = #{name},</if>
  431. <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID = #{registerUserTypeID},</if>
  432. <if test="manufacturerStatus != null">manufacturerStatus = #{manufacturerStatus},</if>
  433. <if test="shopID != null">shopID = #{shopID},</if>
  434. <if test="auditStatus != null and auditStatus != ''">auditStatus = #{auditStatus},</if>
  435. <if test="auditTime != null and auditTime != ''">auditTime = #{auditTime},</if>
  436. <if test="auditNote != null and auditNote != ''">auditNote = #{auditNote},</if>
  437. <if test="registerTime != null and registerTime != ''">registerTime = #{registerTime},</if>
  438. <if test="registerIP != null and registerIP != ''">registerIP = #{registerIP},</if>
  439. <if test="ipAddress != null and ipAddress != ''">ipAddress = #{ipAddress},</if>
  440. <if test="loginTime != null and loginTime != ''">loginTime = #{loginTime},</if>
  441. <if test="loginIP != null and loginIP != ''">loginIP = #{loginIP},</if>
  442. <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
  443. <if test="clubStatus != null">clubStatus = #{clubStatus},</if>
  444. <if test="clubID != null">clubID = #{clubID},</if>
  445. <if test="agreeFlag != null and agreeFlag != ''">agreeFlag = #{agreeFlag},</if>
  446. <if test="serviceProviderStatus != null">serviceProviderStatus = #{serviceProviderStatus},</if>
  447. <if test="serviceProviderID != null">serviceProviderID = #{serviceProviderID},</if>
  448. <if test="userMoney != null">userMoney = #{userMoney},</if>
  449. <if test="ableUserMoney != null">ableUserMoney = #{ableUserMoney},</if>
  450. <if test="logoffTime != null and logoffTime != ''">logoffTime = #{logoffTime},</if>
  451. <if test="appKey != null and appKey != ''">appKey = #{appKey},</if>
  452. <if test="appSecret != null and appSecret != ''">appSecret = #{appSecret},</if>
  453. <if test="scanFlag != null">scanFlag = #{scanFlag},</if>
  454. <if test="userBeans != null">userBeans = #{userBeans},</if>
  455. <if test="guideFlag != null">guideFlag = #{guideFlag},</if>
  456. <if test="loginFailTime != null">loginFailTime = #{loginFailTime},</if>
  457. <if test="tipStatus != null and tipStatus != ''">tipStatus = #{tipStatus},</if>
  458. <if test="onlineMoney != null">onlineMoney = #{onlineMoney},</if>
  459. </trim>
  460. where userID = #{userID}
  461. </update>
  462. <update id="updateClubStatus" parameterType="CmUser">
  463. update club
  464. <trim prefix="SET" suffixOverrides=",">
  465. <if test="status != null">status = #{status},</if>
  466. </trim>
  467. where userId = #{userId}
  468. </update>
  469. <resultMap type="CmUser" id="UserResult">
  470. <result property="userID" column="userID" />
  471. <result property="userOrganizeID" column="userOrganizeID" />
  472. <result property="account" column="account" />
  473. <result property="mobile" column="mobile" />
  474. <result property="bindMobile" column="bindMobile" />
  475. <result property="userPermission" column="userPermission" />
  476. <result property="userIdentity" column="userIdentity" />
  477. <result property="email" column="email" />
  478. <result property="userName" column="userName" />
  479. <result property="realName" column="realName" />
  480. <result property="source" column="source" />
  481. <result property="image" column="image" />
  482. <result property="password" column="password" />
  483. <result property="name" column="name" />
  484. <result property="registerUserTypeID" column="registerUserTypeID" />
  485. <result property="manufacturerStatus" column="manufacturerStatus" />
  486. <result property="shopID" column="shopID" />
  487. <result property="auditStatus" column="auditStatus" />
  488. <result property="auditTime" column="auditTime" />
  489. <result property="auditNote" column="auditNote" />
  490. <result property="registerTime" column="registerTime" />
  491. <result property="registerIP" column="registerIP" />
  492. <result property="ipAddress" column="ipAddress" />
  493. <result property="loginTime" column="loginTime" />
  494. <result property="loginIP" column="loginIP" />
  495. <result property="validFlag" column="validFlag" />
  496. <result property="clubStatus" column="clubStatus" />
  497. <result property="clubID" column="clubID" />
  498. <result property="agreeFlag" column="agreeFlag" />
  499. <result property="serviceProviderStatus" column="serviceProviderStatus" />
  500. <result property="serviceProviderID" column="serviceProviderID" />
  501. <result property="userMoney" column="userMoney" />
  502. <result property="ableUserMoney" column="ableUserMoney" />
  503. <result property="logoffTime" column="logoffTime" />
  504. <result property="appKey" column="appKey" />
  505. <result property="appSecret" column="appSecret" />
  506. <result property="scanFlag" column="scanFlag" />
  507. <result property="userBeans" column="userBeans" />
  508. <result property="guideFlag" column="guideFlag" />
  509. <result property="loginFailTime" column="loginFailTime" />
  510. <result property="tipStatus" column="tipStatus" />
  511. <result property="onlineMoney" column="onlineMoney" />
  512. </resultMap>
  513. <sql id="selectUserVo">
  514. select
  515. user.userID,
  516. user.userOrganizeID,
  517. user.account,
  518. user.mobile,
  519. user.bindMobile,
  520. user.userPermission,
  521. user.userIdentity,
  522. user.email,
  523. user.userName,
  524. user.realName,
  525. user.source,
  526. user.image,
  527. user.password,
  528. user.name,
  529. user.registerUserTypeID,
  530. user.manufacturerStatus,
  531. user.shopID,
  532. user.auditStatus,
  533. user.auditTime,
  534. user.auditNote,
  535. user.registerTime,
  536. user.registerIP,
  537. user.ipAddress,
  538. user.loginTime,
  539. user.loginIP,
  540. user.validFlag,
  541. user.clubStatus,
  542. user.clubID,
  543. user.agreeFlag,
  544. user.serviceProviderStatus,
  545. user.serviceProviderID,
  546. ifnull(user.userMoney,0) AS userMoney,
  547. ifnull(user.ableUserMoney,0) AS ableUserMoney,
  548. user.logoffTime,
  549. user.appKey,
  550. user.appSecret,
  551. user.scanFlag,
  552. user.userBeans,
  553. user.guideFlag,
  554. user.loginFailTime,
  555. user.tipStatus,
  556. ifnull(user.onlineMoney,0) AS onlineMoney
  557. </sql>
  558. <select id="getByUser" parameterType="CmUser" resultMap="UserResult">
  559. <include refid="selectUserVo"/>
  560. from user AS user
  561. <where>
  562. <if test="userID != null and userID != ''">
  563. and user.userID
  564. <if test="userID.toUpperCase().indexOf('=')==-1">
  565. = #{userID}
  566. </if>
  567. <if test="userID.toUpperCase().indexOf('=')!=-1">
  568. <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  569. <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
  570. <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
  571. #{userIDIn}
  572. </foreach>
  573. </if>
  574. </if>
  575. <if test="userOrganizeID != null and userOrganizeID != ''">
  576. and user.userOrganizeID
  577. <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
  578. = #{userOrganizeID}
  579. </if>
  580. <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
  581. <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  582. <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
  583. <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
  584. #{typeIn}
  585. </foreach>
  586. </if>
  587. </if>
  588. <if test="account != null and account != ''"> and user.account = #{account}</if>
  589. <if test="mobile != null and mobile != ''"> and user.mobile = #{mobile}</if>
  590. <if test="bindMobile != null and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
  591. <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
  592. <if test="userIdentity != null and userIdentity != ''">
  593. and user.userIdentity
  594. <if test="userIdentity.toUpperCase().indexOf('=')==-1">
  595. = #{userIdentity}
  596. </if>
  597. <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
  598. <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
  599. <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
  600. <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
  601. #{typeIn}
  602. </foreach>
  603. </if>
  604. </if>
  605. <if test="email != null and email != ''"> and user.email = #{email}</if>
  606. <if test="userName != null and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
  607. <if test="realName != null and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
  608. <if test="source != null and source != ''"> and user.source = #{source}</if>
  609. <if test="image != null and image != ''"> and user.image = #{image}</if>
  610. <if test="password != null and password != ''"> and user.password = #{password}</if>
  611. <if test="name != null and name != ''"> and user.name like concat('%', #{name}, '%')</if>
  612. <if test="registerUserTypeID != null and registerUserTypeID != ''">
  613. and user.registerUserTypeID
  614. <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
  615. = #{registerUserTypeID}
  616. </if>
  617. <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
  618. <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
  619. <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
  620. <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
  621. #{typeIn}
  622. </foreach>
  623. </if>
  624. </if>
  625. <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
  626. <if test="shopID != null "> and user.shopID = #{shopID}</if>
  627. <if test="auditStatus != null and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
  628. <if test="auditTime != null and auditTime != ''"> and user.auditTime = #{auditTime}</if>
  629. <if test="auditNote != null and auditNote != ''"> and user.auditNote = #{auditNote}</if>
  630. <if test="registerTime != null and registerTime != ''"> and user.registerTime = #{registerTime}</if>
  631. <if test="registerIP != null and registerIP != ''"> and user.registerIP = #{registerIP}</if>
  632. <if test="ipAddress != null and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
  633. <if test="loginTime != null and loginTime != ''"> and user.loginTime = #{loginTime}</if>
  634. <if test="loginIP != null and loginIP != ''"> and user.loginIP = #{loginIP}</if>
  635. <if test="validFlag != null and validFlag != ''"> and user.validFlag = #{validFlag}</if>
  636. <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
  637. <if test="clubID != null "> and user.clubID = #{clubID}</if>
  638. <if test="agreeFlag != null and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
  639. <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
  640. <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
  641. <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
  642. <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
  643. <if test="logoffTime != null and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
  644. <if test="appKey != null and appKey != ''"> and user.appKey = #{appKey}</if>
  645. <if test="appSecret != null and appSecret != ''"> and user.appSecret = #{appSecret}</if>
  646. <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
  647. <if test="userBeans != null ">and user.userBeans = #{userBeans}</if>
  648. <if test="guideFlag != null ">and user.guideFlag = #{guideFlag}</if>
  649. <if test="loginFailTime != null ">and user.loginFailTime = #{loginFailTime}</if>
  650. <if test="tipStatus != null and tipStatus != ''">and user.tipStatus = #{tipStatus}</if>
  651. <if test="onlineMoney != null ">and user.onlineMoney = #{onlineMoney}</if>
  652. </where>
  653. group by user.userID
  654. order by user.loginTime desc
  655. limit 0,1
  656. </select>
  657. <select id="getUserType" resultType="int">
  658. select user.userIdentity
  659. FROM user user
  660. WHERE user.userId = #{userId}
  661. </select>
  662. <select id="findUserByMobile" resultMap="UserResult">
  663. <include refid="selectUserVo"/>
  664. FROM user user
  665. WHERE user.bindMobile=#{mobile}
  666. <if test="oldUserId !=null and oldUserId !=''">
  667. and user.userId!=#{oldUserId}
  668. </if>
  669. <if test="userIdentity !=null">
  670. and user.userIdentity=#{userIdentity}
  671. </if>
  672. limit 0,1
  673. </select>
  674. <select id="findAdminMobileList" parameterType="String" resultType="String">
  675. select
  676. cm_admin_mobile.mobile
  677. from cm_admin_mobile AS cm_admin_mobile
  678. <where>cm_admin_mobile.delFlag = 0 and cm_admin_mobile.enabledStatus = 1
  679. <if test="type != null and type != ''">and cm_admin_mobile.type = #{type}</if>
  680. </where>
  681. group by cm_admin_mobile.id
  682. order by cm_admin_mobile.createTime desc
  683. </select>
  684. <insert id="addWxUnion" parameterType="WxUnion">
  685. insert into wx_union
  686. <trim prefix="(" suffix=")" suffixOverrides=",">
  687. <if test="unionId != null and unionId != ''">unionId,</if>
  688. <if test="type != null and type == 1">
  689. appOpenid,
  690. </if>
  691. <if test="type != null and type == 2">
  692. heheOpenid,
  693. </if>
  694. <if test="type != null and type == 3">
  695. crmOpenid,
  696. </if>
  697. <if test="type != null and type == 4">
  698. miniProgramOpenId,
  699. </if>
  700. </trim>
  701. <trim prefix="values (" suffix=")" suffixOverrides=",">
  702. <if test="unionId != null and unionId != ''">#{unionId},</if>
  703. <if test="type != null">
  704. #{openid},
  705. </if>
  706. </trim>
  707. </insert>
  708. <update id="updateWxUnion" parameterType="WxUnion">
  709. update wx_union
  710. <trim prefix="SET" suffixOverrides=",">
  711. <if test="type != null and type == 1">
  712. appOpenid = #{openid},
  713. </if>
  714. <if test="type != null and type == 2">
  715. heheOpenid = #{openid},
  716. </if>
  717. <if test="type != null and type == 3">
  718. crmOpenid = #{openid},
  719. </if>
  720. <if test="type != null and type == 4">
  721. miniProgramOpenId = #{openid},
  722. </if>
  723. </trim>
  724. where unionId = #{unionId}
  725. </update>
  726. <select id="getByWxUnion" parameterType="WxUnion" resultType="WxUnion">
  727. select
  728. wx_union.unionId,
  729. wx_union.userId,
  730. wx_union.crmOpenid,
  731. wx_union.appOpenid,
  732. wx_union.miniProgramOpenId,
  733. wx_union.heheOpenid
  734. from wx_union AS wx_union
  735. <where>
  736. <if test="unionId != null and unionId != ''">
  737. and wx_union.unionId = #{unionId}
  738. </if>
  739. <if test="type != null and type == 1">
  740. and wx_union.appOpenid = #{openid}
  741. </if>
  742. <if test="type != null and type == 2">
  743. and wx_union.heheOpenid = #{openid}
  744. </if>
  745. <if test="type != null and type == 3">
  746. and wx_union.crmOpenid = #{openid}
  747. </if>
  748. <if test="type != null and type == 4">
  749. and wx_union.miniProgramOpenId = #{openid}
  750. </if>
  751. </where>
  752. limit 1
  753. </select>
  754. <select id="getRelatedImageList" parameterType="CmRelatedImage" resultType="String">
  755. select
  756. cm_related_image.image
  757. from cm_related_image AS cm_related_image
  758. <where> cm_related_image.delFlag = 0
  759. <if test="id != null and id != ''"> and cm_related_image.id = #{id}</if>
  760. <if test="type != null and type != ''">
  761. and cm_related_image.type
  762. <if test="type.toUpperCase().indexOf('=')==-1">
  763. = #{type}
  764. </if>
  765. <if test="type.toUpperCase().indexOf('=')!=-1">
  766. <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
  767. <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
  768. <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
  769. #{typeIn}
  770. </foreach>
  771. </if>
  772. </if>
  773. <if test="authorId != null and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
  774. <if test="image != null and image != ''"> and cm_related_image.image = #{image}</if>
  775. </where>
  776. group by cm_related_image.id
  777. order by cm_related_image.createTime desc
  778. </select>
  779. </mapper>