CmUserMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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.caimei.modules.user.dao.CmUserDao">
  4. <sql id="cmUserColumns">
  5. a.userID AS "userID",
  6. a.mobile AS "mobile",
  7. a.userOrganizeID AS "userOrganizeID",
  8. a.bindMobile AS "bindMobile",
  9. a.email AS "email",
  10. a.account AS "account",
  11. a.realName AS "realName",
  12. a.userIdentity AS "userIdentity",
  13. a.companyUserID AS "companyUserID",
  14. a.openID AS "openID",
  15. a.userName AS "userName",
  16. a.source AS "source",
  17. a.image AS "image",
  18. a.password AS "password",
  19. a.userLevelID AS "userLevelID",
  20. a.name AS "name",
  21. a.nick AS "nick",
  22. a.sex AS "sex",
  23. a.registerUserTypeID AS "registerUserTypeID",
  24. a.manufacturerFlag AS "manufacturerFlag",
  25. a.manufacturerStatus AS "manufacturerStatus",
  26. a.shopID AS "shopID",
  27. a.serviceProviderFlag AS "serviceProviderFlag",
  28. a.clubFlag AS "clubFlag",
  29. a.masterFlag AS "masterFlag",
  30. a.normalFlag AS "normalFlag",
  31. a.auditStatus AS "auditStatus",
  32. a.auditTime AS "auditTime",
  33. a.auditNote AS "auditNote",
  34. a.registerTime AS "registerTime",
  35. a.registerIP AS "registerIP",
  36. a.loginTime AS "loginTime",
  37. a.loginFailTime AS "loginFailTime",
  38. a.loginIP AS "loginIP",
  39. a.validFlag AS "validFlag",
  40. a.emailCheckFlag AS "emailCheckFlag",
  41. a.mobileCheckFlag AS "mobileCheckFlag",
  42. a.clubStatus AS "clubStatus",
  43. a.clubID AS "clubID",
  44. a.agreeFlag AS "agreeFlag",
  45. a.activationCode AS "activationCode",
  46. a.activationDate AS "activationDate",
  47. a.serviceProviderStatus AS "serviceProviderStatus",
  48. a.serviceProviderID AS "serviceProviderID",
  49. a.masterStatus AS "masterStatus",
  50. a.masterID AS "masterID",
  51. a.userMoney AS "userMoney",
  52. a.ableUserMoney as "ableUserMoney",
  53. a.point AS "point",
  54. a.shopERPFlag AS "shopERPFlag",
  55. a.fromUserID AS "fromUserID",
  56. a.fromUserName AS "fromUserName",
  57. a.logoffTime AS "logoffTime",
  58. a.appKey AS "appKey",
  59. a.appSecret AS "appSecret",
  60. a.sampleFlag AS "sampleFlag",
  61. a.scanFlag AS "scanFlag",
  62. a.sysroleid AS "sysroleid",
  63. a.gender AS "gender",
  64. a.age AS "age",
  65. a.salerbuyer AS "salerbuyer",
  66. a.position AS "position",
  67. a.skill AS "skill",
  68. a.workage AS "workage",
  69. a.wechat AS "wechat",
  70. a.qq AS "qq",
  71. a.smsFlag AS "smsFlag",
  72. a.userBeans AS "userBeans",
  73. a.privateShopFlag AS "privateShopFlag",
  74. a.privateClubFlag AS "privateClubFlag",
  75. a.isMeiDaoAuthorized AS "isMeiDaoAuthorized",
  76. a.guideFlag AS "guideFlag",
  77. a.userPermission AS "userPermission"
  78. </sql>
  79. <sql id="cmUserJoins">
  80. </sql>
  81. <select id="get" resultType="CmUser">
  82. SELECT
  83. <include refid="cmUserColumns"/>
  84. FROM user a
  85. <include refid="cmUserJoins"/>
  86. WHERE a.userID = #{id}
  87. </select>
  88. <select id="findList" resultType="CmUser">
  89. SELECT
  90. <include refid="cmUserColumns"/>
  91. FROM user a
  92. <include refid="cmUserJoins"/>
  93. <where>
  94. <if test="userID != null and userID != ''">
  95. AND a.userID = #{userID}
  96. </if>
  97. <if test="mobile != null and mobile != ''">
  98. AND (a.mobile LIKE
  99. <if test="dbName == 'oracle'">'%'||#{mobile}||'%'</if>
  100. <if test="dbName == 'mssql'">'%'+#{mobile}+'%'</if>
  101. <if test="dbName == 'mysql'">concat('%',#{mobile},'%')</if>
  102. OR a.bindMobile LIKE
  103. <if test="dbName == 'oracle'">'%'||#{mobile}||'%'</if>
  104. <if test="dbName == 'mssql'">'%'+#{mobile}+'%'</if>
  105. <if test="dbName == 'mysql'">concat('%',#{mobile},'%')</if>
  106. )
  107. </if>
  108. <if test="email != null and email != ''">
  109. AND a.email LIKE
  110. <if test="dbName == 'oracle'">'%'||#{email}||'%'</if>
  111. <if test="dbName == 'mssql'">'%'+#{email}+'%'</if>
  112. <if test="dbName == 'mysql'">concat('%',#{email},'%')</if>
  113. </if>
  114. <if test="userName != null and userName != ''">
  115. AND a.userName LIKE
  116. <if test="dbName == 'oracle'">'%'||#{userName}||'%'</if>
  117. <if test="dbName == 'mssql'">'%'+#{userName}+'%'</if>
  118. <if test="dbName == 'mysql'">concat('%',#{userName},'%')</if>
  119. </if>
  120. <if test="startTime != null and startTime != ''">
  121. AND (a.registerTime &gt; #{startTime} OR a.registerTime = #{startTime})
  122. </if>
  123. <if test="endTime != null and endTime != ''">
  124. AND (a.registerTime &lt; #{endTime} OR a.registerTime = #{endTime})
  125. </if>
  126. <if test="userOrganizeID != null and userOrganizeID != ''">
  127. AND a.userOrganizeID = #{userOrganizeID}
  128. </if>
  129. <choose>
  130. <when test="registerUserTypeID != null and registerUserTypeID != ''">
  131. AND a.registerUserTypeID = #{registerUserTypeID}
  132. </when>
  133. <otherwise>
  134. AND a.registerUserTypeID IN (0,10,1,24,34,2,32,3,23,33)
  135. </otherwise>
  136. </choose>
  137. <!--<if test="registerUserTypeID != null and registerUserTypeID != ''">-->
  138. <!--AND a.registerUserTypeID = #{registerUserTypeID}-->
  139. <!--</if>-->
  140. </where>
  141. <choose>
  142. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  143. ORDER BY ${page.orderBy}
  144. </when>
  145. <otherwise>
  146. ORDER BY a.userID DESC
  147. </otherwise>
  148. </choose>
  149. </select>
  150. <!--适用于企业通过手机号码查询用户-->
  151. <select id="findListBuyBindMobile" resultType="CmUser">
  152. SELECT
  153. *
  154. FROM user a
  155. <where>
  156. a.bindMobile = #{bindMobile}
  157. <if test="clubID != null and clubID != ''">
  158. AND a.clubID != #{clubID}
  159. </if>
  160. </where>
  161. </select>
  162. <!--星范商城查询会所-->
  163. <select id="findListBuyUserInfo" resultType="CmUser">
  164. SELECT
  165. a.*
  166. ,c.linkMan AS "linkMan"
  167. ,t.name as "town"
  168. ,ci.name as "city"
  169. ,p.name as "province"
  170. ,c.address AS "address"
  171. FROM user a
  172. LEFT JOIN club c on c.userID = a.userID
  173. LEFT JOIN town t on t.townID = c.townID
  174. LEFT JOIN city ci ON ci.cityID = c.cityID
  175. LEFT JOIN province p ON p.provinceID = c.provinceID
  176. <where>
  177. a.userOrganizeID = #{userOrganizeID}
  178. <if test="bindMobile != null and bindMobile != ''">
  179. AND a.bindMobile LIKE concat('%',#{bindMobile},'%')
  180. </if>
  181. <if test="name != null and name != ''">
  182. AND a.name LIKE concat('%',#{name},'%')
  183. </if>
  184. <if test="linkMan != null and linkMan != ''">
  185. AND c.linkMan LIKE concat('%',#{linkMan},'%')
  186. </if>
  187. <if test="startTime != null and startTime != ''">
  188. AND a.registerTime <![CDATA[ >= ]]> #{startTime}
  189. </if>
  190. <if test="endTime != null and endTime != ''">
  191. AND a.registerTime <![CDATA[ <= ]]> #{endTime}
  192. </if>
  193. <if test="clubStatus != null and clubStatus != ''">
  194. AND a.clubStatus = #{clubStatus}
  195. </if>
  196. </where>
  197. ORDER BY a.registerTime DESC
  198. </select>
  199. <select id="findAllList" resultType="CmUser">
  200. SELECT
  201. <include refid="cmUserColumns"/>
  202. FROM user a
  203. <include refid="cmUserJoins"/>
  204. <where>
  205. </where>
  206. <choose>
  207. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  208. ORDER BY ${page.orderBy}
  209. </when>
  210. <otherwise>
  211. ORDER BY a.userID DESC
  212. </otherwise>
  213. </choose>
  214. </select>
  215. <insert id="insert" parameterType="CmUser" keyProperty="userID" useGeneratedKeys="true">
  216. INSERT INTO user(
  217. userOrganizeID,
  218. account,
  219. realName,
  220. userIdentity,
  221. companyUserID,
  222. openID,
  223. mobile,
  224. bindMobile,
  225. userPermission,
  226. email,
  227. userName,
  228. source,
  229. image,
  230. password,
  231. userLevelID,
  232. name,
  233. nick,
  234. sex,
  235. registerUserTypeID,
  236. manufacturerFlag,
  237. manufacturerStatus,
  238. shopID,
  239. serviceProviderFlag,
  240. clubFlag,
  241. masterFlag,
  242. normalFlag,
  243. auditStatus,
  244. auditTime,
  245. auditNote,
  246. registerTime,
  247. registerIP,
  248. loginTime,
  249. loginFailTime,
  250. loginIP,
  251. validFlag,
  252. emailCheckFlag,
  253. mobileCheckFlag,
  254. clubStatus,
  255. <if test="clubID != null and clubID != ''">
  256. clubID,
  257. </if>
  258. agreeFlag,
  259. activationCode,
  260. activationDate,
  261. serviceProviderStatus,
  262. serviceProviderID,
  263. masterStatus,
  264. masterID,
  265. userMoney,
  266. ableUserMoney,
  267. point,
  268. shopERPFlag,
  269. fromUserID,
  270. fromUserName,
  271. logoffTime,
  272. appKey,
  273. appSecret,
  274. sampleFlag,
  275. scanFlag,
  276. sysroleid,
  277. gender,
  278. age,
  279. salerbuyer,
  280. position,
  281. skill,
  282. workage,
  283. wechat,
  284. qq,
  285. smsFlag,
  286. userBeans,
  287. privateShopFlag,
  288. privateClubFlag,
  289. isMeiDaoAuthorized
  290. ) VALUES (
  291. #{userOrganizeID},
  292. #{account},
  293. #{realName},
  294. #{userIdentity},
  295. #{companyUserID},
  296. #{openID},
  297. #{mobile},
  298. #{bindMobile},
  299. #{userPermission},
  300. #{email},
  301. #{userName},
  302. #{source},
  303. #{image},
  304. #{password},
  305. #{userLevelID},
  306. #{name},
  307. #{nick},
  308. #{sex},
  309. #{registerUserTypeID},
  310. #{manufacturerFlag},
  311. #{manufacturerStatus},
  312. #{shopID},
  313. #{serviceProviderFlag},
  314. #{clubFlag},
  315. #{masterFlag},
  316. #{normalFlag},
  317. #{auditStatus},
  318. #{auditTime},
  319. #{auditNote},
  320. #{registerTime},
  321. #{registerIP},
  322. #{loginTime},
  323. #{loginFailTime},
  324. #{loginIP},
  325. #{validFlag},
  326. #{emailCheckFlag},
  327. #{mobileCheckFlag},
  328. #{clubStatus},
  329. <if test="clubID != null and clubID != ''">
  330. #{clubID},
  331. </if>
  332. #{agreeFlag},
  333. #{activationCode},
  334. #{activationDate},
  335. #{serviceProviderStatus},
  336. #{serviceProviderID},
  337. #{masterStatus},
  338. #{masterID},
  339. #{userMoney},
  340. #{ableUserMoney},
  341. #{point},
  342. #{shopERPFlag},
  343. #{fromUserID},
  344. #{fromUserName},
  345. #{logoffTime},
  346. #{appKey},
  347. #{appSecret},
  348. #{sampleFlag},
  349. #{scanFlag},
  350. #{sysroleid},
  351. #{gender},
  352. #{age},
  353. #{salerbuyer},
  354. #{position},
  355. #{skill},
  356. #{workage},
  357. #{wechat},
  358. #{qq},
  359. #{smsFlag},
  360. #{userBeans},
  361. #{privateShopFlag},
  362. #{privateClubFlag},
  363. #{isMeiDaoAuthorized}
  364. )
  365. </insert>
  366. <update id="update">
  367. UPDATE user SET
  368. <if test="account != null and account != ''">
  369. account = #{account},
  370. </if>
  371. <if test="bindMobile != null and bindMobile != ''">
  372. bindMobile = #{bindMobile},
  373. </if>
  374. <if test="realName != null">
  375. realName = #{realName},
  376. </if>
  377. <if test="userIdentity != null and userIdentity != ''">
  378. userIdentity = #{userIdentity},
  379. </if>
  380. <if test="companyUserID != null and companyUserID != ''">
  381. companyUserID = #{companyUserID},
  382. </if>
  383. <if test="openID != null and openID != ''">
  384. openID = #{openID},
  385. </if>
  386. <if test="mobile != null and mobile != ''">
  387. mobile = #{mobile},
  388. </if>
  389. <if test="userPermission != null and userPermission != ''">
  390. userPermission = #{userPermission},
  391. </if>
  392. <if test="email != null and email != ''">
  393. email = #{email},
  394. </if>
  395. <if test="userName != null and userName != ''">
  396. userName = #{userName},
  397. </if>
  398. <if test="image != null and image != ''">
  399. image = #{image},
  400. </if>
  401. <if test="password != null and password != ''">
  402. password = #{password},
  403. </if>
  404. <if test="userLevelID != null and userLevelID != ''">
  405. userLevelID = #{userLevelID},
  406. </if>
  407. <if test="name != null and name != ''">
  408. name = #{name},
  409. </if>
  410. <if test="nick != null and nick != ''">
  411. nick = #{nick},
  412. </if>
  413. <if test="sex != null and sex != ''">
  414. sex = #{sex},
  415. </if>
  416. <if test="registerUserTypeID != null and registerUserTypeID != ''">
  417. registerUserTypeID = #{registerUserTypeID},
  418. </if>
  419. <if test="manufacturerFlag != null and manufacturerFlag != ''">
  420. manufacturerFlag = #{manufacturerFlag},
  421. </if>
  422. <if test="manufacturerStatus != null and manufacturerStatus != ''">
  423. manufacturerStatus = #{manufacturerStatus},
  424. </if>
  425. <if test="shopID != null and shopID != ''">
  426. shopID = #{shopID},
  427. </if>
  428. <if test="serviceProviderFlag != null and serviceProviderFlag != ''">
  429. serviceProviderFlag = #{serviceProviderFlag},
  430. </if>
  431. <if test="clubFlag != null and clubFlag != ''">
  432. clubFlag = #{clubFlag},
  433. </if>
  434. <if test="masterFlag != null and masterFlag != ''">
  435. masterFlag = #{masterFlag},
  436. </if>
  437. <if test="normalFlag != null and normalFlag != ''">
  438. normalFlag = #{normalFlag},
  439. </if>
  440. <if test="auditStatus != null and auditStatus != ''">
  441. auditStatus = #{auditStatus},
  442. </if>
  443. <if test="auditTime != null">
  444. auditTime = #{auditTime},
  445. </if>
  446. <if test="auditNote != null and auditNote != ''">
  447. auditNote = #{auditNote},
  448. </if>
  449. <if test="registerTime != null ">
  450. registerTime = #{registerTime},
  451. </if>
  452. <if test="registerIP != null and registerIP != ''">
  453. registerIP = #{registerIP},
  454. </if>
  455. <if test="loginTime != null and loginTime != ''">
  456. loginTime = #{loginTime},
  457. </if>
  458. <if test="loginFailTime != null and loginFailTime != ''">
  459. loginFailTime = #{loginFailTime},
  460. </if>
  461. <if test="loginIP != null and loginIP != ''">
  462. loginIP = #{loginIP},
  463. </if>
  464. <if test="validFlag != null and validFlag != ''">
  465. validFlag = #{validFlag},
  466. </if>
  467. <if test="emailCheckFlag != null and emailCheckFlag != ''">
  468. emailCheckFlag = #{emailCheckFlag},
  469. </if>
  470. <if test="mobileCheckFlag != null and mobileCheckFlag != ''">
  471. mobileCheckFlag = #{mobileCheckFlag},
  472. </if>
  473. <if test="clubStatus != null and clubStatus != ''">
  474. clubStatus = #{clubStatus},
  475. </if>
  476. <if test="clubID != null and clubID != ''">
  477. clubID = #{clubID},
  478. </if>
  479. <if test="agreeFlag != null and agreeFlag != ''">
  480. agreeFlag = #{agreeFlag},
  481. </if>
  482. <if test="activationCode != null and activationCode != ''">
  483. activationCode = #{activationCode},
  484. </if>
  485. <if test="activationDate != null ">
  486. activationDate = #{activationDate},
  487. </if>
  488. <if test="serviceProviderStatus != null and serviceProviderStatus != ''">
  489. serviceProviderStatus = #{serviceProviderStatus},
  490. </if>
  491. <if test="serviceProviderID != null and serviceProviderID != ''">
  492. serviceProviderID = #{serviceProviderID},
  493. </if>
  494. <if test="masterStatus != null and masterStatus != ''">
  495. masterStatus = #{masterStatus},
  496. </if>
  497. <if test="masterID != null and masterID != ''">
  498. masterID = #{masterID},
  499. </if>
  500. <if test="userMoney != null and userMoney != ''">
  501. userMoney = #{userMoney},
  502. </if>
  503. <if test="point != null and point != ''">
  504. point = #{point},
  505. </if>
  506. <if test="shopERPFlag != null and shopERPFlag != ''">
  507. shopERPFlag = #{shopERPFlag},
  508. </if>
  509. <if test="fromUserID != null and fromUserID != ''">
  510. fromUserID = #{fromUserID},
  511. </if>
  512. <if test="fromUserName != null and fromUserName != ''">
  513. fromUserName = #{fromUserName},
  514. </if>
  515. <if test="logoffTime != null and logoffTime != ''">
  516. logoffTime = #{logoffTime},
  517. </if>
  518. <if test="appKey != null and appKey != ''">
  519. appKey = #{appKey},
  520. </if>
  521. <if test="appSecret != null and appSecret != ''">
  522. appSecret = #{appSecret},
  523. </if>
  524. <if test="sampleFlag != null and sampleFlag != ''">
  525. sampleFlag = #{sampleFlag},
  526. </if>
  527. <if test="scanFlag != null and scanFlag != ''">
  528. scanFlag = #{scanFlag},
  529. </if>
  530. <if test="sysroleid != null and sysroleid != ''">
  531. sysroleid = #{sysroleid},
  532. </if>
  533. <if test="gender != null and gender != ''">
  534. gender = #{gender},
  535. </if>
  536. <if test="age != null and age != ''">
  537. age = #{age},
  538. </if>
  539. <if test="salerbuyer != null and salerbuyer != ''">
  540. salerbuyer = #{salerbuyer},
  541. </if>
  542. <if test="position != null and position != ''">
  543. position = #{position},
  544. </if>
  545. <if test="skill != null and skill != ''">
  546. skill = #{skill},
  547. </if>
  548. <if test="workage != null and workage != ''">
  549. workage = #{workage},
  550. </if>
  551. <if test="wechat != null and wechat != ''">
  552. wechat = #{wechat},
  553. </if>
  554. <if test="qq != null and qq != ''">
  555. qq = #{qq},
  556. </if>
  557. <if test="smsFlag != null and smsFlag != ''">
  558. smsFlag = #{smsFlag},
  559. </if>
  560. <if test="userBeans != null and userBeans != ''">
  561. userBeans = #{userBeans},
  562. </if>
  563. <if test="privateShopFlag != null and privateShopFlag != ''">
  564. privateShopFlag = #{privateShopFlag},
  565. </if>
  566. <if test="privateClubFlag != null and privateClubFlag != ''">
  567. privateClubFlag = #{privateClubFlag},
  568. </if>
  569. <if test="isMeiDaoAuthorized != null and isMeiDaoAuthorized != ''">
  570. isMeiDaoAuthorized = #{isMeiDaoAuthorized},
  571. </if>
  572. <if test="guideFlag != null and guideFlag != ''">
  573. guideFlag = #{guideFlag},
  574. </if>
  575. userID = #{userID}
  576. WHERE userID = #{userID}
  577. </update>
  578. <delete id="delete">
  579. DELETE FROM user
  580. WHERE userID = #{userID}
  581. </delete>
  582. <select id="findUserByRegisterType" resultType="CmUser">
  583. SELECT
  584. <include refid="cmUserColumns"/>
  585. FROM user
  586. <where>
  587. registerUserTypeID = #{registerUserTypeID}
  588. </where>
  589. </select>
  590. <select id="findAllPersonalUser" resultType="CmUser">
  591. SELECT
  592. <include refid="cmUserColumns"/>
  593. FROM user
  594. <where>
  595. registerUserTypeID IN (0,5,10,24,34,2,32,23,33)
  596. </where>
  597. </select>
  598. <select id="findByCompanyUserID" resultType="CmUser">
  599. SELECT
  600. <include refid="cmUserColumns"/>
  601. FROM user a
  602. WHERE
  603. a.companyUserID=#{companyUserID} AND a.userID != #{companyUserID}
  604. ORDER BY case when registerUserTypeID in (1,2,3) then 1 else 0 end ,
  605. case when registerUserTypeID in (24,23) then 1 else 0 end ,
  606. case when auditStatus = 0 then 1 else 0 end ,
  607. auditTime DESC
  608. </select>
  609. <update id="updateEmployeeStatus">
  610. UPDATE user
  611. <set>
  612. <if test="userPermission != null and userPermission != ''">
  613. userPermission = #{userPermission},
  614. </if>
  615. <if test="clubStatus != null and clubStatus != ''">
  616. clubStatus = #{clubStatus},
  617. </if>
  618. <if test="manufacturerStatus != null and manufacturerStatus != ''">
  619. manufacturerStatus = #{manufacturerStatus},
  620. </if>
  621. <if test="tipStatus != null and tipStatus != ''">
  622. tipStatus = #{tipStatus},
  623. </if>
  624. </set>
  625. WHERE companyUserID=#{companyUserID} AND userID != #{companyUserID}
  626. </update>
  627. <update id="updateUserStatus">
  628. UPDATE user
  629. <set>
  630. <if test="manufacturerStatus != null and manufacturerStatus != ''">
  631. manufacturerStatus = #{manufacturerStatus},
  632. </if>
  633. <if test="validFlag != null and validFlag != ''">
  634. validFlag = #{validFlag},
  635. </if>
  636. </set>
  637. WHERE userID = #{userID}
  638. </update>
  639. <update id="updateShopStatus">
  640. UPDATE shop
  641. <set>
  642. <if test="status != null and status != ''">
  643. status = #{status},
  644. </if>
  645. </set>
  646. WHERE userID = #{userID}
  647. </update>
  648. <update id="updateUserAudit">
  649. UPDATE user
  650. <set>
  651. <if test="auditStatus != null and auditStatus != ''">
  652. auditStatus = #{auditStatus},
  653. </if>
  654. <if test="auditNote != null and auditNote != ''">
  655. auditNote = #{auditNote},
  656. </if>
  657. <if test="manufacturerStatus != null and manufacturerStatus != ''">
  658. manufacturerStatus = #{manufacturerStatus},
  659. </if>
  660. <if test="auditTime != null and auditTime != ''">
  661. auditTime = #{auditTime},
  662. </if>
  663. <if test="validFlag != null and validFlag != ''">
  664. validFlag = #{validFlag},
  665. </if>
  666. </set>
  667. WHERE userID = #{userId}
  668. </update>
  669. <update id="updateShopAudit">
  670. UPDATE shop
  671. <set>
  672. <if test="auditStatus != null and auditStatus != ''">
  673. auditStatus = #{auditStatus},
  674. </if>
  675. <if test="auditNote != null and auditNote != ''">
  676. auditNote = #{auditNote},
  677. </if>
  678. <if test="manufacturerStatus != null and manufacturerStatus != ''">
  679. status = #{manufacturerStatus},
  680. </if>
  681. <if test="auditTime != null and auditTime != ''">
  682. auditTime = #{auditTime},
  683. </if>
  684. </set>
  685. WHERE shopID = #{shopId}
  686. </update>
  687. <update id="updateEmployeePermission">
  688. UPDATE user SET userPermission = #{userPermission}
  689. WHERE companyUserID=#{companyUserID} AND userID != #{companyUserID} AND auditStatus = '1'
  690. </update>
  691. <update id="updateUserInfo">
  692. UPDATE user SET
  693. realName = #{realName},
  694. name = #{name},
  695. userName = #{userName},
  696. bindMobile = #{bindMobile},
  697. email = #{email}
  698. WHERE userID = #{userID}
  699. </update>
  700. <update id="initEmployeeInfo">
  701. UPDATE user SET
  702. companyUserID = NULL,
  703. userIdentity = '0',
  704. userPermission = '1',
  705. registerUserTypeID = '10' ,
  706. auditStatus = NULL ,
  707. auditTime = NULL ,
  708. userName = realName,
  709. name = NULL ,
  710. clubID = NULL ,
  711. clubStatus = NULL ,
  712. shopID = NULL ,
  713. manufacturerStatus = NULL ,
  714. tipStatus = '1'
  715. WHERE companyUserID=#{companyUserID} AND userID != #{companyUserID}
  716. </update>
  717. <update id="updateAbleUserMoney">
  718. UPDATE user SET
  719. ableUserMoney = #{ableUserMoney}
  720. WHERE userID = #{userId}
  721. </update>
  722. <update id="updateMoney">
  723. UPDATE user SET
  724. userMoney = #{userMoney},
  725. ableUserMoney = #{ableUserMoney}
  726. WHERE userID = #{userID}
  727. </update>
  728. <select id="findUserByMobile" resultType="CmUser">
  729. SELECT
  730. <include refid="cmUserColumns"/>
  731. FROM user a
  732. WHERE a.mobile=#{mobile}
  733. </select>
  734. <select id="getUserPayOrder" resultType="com.caimei.modules.order.entity.NewShopOrder">
  735. select *
  736. from cm_shop_order
  737. where
  738. (`status` = 2 || `status` = 3 || `status` = 4 || `status` = 5)
  739. AND userID=#{userId}
  740. </select>
  741. <select id="selectByMobileOrEmail" resultType="com.caimei.modules.user.entity.CmUser">
  742. select u.*,cu.mobile as operatorMobile from user u
  743. left join cm_mall_operation_user cu on cu.userID = u.userID
  744. where (u.bindMobile = #{mobileOrEmail}
  745. or u.email = #{mobileOrEmail}
  746. or (cu.mobile = #{mobileOrEmail} and cu.delFlag != 1))
  747. AND u.userIdentity IN (1,2,3,4)
  748. AND u.userOrganizeID = 0
  749. <if test="source == 'www'">
  750. AND u.registerUserTypeID IN (1,3,4)
  751. </if>
  752. <if test="source == 'crm'">
  753. AND u.registerUserTypeID IN (1,2,3,32,4)
  754. </if>
  755. </select>
  756. <update id="updateUserBeans">
  757. UPDATE USER SET userBeans = #{userBeans} WHERE userID = #{userID}
  758. </update>
  759. <select id="findUserByOrganizeId" resultType="com.caimei.modules.user.entity.CmUser">
  760. SELECT
  761. <include refid="cmUserColumns"/>
  762. FROM user a
  763. WHERE a.userOrganizeID=#{organizeId}
  764. limit 1
  765. </select>
  766. <select id="getOrganizeStoreName" resultType="java.lang.String">
  767. select name from cm_organize_store where id = #{organizeStoreId}
  768. </select>
  769. <update id="updateByClubStatus">
  770. UPDATE user SET clubStatus = #{clubStatus} WHERE userID = #{confirmUserId}
  771. </update>
  772. </mapper>