Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

250 wiersze
8.9 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_ubscribe" jdbcType="TINYINT" property="isSubscribe"/>
  35. </resultMap>
  36. <sql id="allColumns">
  37. `id`,`tenant_id`,`open_id`,`union_id`,`nick_name`,`gender`,`avatar_url`,`phone`,`pure_phone`,
  38. `city`,`province`,`language`,`country_code`,`register_ip`,`verify_code_phone`,
  39. `qrcode_source`,`scene`,`scene_address`,`session_key`,`score`,
  40. `update_date`,`create_date`,`app_id`,`token`,`expire_time`,`latitude`, `longitude`,
  41. `login_count`, `extra_info`, `is_subscribe`
  42. </sql>
  43. <sql id="dynamicWhereConditions">
  44. where 1 = 1
  45. <if test=" null != id ">
  46. and `id` = #{id}
  47. </if>
  48. <if test=" null != tenantId ">
  49. and `tenant_id`= #{tenantId}
  50. </if>
  51. <if test=" null != openId ">
  52. and `open_id` like concat('%', #{openId},'%')
  53. </if>
  54. <if test=" null != unionId ">
  55. and `union_id` like concat('%', #{unionId},'%')
  56. </if>
  57. <if test=" null != nickName ">
  58. and `nick_name` like concat('%', #{nickName},'%')
  59. </if>
  60. <if test=" null != gender ">
  61. and `gender` = #{gender}
  62. </if>
  63. <if test=" null != avatarUrl ">
  64. and `avatar_url` like concat('%', #{avatarUrl},'%')
  65. </if>
  66. <if test=" null != phone ">
  67. and `phone` like concat('%', #{phone},'%')
  68. </if>
  69. <if test=" null != purePhone ">
  70. and `pure_phone` like concat('%', #{purePhone},'%')
  71. </if>
  72. <if test=" null != city ">
  73. and `city` like concat('%', #{city},'%')
  74. </if>
  75. <if test=" null != province ">
  76. and `province` like concat('%', #{province},'%')
  77. </if>
  78. <if test=" null != language ">
  79. and `language` like concat('%', #{language},'%')
  80. </if>
  81. <if test=" null != countryCode ">
  82. and `country_code` like concat('%', #{countryCode},'%')
  83. </if>
  84. <if test=" null != registerIp ">
  85. and `register_ip` like concat('%', #{registerIp},'%')
  86. </if>
  87. <if test=" null != verifyCodePhone ">
  88. and `verify_code_phone` like concat('%', #{verifyCodePhone},'%')
  89. </if>
  90. <if test=" null != qrcodeSource ">
  91. and `qrcode_source` like concat('%', #{qrcodeSource},'%')
  92. </if>
  93. <if test=" null != scene ">
  94. and `scene` like concat('%', #{scene},'%')
  95. </if>
  96. <if test=" null != sceneAddress ">
  97. and `scene_address` like concat('%', #{sceneAddress},'%')
  98. </if>
  99. <if test=" null != sessionKey ">
  100. and `session_key` like concat('%', #{sessionKey},'%')
  101. </if>
  102. <if test=" null != score ">
  103. and `score` = #{score}
  104. </if>
  105. <if test=" null != updateDate ">
  106. and `update_date` = #{updateDate}
  107. </if>
  108. <if test=" null != createDate ">
  109. and `create_date` = #{createDate}
  110. </if>
  111. <if test=" null != appId ">
  112. and `app_id` like concat('%', #{appId},'%')
  113. </if>
  114. <if test=" null != token ">
  115. and `token` like concat('%', #{token},'%')
  116. </if>
  117. <if test=" null != expireTime ">
  118. and `expire_time` = #{expireTime}
  119. </if>
  120. <if test=" null != latitude ">
  121. and `latitude` = #{latitude}
  122. </if>
  123. <if test=" null != longitude ">
  124. and `longitude` = #{longitude}
  125. </if>
  126. <if test=" null != loginCount ">
  127. and `login_count` = #{loginCount}
  128. </if>
  129. <if test=" null != extraInfo ">
  130. and `extra_info` = #{extraInfo}
  131. </if>
  132. <if test=" null != isSubscribe ">
  133. and `is_subscribe` = #{isSubscribe}
  134. </if>
  135. <if test=" null != ids ">
  136. and id in
  137. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  138. #{idItem}
  139. </foreach>
  140. </if>
  141. <if test=" null != sortColumns">order by ${sortColumns}</if>
  142. </sql>
  143. <select id="findList" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap">
  144. select
  145. <include refid="allColumns"/>
  146. from wx_c_user
  147. <include refid="dynamicWhereConditions"/>
  148. </select>
  149. <select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap">
  150. select * from wx_c_user
  151. where `app_id` = #{appId} and `open_id` = #{openId}
  152. </select>
  153. <select id="findByToken" resultMap="BaseResultMap">
  154. select * from wx_c_user
  155. where `token` = #{token}
  156. </select>
  157. <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  158. select count(id) from wx_c_user where 1=1
  159. <if test=" null != sex ">
  160. and gender =#{sex}
  161. </if>
  162. <if test=" null != startTime ">
  163. and create_date &gt;= #{startTime}
  164. </if>
  165. <if test=" null != endTime">
  166. and create_date &lt; #{endTime}
  167. </if>
  168. <if test="null != tenantId">
  169. and tenant_id =#{tenantId}
  170. </if>
  171. </select>
  172. <select id="listByChannel" resultMap="BaseResultMap" >
  173. select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1
  174. <if test="null != tenantId">
  175. and tenant_id =#{tenantId}
  176. </if>
  177. <if test=" null != startDate ">
  178. and create_date &gt;= #{startDate}
  179. </if>
  180. <if test=" null != endDate">
  181. and create_date &lt; #{endDate}
  182. </if>
  183. <if test=" sceneList!= null ">
  184. and scene_address in
  185. <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")">
  186. #{scene}
  187. </foreach>
  188. </if>
  189. order by create_date desc
  190. </select>
  191. <select id="countByChannel" resultType="java.lang.Long" >
  192. select count(id) from wx_c_user where 1=1
  193. <if test="null != tenantId">
  194. and tenant_id =#{tenantId}
  195. </if>
  196. <if test=" null != startDate ">
  197. and create_date &gt;= #{startDate}
  198. </if>
  199. <if test=" null != endDate">
  200. and create_date &lt; #{endDate}
  201. </if>
  202. <if test=" sceneList!= null ">
  203. and scene_address in
  204. <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")">
  205. #{scene}
  206. </foreach>
  207. </if>
  208. </select>
  209. </mapper>