后台服务
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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