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

203 строки
7.3 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.simple.mapper.WxCUserBasicInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserBasicInfo">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  7. <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
  8. <result column="education" jdbcType="VARCHAR" property="education"/>
  9. <result column="sex" jdbcType="INTEGER" property="sex"/>
  10. <result column="email" jdbcType="VARCHAR" property="email"/>
  11. <result column="address" jdbcType="VARCHAR" property="address"/>
  12. <result column="poins" jdbcType="INTEGER" property="poins"/>
  13. <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
  14. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  15. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  16. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  17. <result column="name" jdbcType="VARCHAR" property="name"/>
  18. <result column="level" jdbcType="VARCHAR" property="level"/>
  19. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  20. </resultMap>
  21. <sql id="allColumns">
  22. `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
  23. `create_date`,`update_date`,`tenant_id`,`name`,level,nick_name
  24. </sql>
  25. <sql id="dynamicWhereConditions">
  26. where 1 = 1
  27. <if test=" null != id ">
  28. and `id` = #{id}
  29. </if>
  30. <if test=" null != tenantId ">
  31. and c.`tenant_id` like concat('%', #{tenantId},'%')
  32. </if>
  33. <if test=" null != phone ">
  34. and `phone` like concat('%', #{phone},'%')
  35. </if>
  36. <if test=" null != birthdate ">
  37. and `birthdate` = #{birthdate}
  38. </if>
  39. <if test=" null != education ">
  40. and `education` like concat('%', #{education},'%')
  41. </if>
  42. <if test=" null != sex ">
  43. and `sex` = #{sex}
  44. </if>
  45. <if test=" null != email ">
  46. and `email` like concat('%', #{email},'%')
  47. </if>
  48. <if test=" null != address ">
  49. and `address` like concat('%', #{address},'%')
  50. </if>
  51. <if test=" null != poins ">
  52. and `poins` = #{poins}
  53. </if>
  54. <if test=" null != tagId ">
  55. and `tag_id` = #{tagId}
  56. </if>
  57. <if test=" null != cUserId ">
  58. and `c_user_id` = #{cUserId}
  59. </if>
  60. <if test=" null != createDate ">
  61. and c.`create_date` = #{createDate}
  62. </if>
  63. <if test=" null != updateDate ">
  64. and c.`update_date` = #{updateDate}
  65. </if>
  66. <if test=" null != name ">
  67. and c.`name` like concat('%', #{name},'%')
  68. </if>
  69. <if test=" null != ids ">
  70. and id in
  71. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  72. #{idItem}
  73. </foreach>
  74. </if>
  75. <if test=" null != sortColumns">order by ${sortColumns}</if>
  76. </sql>
  77. <select id="findList" parameterType="com.simple.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
  78. select
  79. <include refid="allColumns"/>
  80. from wx_c_user_basic_info
  81. <include refid="dynamicWhereConditions"/>
  82. </select>
  83. <sql id="allUserColumns">
  84. c.`id`,c.`phone`,cb.`birthdate`,cb.`education`,cb.`sex`,cb.`email`,cb.`address`,cb.`poins`,cb.`tag_id`,
  85. cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name
  86. </sql>
  87. <select id="list" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
  88. select
  89. <include refid="allUserColumns"/>
  90. from wx_c_user c
  91. left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id
  92. where 1=1
  93. <if test=" null != tenantId ">
  94. and c.`tenant_id` = #{tenantId}
  95. </if>
  96. <if test=" null != phone and phone !='' ">
  97. and c.`phone` = #{phone}
  98. </if>
  99. <if test=" null == phone or phone =='' ">
  100. and c.`phone` is not null
  101. </if>
  102. <if test=" null != startTime ">
  103. and cb.create_date &gt;= #{startTime}
  104. </if>
  105. <if test=" null != endTime">
  106. and cb.update_date &lt;= #{endTime}
  107. </if>
  108. <if test=" null != name and name != '' ">
  109. and cb.`name` like concat('%', #{name},'%')
  110. </if>
  111. </select>
  112. <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo">
  113. update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId}
  114. and c_user_id=#{cUserId}
  115. </update>
  116. <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  117. select count(id) from wx_c_user_basic_info where sex =#{sex}
  118. <if test=" null != startTime ">
  119. and create_date &gt;= #{startTime}
  120. </if>
  121. <if test=" null != endTime">
  122. and create_date &lt;= #{endTime}
  123. </if>
  124. </select>
  125. <select id="findCountByAge" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  126. select count(id) from wx_c_user_basic_info where birthdate is not NULL
  127. <if test=" null != startTime ">
  128. and create_date &gt;= #{startTime}
  129. </if>
  130. <if test=" null != endTime">
  131. and create_date &lt;= #{endTime}
  132. </if>
  133. <if test=" null != birthStartTime ">
  134. and birthdate &gt;= #{birthStartTime}
  135. </if>
  136. <if test=" null != birthEndTime">
  137. and birthdate &lt;= #{birthEndTime}
  138. </if>
  139. </select>
  140. <select id="findListMap" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="hashmap">
  141. select cu.id,cu.tenant_id tenantId,cu.open_id openId,cu.union_id unionId,
  142. cu.nick_name nickName,cu.gender,cu.avatar_url avatarUrl,cu.phone,
  143. cu.pure_phone purePhone,cu.city,cu.province,cu.`language`,cu.country_code countryCode,
  144. cu.register_ip registerIp,cu.verify_code_phone verifyCodePhone,cu.qrcode_source qrcodeSource,
  145. cu.scene,cu.scene_address sceneAddress,cu.score,cu.update_date updateDate,
  146. cu.create_date createDate,cu.app_id appId,cu.session_key sessionKey,cu.token,
  147. cu.expire_time expireTime,cu.latitude,cu.longitude,cubi.birthdate,cubi.education,
  148. cubi.sex,cubi.email,cubi.address,cubi.poins,cubi.`name`,cubi.`level`,cubi.id cubiid
  149. from wx_c_user cu left join wx_c_user_basic_info cubi
  150. on cu.phone=cubi.phone and cu.tenant_id=cubi.tenant_id
  151. where 1=1
  152. <if test=" null != tenantId ">
  153. and cu.`tenant_id` = #{tenantId}
  154. </if>
  155. <if test=" null != phone and phone !='' ">
  156. and cu.`phone` = #{phone}
  157. </if>
  158. <if test=" null == phone or phone =='' ">
  159. and cu.`phone` is not null
  160. </if>
  161. <if test=" null != startTime ">
  162. and cubi.create_date &gt;= #{startTime}
  163. </if>
  164. <if test=" null != endTime">
  165. and cubi.update_date &lt;= #{endTime}
  166. </if>
  167. <if test=" null != name and name != '' ">
  168. and cb.`name` like concat('%', #{name},'%')
  169. </if>
  170. </select>
  171. </mapper>