RegisterMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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.RegisterMapper">
  4. <insert id="insertClubUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId"
  5. useGeneratedKeys="true">
  6. insert into user(`userOrganizeID`, `registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`,
  7. `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `guideFlag`,
  8. `password`, `agreeFlag`, `validFlag`, `serviceProviderID`, `serviceProviderStatus`, userBeans)
  9. values (#{organizeId}, #{registerTime}, #{registerIp}, #{ipAddress}, #{source}, #{registerUserTypeId}, #{name},
  10. #{userName}, #{bindMobile}, #{email}, #{userIdentity}, #{guideFlag}, #{password},
  11. #{agreeFlag}, #{validFlag}, #{serviceProviderId}, #{serviceProviderStatus}, #{userBeans})
  12. </insert>
  13. <select id="selUser" resultType="com.caimei365.user.model.po.UserPo">
  14. select *
  15. from user
  16. where registerTime = #{registerTime}
  17. </select>
  18. <insert id="insertOrgan">
  19. insert into cm_organ_value_system
  20. (userID, activeState, customerValue, stage, delType)
  21. values (#{userID}, "新增用户", "一般挽留客户", 0, 1)
  22. </insert>
  23. <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId"
  24. useGeneratedKeys="true">
  25. insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`,
  26. `scanFlag`, provinceID, cityID, townID, address, headpic, businessLicenseImage,
  27. medicalPracticeLicenseImg, socialCreditCode)
  28. values (#{name}, #{shortName}, #{contractMobile}, #{linkMan}, #{userId}, #{addTime}, #{status},
  29. #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto},
  30. #{businessLicense}, #{medicalPracticeLicense}, #{socialCreditCode})
  31. </insert>
  32. <insert id="insertUpgradeClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId"
  33. useGeneratedKeys="true">
  34. insert into club(`name`, `sname`, `contractMobile`, `userID`, `addTime`, `status`, `spID`, `scanFlag`,
  35. `contractEmail`, `linkMan`, `provinceID`, `cityID`, `townID`, `address`, `headpic`,
  36. `businessLicenseImage`, `socialCreditCode`, `firstClubType`, `secondClubType`, `department`,
  37. `medicalPracticeLicenseImg`, `mainpro`)
  38. values (#{name}, #{shortName}, #{contractMobile}, #{userId}, #{addTime}, #{status}, #{serviceProviderId},
  39. #{scanFlag}, #{contractEmail}, #{linkMan}, #{provinceId}, #{cityId}, #{townId}, #{address},
  40. #{shopPhoto}, #{businessLicense}, #{socialCreditCode}, #{firstClubType}, #{secondClubType},
  41. #{department}, #{medicalPracticeLicense}, #{mainProduct})
  42. </insert>
  43. <insert id="insertOperation" parameterType="com.caimei365.user.model.po.OperationPo" keyProperty="id"
  44. useGeneratedKeys="true">
  45. insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`, `linkName`, `nickName`,
  46. `headimgurl`, `userType`, `mobile`, `status`, `unionId`, `openid`,
  47. `pcOpenid`, `addTime`, `updateTime`, `bindTime`, `delFlag`)
  48. values (#{userId}, #{clubId}, #{shopId}, #{organizeId}, #{linkName}, #{nickName}, #{avatarUrl}, #{userType},
  49. #{mobile}, #{status}, #{unionId}, #{openId}, #{pcOpenId}, #{addTime}, #{updateTime}, #{bindTime},
  50. #{delFlag})
  51. </insert>
  52. <insert id="insertShopUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId"
  53. useGeneratedKeys="true">
  54. insert into user(`userOrganizeID`, `registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`,
  55. `name`, `userName`, `bindMobile`, `email`, `userIdentity`,
  56. `manufacturerStatus`, `password`, `agreeFlag`, `validFlag`)
  57. values (#{organizeId}, #{registerTime}, #{registerIp}, #{ipAddress}, #{source}, #{registerUserTypeId}, #{name},
  58. #{userName}, #{bindMobile}, #{email}, #{userIdentity}, #{manufacturerStatus},
  59. #{password}, #{agreeFlag}, #{validFlag})
  60. </insert>
  61. <insert id="insertShop" parameterType="com.caimei365.user.model.po.ShopPo" keyProperty="shopId"
  62. useGeneratedKeys="true">
  63. insert into shop(`userID`, `name`, `sname`, `linkMan`, `contractMobile`, `contractEmail`, `provinceID`,
  64. `cityID`, `townID`, `address`, `socialCreditCode`, `businessLicenseImage`, `firstShopType`,
  65. `secondShopType`, `mainpro`, `productDesc`, `info`, `website`, `wxOfficialAccount`,
  66. `wxApplets`, `addTime`, `validFlag`, `status`, medicalPracticeLicenseImg1)
  67. values (#{userId}, #{name}, #{shortName}, #{linkMan}, #{contractMobile}, #{contractEmail}, #{provinceId},
  68. #{cityId}, #{townId}, #{address}, #{socialCreditCode}, #{businessLicense}, #{firstShopType},
  69. #{secondShopType}, #{mainProduct}, #{mainProductDesc}, #{shopDesc}, #{website}, #{wxOfficialAccount},
  70. #{wxApplets}, #{addTime}, #{validFlag}, #{status}, #{medicalPracticeLicenseImg1})
  71. </insert>
  72. <update id="updateUserClubId">
  73. update user
  74. set clubID = #{clubId}
  75. where userID = #{userId}
  76. </update>
  77. <update id="updateUserShopId">
  78. update user
  79. set shopID = #{shopId}
  80. where userID = #{userId}
  81. </update>
  82. <update id="updateClubUserByUpgrade">
  83. update user
  84. set registerIP = #{registerIp},
  85. email = #{email},
  86. name = #{name}
  87. where userID = #{userId}
  88. </update>
  89. <update id="updateShopUserByApply">
  90. update user set userName = #{userName}, name = #{name}, manufacturerStatus = #{manufacturerStatus}
  91. <if test="email != null and email != ''">
  92. , email = #{email}
  93. </if>
  94. where userID = #{userId}
  95. </update>
  96. <update id="updateClubByUpgrade">
  97. update club set userID = #{userId}, name = #{name}, sname = #{shortName}, contractEmail = #{contractEmail},
  98. <if test="contractPhone != null and contractPhone != ''">
  99. contractPhone = #{contractPhone},
  100. </if>
  101. <if test="linkMan != null and linkMan != ''">
  102. linkMan = #{linkMan},
  103. </if>
  104. <if test="linkManIdentity != null and linkManIdentity != ''">
  105. linkManIdentity = #{linkManIdentity},
  106. </if>
  107. provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
  108. <if test="shopPhoto != null and shopPhoto != 'null' and shopPhoto != ''">
  109. headpic = #{shopPhoto},
  110. </if>
  111. businessLicenseImage = #{businessLicense}, socialCreditCode = #{socialCreditCode}, firstClubType =
  112. #{firstClubType},
  113. <if test="firstClubType == 1">
  114. secondClubType = #{secondClubType}, department = #{department}, medicalPracticeLicenseImg =
  115. #{medicalPracticeLicense},
  116. </if>
  117. <if test="mainProduct != null and mainProduct != ''">
  118. mainpro = #{mainProduct},
  119. </if>
  120. <if test="fax != null and fax != ''">
  121. fax = #{fax},
  122. </if>
  123. <if test="profile != null and profile != ''">
  124. info = #{profile},
  125. </if>
  126. status = #{status}
  127. where clubID = #{clubId}
  128. </update>
  129. <update id="updateShopInfoByApply">
  130. update shop set userID = #{userId}, name = #{name},
  131. <if test="shortName != null and shortName != ''">
  132. sname = #{shortName},
  133. </if>
  134. <if test="email != null and email != ''">
  135. contractEmail = #{email},
  136. </if>
  137. <if test="linkMan != null and linkMan != ''">
  138. linkMan = #{linkMan},
  139. </if>
  140. <if test="townId != null and townId != ''">
  141. provinceID = #{provinceId},cityID = #{cityId},townID = #{townId},address = #{address},
  142. </if>
  143. <if test="socialCreditCode != null and socialCreditCode != ''">
  144. socialCreditCode = #{socialCreditCode},
  145. </if>
  146. <if test="businessLicense != null and businessLicense != ''">
  147. businessLicenseImage = #{businessLicense},
  148. </if>
  149. <if test="firstShopType != null and firstShopType != ''">
  150. firstShopType = #{firstShopType},
  151. </if>
  152. <if test="secondShopType != null and secondShopType != ''">
  153. secondShopType = #{secondShopType},
  154. </if>
  155. <if test="mainProduct != null and mainProduct != ''">
  156. mainpro = #{mainProduct},
  157. </if>
  158. productDesc = #{mainProductDesc},
  159. info = #{shopDesc},
  160. website = #{website},
  161. wxOfficialAccount = #{wxOfficialAccount},
  162. wxApplets = #{wxApplets},
  163. status = #{status}
  164. where shopID = #{shopId}
  165. </update>
  166. <update id="updateGuideFlagByUserId">
  167. update user
  168. set guideFlag=1
  169. where userID = #{userId}
  170. </update>
  171. <insert id="insertClubTemporary" useGeneratedKeys="true" keyProperty="userId" keyColumn="id"
  172. parameterType="com.caimei365.user.model.dto.ClubOnlineDto">
  173. INSERT INTO `club_temporary` (`userId`, `name`, `shortName`, `bindMobile`,
  174. `contractEmail`, `linkMan`, `linkManIdentity`, `provinceId`,
  175. `cityId`, `townId`, `address`, `shopPhoto`,
  176. `businessLicense`, `socialCreditCode`,
  177. `firstClubType`, `secondClubType`,
  178. `department`, `medicalPracticeLicense`,
  179. `mainProduct`, `isAgreed`, addTime)
  180. VALUES (#{userId}, #{name}, #{shortName}, #{bindMobile},
  181. #{contractEmail}, #{linkMan}, #{linkManIdentity}, #{provinceId},
  182. #{cityId}, #{townId}, #{address}, #{shopPhoto},
  183. #{businessLicense}, #{socialCreditCode},
  184. #{firstClubType}, #{secondClubType},
  185. #{department}, #{medicalPracticeLicense},
  186. #{mainProduct}, #{isAgreed}, now())
  187. </insert>
  188. <select id="getTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
  189. SELECT `userId`,
  190. confirmUserId,
  191. `name`,
  192. `shortName`,
  193. `bindMobile`,
  194. `contractEmail`,
  195. `linkMan`,
  196. `provinceId`,
  197. `cityId`,
  198. `townId`,
  199. `address`,
  200. `shopPhoto`,
  201. `businessLicense`,
  202. `socialCreditCode`,
  203. `firstClubType`,
  204. `secondClubType`,
  205. `department`,
  206. `medicalPracticeLicense`,
  207. `mainProduct`,
  208. `isAgreed`
  209. FROM `club_temporary`
  210. WHERE id = #{id}
  211. </select>
  212. <insert id="insertBeansHistory">
  213. INSERT INTO `user_beans_history` (`userId`, `type`, `beansType`, `orderId`, `archiveId`,
  214. `num`, `pushStatus`, `addTime`, delFlag)
  215. VALUES (#{userId}, #{type}, #{beansType}, #{orderId}, #{archiveId},
  216. #{num}, #{pushStatus}, #{addTime}, 0)
  217. </insert>
  218. <update id="updateClubUser">
  219. UPDATE
  220. user
  221. SET bindMobile = #{bindMobile},
  222. userIdentity = #{userIdentity},
  223. email = #{email},
  224. userName = #{userName},
  225. source = #{source},
  226. password = #{password},
  227. registerUserTypeID = #{registerUserTypeId},
  228. name = #{name},
  229. registerTime = #{registerTime},
  230. registerIP = #{registerIp},
  231. ipAddress = #{ipAddress},
  232. serviceProviderStatus = #{serviceProviderStatus},
  233. serviceProviderID = #{serviceProviderId},
  234. guideFlag = #{guideFlag}
  235. WHERE userID = #{userId}
  236. </update>
  237. <update id="updateClub">
  238. UPDATE
  239. club
  240. SET name = #{name},
  241. sname = #{shortName},
  242. provinceID = #{provinceId},
  243. cityID = #{cityId},
  244. townID = #{townId},
  245. spID = #{serviceProviderId},
  246. address = #{address},
  247. linkMan = #{linkMan},
  248. contractPhone = #{contractPhone},
  249. contractMobile = #{contractMobile},
  250. fax = #{fax},
  251. contractEmail = #{contractEmail},
  252. info = #{profile},
  253. addTime = #{addTime},
  254. status = #{status},
  255. businessLicenseImage = #{businessLicense},
  256. defaultServiceProviderID = #{serviceProviderId},
  257. mainpro = #{mainProduct},
  258. headpic = #{shopPhoto},
  259. lastModify = NOW(),
  260. socialCreditCode = #{socialCreditCode},
  261. department = #{department},
  262. medicalPracticeLicenseImg = #{medicalPracticeLicense}
  263. WHERE userID = #{userId}
  264. </update>
  265. <select id="selProvince" resultType="java.lang.Integer">
  266. SELECT provinceID as provinceId
  267. FROM province
  268. WHERE NAME LIKE concat('%', #{regionPro}, '%')
  269. limit 1
  270. </select>
  271. <select id="selCity" resultType="java.lang.Integer">
  272. SELECT cityID as cityId
  273. FROM city
  274. WHERE NAME LIKE concat('%', #{regionCity}, '%')
  275. AND validFlag = 1
  276. limit 1
  277. </select>
  278. </mapper>