Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

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