| <?xml version="1.0" encoding="UTF-8" ?> | 
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | 
| <mapper namespace="com.mzl.flower.mapper.member.MemberGrowthRecordMapper"> | 
|   | 
|     <select id="queryPage" resultType="com.mzl.flower.dto.response.member.MemberGrowthRecordVO"> | 
|         select * from t_member_growth_record t where t.deleted= 0 | 
|         <if test="dto.type != null and dto.type != ''"> | 
|             and t.type = #{dto.type} | 
|         </if> | 
|         <if test="dto.source != null and dto.source != ''"> | 
|             and t.source = #{dto.source} | 
|         </if> | 
|         <if test="dto.startRecordDate!=null "> | 
|             <![CDATA[ | 
|                AND t.create_time >= #{dto.startRecordDate} | 
|             ]]> | 
|         </if> | 
|         <if test="dto.endRecordDate!=null "> | 
|             <![CDATA[ | 
|                AND t.create_time <= #{dto.endRecordDate} | 
|             ]]> | 
|         </if> | 
|         <if test="dto.userId != null and dto.userId != ''"> | 
|             and t.user_id = #{dto.userId} | 
|         </if> | 
|         order by t.update_time desc | 
|     </select> | 
|   | 
|     <select id="queryUserPage" resultType="com.mzl.flower.dto.response.member.UserGrowthRecordVO"> | 
|         SELECT c.name as nickName, c.level_id as levelId, t.tel, t.id as userId, m.name AS levelName, IFNULL(SUM(mg.growth), 0) AS sumGrowthValue | 
|         FROM t_customer_info c | 
|                  LEFT JOIN t_user t ON c.user_id = t.id | 
|                  LEFT JOIN t_member m ON c.level_id = m.id | 
|                  LEFT JOIN (SELECT user_id, SUM(growth) AS growth | 
|                             FROM t_member_growth_record | 
|                             WHERE deleted = 0 | 
|                             GROUP BY user_id) mg ON c.user_id = mg.user_id | 
|         WHERE c.deleted = 0 | 
|         <if test="dto.nickName!= null and dto.nickName != ''"> | 
|             AND c.name LIKE CONCAT('%',#{dto.nickName},'%') | 
|         </if> | 
|         <if test="dto.tel!= null and dto.tel != ''"> | 
|             and t.tel like CONCAT('%',#{dto.tel},'%') | 
|         </if> | 
|         GROUP BY c.id | 
|         order by c.update_time desc | 
|     </select> | 
| </mapper> |