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

198 строки
6.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.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. </mapper>