OperationMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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.OperationMapper">
  4. <select id="getOperationByMobile" resultType="com.caimei365.user.model.po.OperationPo">
  5. select o.id as id,
  6. o.userID as userId,
  7. o.mobile as mobile,
  8. o.clubID as clubId,
  9. o.shopID as shopId,
  10. o.unionId as unionId
  11. from cm_mall_operation_user o
  12. where o.mobile = #{mobile} and o.delFlag = '0'
  13. limit 1
  14. </select>
  15. <select id="countByInvitationCode" resultType="java.lang.Integer">
  16. select COUNT(*) from cm_mall_operation_user
  17. where invitationCode=#{invitationCode}
  18. </select>
  19. <select id="findClubNameById" resultType="java.lang.String">
  20. select name from club
  21. where clubID = #{clubId}
  22. </select>
  23. <select id="findShopNameById" resultType="java.lang.String">
  24. select name from shop
  25. where shopID = #{shopId}
  26. </select>
  27. <select id="getOperationCodeInfoById" resultType="com.caimei365.user.model.po.OperationPo">
  28. select o.id as id,
  29. o.mobile as mobile,
  30. o.clubID as clubId,
  31. o.shopID as shopId,
  32. o.status as status
  33. from cm_mall_operation_user o
  34. where o.id = #{id} and o.delFlag = '0'
  35. </select>
  36. <select id="getOperationListByUserId" resultType="com.caimei365.user.model.vo.OperationVo">
  37. select id, userID as userId, userType, userOrganizeID as organizeId, clubID as clubId, shopID as shopId, account, mobile,
  38. linkName, headimgurl as avatarUrl, invitationCode, status nickName, unionId, openid as openId, crmOpenid as crmOpenId, pcOpenid as pcOpenId,
  39. invitationCodeTime, bindTime, updateTime, addTime, delFlag
  40. from cm_mall_operation_user
  41. where userID = #{userId} and delFlag = 0
  42. <if test="mobile != null and mobile != ''">
  43. and mobile like concat('%',#{mobile,jdbcType=VARCHAR},'%')
  44. </if>
  45. <if test="linkName != null and linkName != ''">
  46. and linkName like concat('%',#{linkName,jdbcType=VARCHAR},'%')
  47. </if>
  48. order by addTime DESC
  49. </select>
  50. <update id="updateOperationOpenId">
  51. update cm_mall_operation_user
  52. set openid = #{openId}
  53. where userID = #{userId}
  54. </update>
  55. <update id="updateOperationUnionId">
  56. update cm_mall_operation_user
  57. set unionId = #{unionId}
  58. where userID = #{userId}
  59. </update>
  60. <update id="updateOperationByInvitation">
  61. update cm_mall_operation_user
  62. set unionId = #{unionId},
  63. openId = #{openId},
  64. nickName = #{nickName},
  65. headimgurl = #{avatarUrl},
  66. status = #{status},
  67. <if test="clubId != null and clubId != ''">
  68. clubId = #{clubId},
  69. shopId = null,
  70. </if>
  71. <if test="shopId != null and shopId != ''">
  72. shopId = #{shopId},
  73. clubId = null,
  74. </if>
  75. userType = #{userType}
  76. where id = #{id}
  77. </update>
  78. <update id="updateOperationByUnbind">
  79. update cm_mall_operation_user
  80. set unionId = #{unionId},
  81. openId = #{openId},
  82. nickName = #{nickName},
  83. bindTime = #{bindTime},
  84. updateTime = #{updateTime},
  85. status = #{status},
  86. userType = #{userType},
  87. <if test="clubId != null and clubId != ''">
  88. clubId = #{clubId},
  89. shopId = null,
  90. </if>
  91. <if test="shopId != null and shopId != ''">
  92. shopId = #{shopId},
  93. clubId = null,
  94. </if>
  95. delFlag = #{delFlag}
  96. where id = #{id}
  97. </update>
  98. <insert id="insertOperation" keyColumn="id" keyProperty="id" parameterType="com.caimei365.user.model.po.OperationPo">
  99. insert into cm_mall_operation_user
  100. <trim prefix="(" suffix=")" suffixOverrides=",">
  101. <if test="userOrganizeID != null">
  102. userOrganizeID,
  103. </if>
  104. <if test="userID != null">
  105. userID,
  106. </if>
  107. <if test="userType != null">
  108. userType,
  109. </if>
  110. <if test="shopID != null">
  111. shopID,
  112. </if>
  113. <if test="clubID != null">
  114. clubID,
  115. </if>
  116. <if test="account != null">
  117. account,
  118. </if>
  119. <if test="mobile != null">
  120. mobile,
  121. </if>
  122. <if test="linkName != null">
  123. linkName,
  124. </if>
  125. <if test="headimgurl != null">
  126. headimgurl,
  127. </if>
  128. <if test="invitationCode != null">
  129. invitationCode,
  130. </if>
  131. <if test="status != null">
  132. `status`,
  133. </if>
  134. <if test="nickName != null">
  135. nickName,
  136. </if>
  137. <if test="unionId != null">
  138. unionId,
  139. </if>
  140. <if test="openid != null">
  141. openid,
  142. </if>
  143. <if test="crmOpenid != null">
  144. crmOpenid,
  145. </if>
  146. <if test="pcOpenid != null">
  147. pcOpenid,
  148. </if>
  149. <if test="invitationCodeTime != null">
  150. invitationCodeTime,
  151. </if>
  152. <if test="bindTime != null">
  153. bindTime,
  154. </if>
  155. <if test="updateTime != null">
  156. updateTime,
  157. </if>
  158. <if test="addTime != null">
  159. addTime,
  160. </if>
  161. <if test="delFlag != null">
  162. delFlag,
  163. </if>
  164. </trim>
  165. <trim prefix="values (" suffix=")" suffixOverrides=",">
  166. <if test="organizeId != null">
  167. #{organizeId},
  168. </if>
  169. <if test="userId != null">
  170. #{userId},
  171. </if>
  172. <if test="userType != null">
  173. #{userType},
  174. </if>
  175. <if test="shopID != null">
  176. #{shopId},
  177. </if>
  178. <if test="clubID != null">
  179. #{clubId},
  180. </if>
  181. <if test="account != null">
  182. #{account},
  183. </if>
  184. <if test="mobile != null">
  185. #{mobile},
  186. </if>
  187. <if test="linkName != null">
  188. #{linkName},
  189. </if>
  190. <if test="invitationCode != null">
  191. #{invitationCode},
  192. </if>
  193. <if test="status != null">
  194. #{status},
  195. </if>
  196. <if test="nickName != null">
  197. #{nickName},
  198. </if>
  199. <if test="unionId != null">
  200. #{unionId},
  201. </if>
  202. <if test="openId != null">
  203. #{openId},
  204. </if>
  205. <if test="crmOpenId != null">
  206. #{crmOpenId},
  207. </if>
  208. <if test="pcOpenId != null">
  209. #{pcOpenId},
  210. </if>
  211. <if test="invitationCodeTime">
  212. #{invitationCodeTime},
  213. </if>
  214. <if test="bindTime">
  215. #{bindTime},
  216. </if>
  217. <if test="updateTime != null">
  218. #{updateTime},
  219. </if>
  220. <if test="addTime != null">
  221. #{addTime},
  222. </if>
  223. <if test="delFlag != null">
  224. #{delFlag},
  225. </if>
  226. </trim>
  227. <selectKey resultType="java.lang.Integer" keyProperty="id">
  228. SELECT LAST_INSERT_ID()
  229. </selectKey>
  230. </insert>
  231. <update id="updateOperation" parameterType="com.caimei365.user.model.po.OperationPo">
  232. update cm_mall_operation_user
  233. <set>
  234. <if test="organizeId != null">
  235. userOrganizeID = #{organizeId},
  236. </if>
  237. <if test="userId != null">
  238. userID = #{userId},
  239. </if>
  240. <if test="userType != null">
  241. userType = #{userType},
  242. </if>
  243. <if test="shopId != null">
  244. shopID = #{shopId},
  245. </if>
  246. <if test="clubId != null">
  247. clubID = #{clubId},
  248. </if>
  249. <if test="account != null">
  250. account = #{account},
  251. </if>
  252. <if test="mobile != null">
  253. mobile = #{mobile},
  254. </if>
  255. <if test="linkName != null">
  256. linkName = #{linkName},
  257. </if>
  258. <if test="avatarUrl != null">
  259. headimgurl = #{avatarUrl},
  260. </if>
  261. <if test="invitationCode != null">
  262. invitationCode = #{invitationCode},
  263. </if>
  264. <if test="status != null">
  265. `status` = #{status},
  266. </if>
  267. <if test="nickName != null">
  268. nickName = #{nickName},
  269. </if>
  270. <if test="unionId != null">
  271. unionId = #{unionId},
  272. </if>
  273. <if test="openid != null">
  274. openid = #{openId},
  275. </if>
  276. <if test="crmOpenid != null">
  277. crmOpenid = #{crmOpenId},
  278. </if>
  279. <if test="pcOpenid != null">
  280. pcOpenid = #{pcOpenId},
  281. </if>
  282. <if test="invitationCodeTime != null">
  283. invitationCodeTime = #{invitationCodeTime},
  284. </if>
  285. <if test="bindTime != null">
  286. bindTime = #{bindTime},
  287. </if>
  288. <if test="updateTime != null">
  289. updateTime = #{updateTime},
  290. </if>
  291. <if test="addTime != null">
  292. addTime = #{addTime},
  293. </if>
  294. <if test="delFlag != null">
  295. delFlag = #{delFlag},
  296. </if>
  297. </set>
  298. where id = #{id}
  299. </update>
  300. </mapper>