| | |
| | | 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> |