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

298 строки
10 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.WxCUserBasicInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.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 `tenant_id` = #{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 != createDate ">
  58. and `create_date` = #{createDate}
  59. </if>
  60. <if test=" null != updateDate ">
  61. and `update_date` = #{updateDate}
  62. </if>
  63. <if test=" null != name ">
  64. and `name` like concat('%', #{name},'%')
  65. </if>
  66. <if test=" null != startTime and null!=endTime">
  67. and `create_date` between #{startTime} and #{endTime}
  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.iformall.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. <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
  88. update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId}
  89. and id=#{id}
  90. </update>
  91. <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
  92. update wx_c_user_basic_info set id=#{newId} where tenant_id=#{tenantId}
  93. and id = #{id}
  94. </update>
  95. <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  96. select count(id) from wx_c_user_basic_info
  97. where sex =#{sex}
  98. <if test=" null != startTime ">
  99. and create_date &gt;= #{startTime}
  100. </if>
  101. <if test=" null != endTime">
  102. and create_date &lt;= #{endTime}
  103. </if>
  104. <if test="null != tenantId">
  105. and tenant_id =#{tenantId}
  106. </if>
  107. </select>
  108. <select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  109. select count(id) from wx_c_user_basic_info where 1=1
  110. <if test=" null != startTime ">
  111. and create_date &gt;= #{startTime}
  112. </if>
  113. <if test=" null != endTime">
  114. and create_date &lt;= #{endTime}
  115. </if>
  116. <if test=" null != birthStartTime ">
  117. and birthdate &gt;= #{birthStartTime}
  118. </if>
  119. <if test=" null != birthEndTime">
  120. and birthdate &lt;= #{birthEndTime}
  121. </if>
  122. <if test=" null == birthStartTime and null == birthEndTime">
  123. and birthdate is null
  124. </if>
  125. <if test="null != tenantId">
  126. and tenant_id =#{tenantId}
  127. </if>
  128. </select>
  129. <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  130. select count(id) from wx_c_user_basic_info where 1=1
  131. <if test=" null != startTime ">
  132. and create_date &gt;= #{startTime}
  133. </if>
  134. <if test=" null != endTime">
  135. and create_date &lt;= #{endTime}
  136. </if>
  137. <if test=" null != levelStartScore ">
  138. and poins &gt;= #{levelStartScore}
  139. </if>
  140. <if test=" null != levelEndScore">
  141. and poins &lt;= #{levelEndScore}
  142. </if>
  143. <if test=" null == levelStartScore and null == levelEndScore">
  144. and poins is null
  145. </if>
  146. <if test="null != tenantId">
  147. and tenant_id =#{tenantId}
  148. </if>
  149. </select>
  150. <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  151. select count(id) from wx_c_user_basic_info where 1=1
  152. <if test=" null != startTime ">
  153. and create_date &gt;= #{startTime}
  154. </if>
  155. <if test=" null != endTime">
  156. and create_date &lt; #{endTime}
  157. </if>
  158. <if test="null != tenantId">
  159. and tenant_id =#{tenantId}
  160. </if>
  161. </select>
  162. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
  163. <id column="id" jdbcType="BIGINT" property="id"/>
  164. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  165. <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
  166. <result column="education" jdbcType="VARCHAR" property="education"/>
  167. <result column="sex" jdbcType="INTEGER" property="sex"/>
  168. <result column="email" jdbcType="VARCHAR" property="email"/>
  169. <result column="address" jdbcType="VARCHAR" property="address"/>
  170. <result column="poins" jdbcType="INTEGER" property="poins"/>
  171. <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
  172. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  173. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  174. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  175. <result column="name" jdbcType="VARCHAR" property="name"/>
  176. <result column="level" jdbcType="VARCHAR" property="level"/>
  177. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  178. <result column="tags" jdbcType="VARCHAR" property="tags"/>
  179. </resultMap>
  180. <sql id="allVoColumns">
  181. cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`,
  182. cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`,
  183. cut.`tags`
  184. </sql>
  185. <sql id="dynamicVoWhereConditions">
  186. where 1 = 1
  187. <if test=" null != id ">
  188. and cu.`id` = #{id}
  189. </if>
  190. <if test=" null != tenantId ">
  191. and cu.`tenant_id` = #{tenantId}
  192. </if>
  193. <if test=" null != phone ">
  194. and cu.`phone` like concat('%', #{phone},'%')
  195. </if>
  196. <if test=" null != birthdate ">
  197. and cu.`birthdate` = #{birthdate}
  198. </if>
  199. <if test=" null != education ">
  200. and cu.`education` like concat('%', #{education},'%')
  201. </if>
  202. <if test=" null != sex ">
  203. and cu.`sex` = #{sex}
  204. </if>
  205. <if test=" null != email ">
  206. and cu.`email` like concat('%', #{email},'%')
  207. </if>
  208. <if test=" null != address ">
  209. and cu.`address` like concat('%', #{address},'%')
  210. </if>
  211. <if test=" null != poins ">
  212. and cu.`poins` = #{poins}
  213. </if>
  214. <if test=" null != tagId ">
  215. and cu.`tag_id` = #{tagId}
  216. </if>
  217. <if test=" null != createDate ">
  218. and cu.`create_date` = #{createDate}
  219. </if>
  220. <if test=" null != updateDate ">
  221. and cu.`update_date` = #{updateDate}
  222. </if>
  223. <if test=" null != name ">
  224. and `name` like concat('%', #{name},'%')
  225. </if>
  226. <if test=" null != startTime and null!=endTime">
  227. and cu.`create_date` between #{startTime} and #{endTime}
  228. </if>
  229. <if test=" null != ids ">
  230. and id in
  231. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  232. #{idItem}
  233. </foreach>
  234. </if>
  235. <if test=" null != sortColumns">order by ${sortColumns}</if>
  236. </sql>
  237. <select id="findVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultMap="VoBaseResultMap">
  238. select
  239. <include refid="allVoColumns"/>
  240. from wx_c_user_basic_info cu
  241. left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
  242. <include refid="dynamicVoWhereConditions"/>
  243. </select>
  244. </mapper>