RegisterMapper.xml 13 KB

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