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.
 
 
 
 
 

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