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

336 строки
12 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. <sql id="allColumnsOfScoreList">
  151. cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id,
  152. cub.create_date,cub.update_date,cub.tenant_id,cub.name,cub.level,cub.nick_name
  153. </sql>
  154. <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
  155. select <include refid="allColumnsOfScoreList"/>
  156. from wx_c_user_basic_info cub
  157. inner join wx_c_user cu on cu.id = cub.id
  158. where 1=1
  159. <if test=" null != levelStartScore ">
  160. and cub.poins &gt;= #{levelStartScore}
  161. </if>
  162. <if test=" null != levelEndScore">
  163. and cub.poins &lt;= #{levelEndScore}
  164. </if>
  165. <if test=" null == levelStartScore and null == levelEndScore">
  166. and cub.poins is null
  167. </if>
  168. <if test="null != tenantId">
  169. and cub.tenant_id =#{tenantId}
  170. </if>
  171. </select>
  172. <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
  173. select count(id) from wx_c_user_basic_info where 1=1
  174. <if test=" null != startTime ">
  175. and create_date &gt;= #{startTime}
  176. </if>
  177. <if test=" null != endTime">
  178. and create_date &lt; #{endTime}
  179. </if>
  180. <if test="null != tenantId">
  181. and tenant_id =#{tenantId}
  182. </if>
  183. </select>
  184. <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo">
  185. <id column="id" jdbcType="BIGINT" property="id"/>
  186. <result column="phone" jdbcType="VARCHAR" property="phone"/>
  187. <result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
  188. <result column="education" jdbcType="VARCHAR" property="education"/>
  189. <result column="sex" jdbcType="INTEGER" property="sex"/>
  190. <result column="email" jdbcType="VARCHAR" property="email"/>
  191. <result column="address" jdbcType="VARCHAR" property="address"/>
  192. <result column="poins" jdbcType="INTEGER" property="poins"/>
  193. <result column="tag_id" jdbcType="BIGINT" property="tagId"/>
  194. <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
  195. <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
  196. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  197. <result column="name" jdbcType="VARCHAR" property="name"/>
  198. <result column="level" jdbcType="VARCHAR" property="level"/>
  199. <result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
  200. <result column="tags" jdbcType="VARCHAR" property="tags"/>
  201. </resultMap>
  202. <sql id="allVoColumns">
  203. cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`,
  204. cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`,
  205. cut.`tags`
  206. </sql>
  207. <sql id="dynamicVoWhereConditions">
  208. where 1 = 1
  209. <if test=" null != id ">
  210. and cu.`id` = #{id}
  211. </if>
  212. <if test=" null != tenantId ">
  213. and cu.`tenant_id` = #{tenantId}
  214. </if>
  215. <if test=" null != phone ">
  216. and cu.`phone` like concat('%', #{phone},'%')
  217. </if>
  218. <if test=" null != birthdate ">
  219. and cu.`birthdate` = #{birthdate}
  220. </if>
  221. <if test=" null != education ">
  222. and cu.`education` like concat('%', #{education},'%')
  223. </if>
  224. <if test=" null != sex ">
  225. and cu.`sex` = #{sex}
  226. </if>
  227. <if test=" null != email ">
  228. and cu.`email` like concat('%', #{email},'%')
  229. </if>
  230. <if test=" null != address ">
  231. and cu.`address` like concat('%', #{address},'%')
  232. </if>
  233. <if test=" null != poins ">
  234. and cu.`poins` = #{poins}
  235. </if>
  236. <if test=" null != tagId ">
  237. and cu.`tag_id` = #{tagId}
  238. </if>
  239. <if test=" null != createDate ">
  240. and cu.`create_date` = #{createDate}
  241. </if>
  242. <if test=" null != updateDate ">
  243. and cu.`update_date` = #{updateDate}
  244. </if>
  245. <if test=" null != name ">
  246. and `name` like concat('%', #{name},'%')
  247. </if>
  248. <if test=" null != startTime and null!=endTime">
  249. and cu.`create_date` between #{startTime} and #{endTime}
  250. </if>
  251. <if test=" null != ids ">
  252. and id in
  253. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  254. #{idItem}
  255. </foreach>
  256. </if>
  257. <if test=" null != sortColumns">order by ${sortColumns}</if>
  258. </sql>
  259. <select id="findVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultMap="VoBaseResultMap">
  260. select
  261. <include refid="allVoColumns"/>
  262. from wx_c_user_basic_info cu
  263. left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
  264. <include refid="dynamicVoWhereConditions"/>
  265. </select>
  266. <select id="countVoList" parameterType="com.iformall.domain.vo.WxCUserBasicInfoVo" resultType="java.lang.Integer">
  267. select
  268. count(*)
  269. from wx_c_user_basic_info cu
  270. left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
  271. <include refid="dynamicVoWhereConditions"/>
  272. </select>
  273. </mapper>