需求是,需要给出能够显示成如下的折线图的后台数据
直接给出sql(此处运用的为mybatis)
<!-- 统计新增用户数,即注册后指定时间有登录过小程序的用户.按照日期进行分组回显-->
<select id="countNewAddUserGroupByLogTime" resultMap="lineDataStaticMap">
select count(ipanther_user.id) count_num,
date_format(ipanther_user.create_time,'%Y-%m-%d') as date_str
from ipanther_user where IS_DELETED = 'N'
<if test="cm.createTimeStart != null and cm.createTimeEnd != null">
and ipanther_user.create_time <![CDATA[>]]> #{cm.createTimeStart}
and ipanther_user.create_time <![CDATA[<]]> #{cm.createTimeEnd}
</if>
group by date_str
</select>
基本逻辑,查询出日期,还有根据日期的统计数据。根据日期groupBy即可