Commit db29f1ce authored by jiaorz's avatar jiaorz

车辆服务次数统计

parent ba2e9ce3
package com.xxfc.platform.order.pojo;
import lombok.Data;
import java.util.Date;
@Data
public class CountVehicleServiceNumVo {
//年
private String countYear;
//年月
private String countMonth;
//年周
private String countWeek;
//日期
private Date countDate;
//公司ID
private Integer companyId;
//出车服务次数
private Integer departureNum;
//收车服务次数
private Integer arrivalNum;
//租车天数
private Integer rentNum;
}
......@@ -3,10 +3,15 @@ package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderVehicleServiceStatistics;
import com.xxfc.platform.order.mapper.OrderVehicleServiceStatisticsMapper;
import com.xxfc.platform.order.pojo.CountVehicleServiceNumVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class OrderVehicleServiceStatisticsBiz extends BaseBiz<OrderVehicleServiceStatisticsMapper, OrderVehicleServiceStatistics> {
......@@ -19,4 +24,10 @@ public class OrderVehicleServiceStatisticsBiz extends BaseBiz<OrderVehicleServic
}
public void countVehicleServiceNum() {
Map<String, Object> map = new HashMap<>();
List<CountVehicleServiceNumVo> list = mapper.countVehicleServiceNum(map);
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderVehicleServiceStatistics;
import com.xxfc.platform.order.pojo.CountVehicleServiceNumVo;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
/**
* 出车、收车服务次数统计
*/
public interface OrderVehicleServiceStatisticsMapper extends Mapper<OrderVehicleServiceStatistics> {
List<CountVehicleServiceNumVo> countVehicleServiceNum(Map<String, Object> param);
}
\ No newline at end of file
......@@ -2,8 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.order.mapper.OrderVehicleServiceStatisticsMapper" >
<!--统计车辆服务次数-->
<select id="countVehicleServiceNum">
<select id="countVehicleServiceNum" parameterType="Map" resultType="com.xxfc.platform.order.pojo.CountVehicleServiceNumVo">
SELECT tmp1.countYear,tmp1.countMonth,tmp1.countDay, tmp1.companyId, tmp1.countWeek, tmp1.countNum as departureNum, tmp2.countNum as arrivalNum from (
SELECT YEAR(FROM_UNIXTIME(o.crt_time/1000)) as countYear, MONTH(FROM_UNIXTIME(o.crt_time/1000)) AS countMonth, DAY(FROM_UNIXTIME(o.crt_time/1000)) AS countDay, WEEK(FROM_UNIXTIME(o.crt_time/1000))as countWeek, o1.start_company_id as companyId, count(*) as countNum from order_vehicle_crosstown o
LEFT JOIN order_rent_vehicle_detail o1 on o.order_id = o1.order_id
where o.type = 1
<if test="startTime != null">
and o.crt_time &gt;= #{startTime} and o.crt_time &lt;= #{endTime}
</if>
GROUP BY companyId, countYear,countMonth,countDay,countWeek
) tmp1
LEFT JOIN
(SELECT YEAR(FROM_UNIXTIME(o.crt_time/1000)) as countYear, MONTH(FROM_UNIXTIME(o.crt_time/1000)) AS countMonth, DAY(FROM_UNIXTIME(o.crt_time/1000)) AS countDay, WEEK(FROM_UNIXTIME(o.crt_time/1000))as countWeek, o1.end_company_id as companyId, count(*) as countNum from order_vehicle_crosstown o
LEFT JOIN order_rent_vehicle_detail o1 on o.order_id = o1.order_id
where (o.type = 2 or o.type = 3)
<if test="startTime != null">
and o.crt_time &gt;= #{startTime} and o.crt_time &lt;= #{endTime}
</if>
GROUP BY companyId, countYear,countMonth,countDay,countWeek
) tmp2 on tmp1.companyId = tmp2.companyId
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment