Commit 0520cfcf by 杨林龙

优化首页设备激活趋势展示

1 parent 45608875
......@@ -761,22 +761,30 @@
</select>
<select id="getActiveDeviceInfoWithAuth" resultType="cn.com.glsx.admin.modules.model.ActiveDeviceVo">
SELECT count(tvd.id) AS activeDeviceNumber,
SELECT count(temp.id) AS activeDeviceNumber,
<choose>
<when test="period == 1 || period == 2">
DATE_FORMAT(tvd.created_date,'%H') as activeDate
DATE_FORMAT(temp.created_date,'%H') as activeDate
from (
select tvd.id,
tvd.created_date
FROM t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
WHERE tvd.bind_status = 1 and tv.del_flag = 0 and tvd.del_flag = 0
${appendSql}
GROUP BY DATE_FORMAT(tvd.created_date,'%H')
) temp
GROUP BY DATE_FORMAT(temp.created_date,'%H')
</when>
<otherwise>
DATE_FORMAT(tvd.created_date,'%Y-%m-%d') as activeDate
DATE_FORMAT(temp.created_date,'%Y-%m-%d') as activeDate
from (
select tvd.id,
tvd.created_date
FROM t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
WHERE tvd.bind_status = 1 and tv.del_flag = 0 and tvd.del_flag = 0
${appendSql}
)temp
GROUP BY DATE_FORMAT(tvd.created_date,'%Y-%m-%d')
</otherwise>
</choose>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!