You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

255 lines
8.6 KiB

  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.iformall.mapper.WxBuserMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxBuser">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="open_id" jdbcType="VARCHAR" property="openId"/>
  9. <result column="union_id" jdbcType="VARCHAR" property="unionId"/>
  10. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  11. <result column="gender" jdbcType="INTEGER" property="gender"/>
  12. <result column="avatar_url" jdbcType="VARCHAR" property="avatarUrl"/>
  13. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  14. <result column="pure_phone" jdbcType="VARCHAR" property="purePhone"/>
  15. <result column="city" jdbcType="VARCHAR" property="city"/>
  16. <result column="province" jdbcType="VARCHAR" property="province"/>
  17. <result column="language" jdbcType="VARCHAR" property="language"/>
  18. <result column="country_code" jdbcType="VARCHAR" property="countryCode"/>
  19. <result column="register_ip" jdbcType="VARCHAR" property="registerIp"/>
  20. <result column="verify_code_phone" jdbcType="VARCHAR" property="verifyCodePhone"/>
  21. <result column="qrcode_source" jdbcType="VARCHAR" property="qrcodeSource"/>
  22. <result column="scene" jdbcType="VARCHAR" property="scene"/>
  23. <result column="scene_address" jdbcType="VARCHAR" property="sceneAddress"/>
  24. <result column="session_key" jdbcType="VARCHAR" property="sessionKey"/>
  25. <result column="score" jdbcType="INTEGER" property="score"/>
  26. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  27. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  28. <result column="app_id" jdbcType="VARCHAR" property="appId"/>
  29. <result column="token" jdbcType="VARCHAR" property="token"/>
  30. <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
  31. <result column="latitude" jdbcType="DECIMAL" property="latitude"/>
  32. <result column="longitude" jdbcType="DECIMAL" property="longitude"/>
  33. <result column="locate_city" jdbcType="VARCHAR" property="locateCity"/>
  34. <result column="login_count" jdbcType="INTEGER" property="loginCount"/>
  35. <result column="extra_info" jdbcType="VARCHAR" property="extraInfo"/>
  36. <result column="is_subscribe" jdbcType="TINYINT" property="isSubscribe"/>
  37. <result column="open_app_id" jdbcType="VARCHAR" property="openAppId"/>
  38. <result column="mp_open_id" jdbcType="VARCHAR" property="mpOpenId"/>
  39. <result column="mp_app_id" jdbcType="VARCHAR" property="mpAppId"/>
  40. <result column="mp_subscribe" jdbcType="TINYINT" property="mpSubscribe"/>
  41. <result column="mp_subscribe_time" jdbcType="TIMESTAMP" property="mpSubscribeTime"/>
  42. <result column="mp_subscribe_scene" jdbcType="VARCHAR" property="mpSubscribeScene"/>
  43. <result column="subs_open_id" jdbcType="VARCHAR" property="subsOpenId"/>
  44. <result column="subs_app_id" jdbcType="VARCHAR" property="subsAppId"/>
  45. <result column="subs_subscribe" jdbcType="TINYINT" property="subsSubscribe"/>
  46. <result column="subs_subscribe_time" jdbcType="TIMESTAMP" property="subsSubscribeTime"/>
  47. <result column="subs_subscribe_scene" jdbcType="VARCHAR" property="subsSubscribeScene"/>
  48. <result column="credit" jdbcType="INTEGER" property="credit"/>
  49. <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>
  50. <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
  51. <result column="user_id" jdbcType="BIGINT" property="userId"/>
  52. </resultMap>
  53. <sql id="allColumns">
  54. `id`,`tenant_id`,`parent_tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`,
  55. `city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`,
  56. `qrcode_source`,`scene`,`scene_address`,`session_key`,`score`,
  57. `update_date`,`create_date`,`app_id`,`token`,`expire_time`,`latitude`, `longitude`, `locate_city`,
  58. `login_count`, `extra_info`, `is_subscribe`,`open_app_id`,`user_id`,
  59. `mp_open_id`,`mp_app_id`,`mp_subscribe`,`mp_subscribe_time`,`mp_subscribe_scene`,
  60. `subs_open_id`,`subs_app_id`,`subs_subscribe`,`subs_subscribe_time`,`subs_subscribe_scene`,`credit`,`active_time`,`qr_code`
  61. </sql>
  62. <sql id="dynamicWhereConditions">
  63. where 1 = 1
  64. <if test=" null != id ">
  65. and `id` = #{id}
  66. </if>
  67. <if test=" null != tenantId and '' != tenantId">
  68. and `tenant_id` = #{tenantId}
  69. </if>
  70. <if test=" null != parentTenantId and '' != parentTenantId">
  71. and `parent_tenant_id` = #{parentTenantId}
  72. </if>
  73. <if test=" null != openId ">
  74. and `open_id` = #{openId}
  75. </if>
  76. <if test=" null != unionId ">
  77. and `union_id` = #{unionId}
  78. </if>
  79. <if test=" null != nickName ">
  80. and `nick_name` like concat('%', #{nickName},'%')
  81. </if>
  82. <if test=" null != gender ">
  83. and `gender` = #{gender}
  84. </if>
  85. <if test=" null != avatarUrl ">
  86. and `avatar_url` like concat('%', #{avatarUrl},'%')
  87. </if>
  88. <if test=" null != phone ">
  89. and `phone` like concat('%', #{phone},'%')
  90. </if>
  91. <if test=" null != purePhone ">
  92. and `pure_phone` like concat('%', #{purePhone},'%')
  93. </if>
  94. <if test=" null != city ">
  95. and `city` like concat('%', #{city},'%')
  96. </if>
  97. <if test=" null != province ">
  98. and `province` like concat('%', #{province},'%')
  99. </if>
  100. <if test=" null != language ">
  101. and `language` like concat('%', #{language},'%')
  102. </if>
  103. <if test=" null != countryCode ">
  104. and `country_code` like concat('%', #{countryCode},'%')
  105. </if>
  106. <if test=" null != registerIp ">
  107. and `register_ip` like concat('%', #{registerIp},'%')
  108. </if>
  109. <if test=" null != verifyCodePhone ">
  110. and `verify_code_phone` like concat('%', #{verifyCodePhone},'%')
  111. </if>
  112. <if test=" null != qrcodeSource ">
  113. and `qrcode_source` like concat('%', #{qrcodeSource},'%')
  114. </if>
  115. <if test=" null != scene ">
  116. and `scene` like concat('%', #{scene},'%')
  117. </if>
  118. <if test=" null != sceneAddress ">
  119. and `scene_address` like concat('%', #{sceneAddress},'%')
  120. </if>
  121. <if test=" null != sessionKey ">
  122. and `session_key` like concat('%', #{sessionKey},'%')
  123. </if>
  124. <if test=" null != score ">
  125. and `score` = #{score}
  126. </if>
  127. <if test=" null != updateDate ">
  128. and `update_date` = #{updateDate}
  129. </if>
  130. <if test=" null != createDate ">
  131. and `create_date` = #{createDate}
  132. </if>
  133. <if test=" null != appId ">
  134. and `app_id` like concat('%', #{appId},'%')
  135. </if>
  136. <if test=" null != token ">
  137. and `token` like concat('%', #{token},'%')
  138. </if>
  139. <if test=" null != expireTime ">
  140. and `expire_time` = #{expireTime}
  141. </if>
  142. <if test=" null != latitude ">
  143. and `latitude` = #{latitude}
  144. </if>
  145. <if test=" null != longitude ">
  146. and `longitude` = #{longitude}
  147. </if>
  148. <if test=" null != loginCount ">
  149. and `login_count` = #{loginCount}
  150. </if>
  151. <if test=" null != extraInfo ">
  152. and `extra_info` = #{extraInfo}
  153. </if>
  154. <if test=" null != isSubscribe ">
  155. and `is_subscribe` = #{isSubscribe}
  156. </if>
  157. <if test=" null != openAppId ">
  158. and `open_app_id` = #{openAppId}
  159. </if>
  160. <if test=" null != mpOpenId ">
  161. and `mp_open_id` = #{mpOpenId}
  162. </if>
  163. <if test=" null != mpAppId ">
  164. and `mp_app_id` = #{mpAppId}
  165. </if>
  166. <if test=" null != subsOpenId ">
  167. and `subs_open_id` = #{subsOpenId}
  168. </if>
  169. <if test=" null != subsAppId ">
  170. and `subs_app_id` = #{subsAppId}
  171. </if>
  172. <if test=" null != credit ">
  173. and `credit` = #{credit}
  174. </if>
  175. <if test=" null != userId ">
  176. and `user_id` = #{userId}
  177. </if>
  178. <if test=" null != ids ">
  179. and id in
  180. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  181. #{idItem}
  182. </foreach>
  183. </if>
  184. <if test=" null != sortColumns">order by ${sortColumns}</if>
  185. </sql>
  186. <select id="findList" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap">
  187. select
  188. <include refid="allColumns"/>
  189. from wx_buser
  190. <include refid="dynamicWhereConditions"/>
  191. </select>
  192. <select id="findByOpenId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap">
  193. select * from wx_buser
  194. where `open_id` = #{openId}
  195. <if test=" null != appId and '' != appId">
  196. and `app_id` = #{appId}
  197. </if>
  198. </select>
  199. <select id="findByUnionId" parameterType="com.iformall.domain.po.WxBuser" resultMap="BaseResultMap">
  200. select * from wx_buser
  201. where `open_app_id` = #{openAppId} and `union_id` = #{unionId}
  202. </select>
  203. <select id="findByToken" resultMap="BaseResultMap">
  204. select * from wx_buser
  205. where `token` = #{token}
  206. </select>
  207. </mapper>