Commit db3b7742 by 刘宇峰

试驾报表统计

1 parent 0937d884
......@@ -31,13 +31,15 @@
tu.username shopName,
tefs.sn,
tefs.vin,
tv.model_name vehicleTypeName
from t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name, '/', series_name) end vehicleTypeName
from t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_electric_fence tef on tef.id = tefs.fence_id
left join t_user tu on tu.id = tef.created_by
where tefs.fence_id = tef.id
and tef.biz_fence_type = 12 and tu.del_flag = 0
and tef.del_flag = 0
and tef.biz_fence_type = 12
and tu.del_flag = 0
<if test="keywords != null and keywords!='' ">
and (
tu.account like '%${keywords}%'
......@@ -51,11 +53,14 @@
parameterType="cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
resultMap="BaseResultMap">
SELECT tall.shopCode, tall.shopName, tall.vehicleTypeName, tall.sn, tall.vin, left(tall.statDate,7)
statDate, tall.cnt, day(tall.statDate) dayCount , sum(cnt) cnttotal FROM
(select tu.account shopCode, tu.username shopName, tv.model_name vehicleTypeName,
tefdd.sn, tv.vin, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when tefdd.percent >= 80
then 1 else 0
end) cnt
statDate, tall.cnt, day(tall.statDate) dayCount , sum(cnt) cnttotal FROM (select tu.account shopCode,
tu.username shopName,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name, '/', series_name) end
vehicleTypeName,
tefdd.sn,
tv.vin,
DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate,
sum(case when tefdd.percent >= 80 then 1 else 0 end) cnt
from t_electric_fence_drive tefdd
left join t_electric_fence tef on tef.id = tefdd.fence_id
left join t_vehicle_device tvv on tvv.sn = tefdd.sn and tvv.bind_status = 1 and tvv.del_flag = 0
......@@ -85,13 +90,15 @@
<if test="sn !=null and sn != ''">
and tefdd.sn = #{sn,jdbcType=VARCHAR}
</if>
and tef.del_flag = 0
</where>
GROUP BY tefdd.sn,tefdd.fence_id,statDate order by tu.account) tall GROUP BY tall.shopCode, tall.sn,
tall.statDate ORDER BY tall.shopCode
</select>
<select id="getYearWithData" resultType="java.lang.String">
select distinct left(journey_time,4) from t_electric_fence_drive
select distinct left (journey_time, 4)
from t_electric_fence_drive
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!