| | |
| | | // List<Map<Object, Object>> getLine(); |
| | | |
| | | @Select("select aa.date,\n" + |
| | | " sum(if(c.tj_type='团队', ifnull(c.coun,0),0)) as tdcoun,\n" + |
| | | " sum(if(c.tj_type='个人', ifnull(c.coun,0),0)) as grcoun,\n" + |
| | | " sum(if(c.tj_type='报告', ifnull(c.coun,0),0)) as bgcoun \n" + |
| | | " from (\n" + |
| | | " SELECT date_sub(CURDATE(),interval @i:=@i+1 day) as date\n" + |
| | | " from (select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1) as a,\n" + |
| | | " (select @i:= -1) b) aa \n" + |
| | | " left join (\n" + |
| | | " select date_format(create_time, '%Y-%m-%d') dat, tj_type, count(*) coun\n" + |
| | | " from tj_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + |
| | | " group by date_format(create_time, '%Y-%m-%d'),tj_type\n" + |
| | | " union\n" + |
| | | " select date_format(report_time, '%Y-%m-%d') dat, '报告' tj_type, count(*) coun\n" + |
| | | " from tj_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + |
| | | " group by date_format(report_time, '%Y-%m-%d')\n" + |
| | | " ) c on c.dat =aa.date\n" + |
| | | "group by aa.date") |
| | | " sum(if(c.tj_type='1', ifnull(c.coun,0),0)) as tdcoun,\n" + |
| | | " sum(if(c.tj_type='2', ifnull(c.coun,0),0)) as grcoun,\n" + |
| | | " sum(if(c.tj_type='3', ifnull(c.coun,0),0)) as bgcoun \n" + |
| | | " from (\n" + |
| | | " SELECT date_sub(CURDATE(),interval @i:=@i+1 day) as date\n" + |
| | | " from (select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + |
| | | " select 1 union all select 1) as a,\n" + |
| | | " (select @i:= -1) b) aa\n" + |
| | | " left join (\n" + |
| | | " select date_format(create_time, '%Y-%m-%d') dat, tj_type, count(*) coun\n" + |
| | | " from tj_order where deleted=0 AND tj_type=2 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + |
| | | " group by date_format(create_time, '%Y-%m-%d')\t\n" + |
| | | "\t\t\t\tunion\n" + |
| | | " select date_format(create_time, '%Y-%m-%d') dat,tj_type, count(*) coun\n" + |
| | | " from tj_order where deleted=0 AND tj_type=1 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + |
| | | " group by date_format(create_time, '%Y-%m-%d')\t\t\t\t\t\n" + |
| | | "\t\t\t\tunion\n" + |
| | | " select date_format(create_time, '%Y-%m-%d') dat, 3 tj_type, count(*) coun\n" + |
| | | " from tj_order where deleted=0 AND !ISNULL(report_time) AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + |
| | | " group by date_format(create_time, '%Y-%m-%d')\n" + |
| | | " ) c on c.dat =aa.date\n" + |
| | | " group by aa.date") |
| | | List<LineChartsVo> getLine(); |
| | | |
| | | |