Commit 08b1fcd5 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 31db0fdc dc69c356
......@@ -130,6 +130,9 @@
</foreach>
</if>
<if test="userId != null">
and b.user_id = #{userId}
</if>
<if test="status != null">
and b.status = #{status}
</if>
......
package com.xxfc.platform.vehicle.pojo;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import lombok.Data;
@Data
public class DepartureLogVo extends VehicleDepartureLog {
VehicleBookRecord vehicleBookRecord;
}
......@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper;
import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.DepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureStatisticDataVo;
import lombok.extern.slf4j.Slf4j;
......@@ -24,6 +25,7 @@ import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
......@@ -103,6 +105,9 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
}
public Integer selectAllDepartureLog(Map<String, Object> param) {
return mapper.selectAllDepartureLog(param);
}
public ObjectRestResponse findOne(Integer vid) throws Exception {
Example exm = Example.builder(VehicleDepartureLog.class)
......
......@@ -10,4 +10,5 @@ public interface VehicleCountRecordMapper extends Mapper<VehicleCountRecord> {
List<VehicleCountRecord> countDepartureVehicle(VehicleCountRecord vehicleCountRecord);
List<VehicleCountRecord> selectByTypeAndTime(Map<String, Object> param);
List<VehicleCountRecord> selectByTime(Map<String, Object> param);
}
\ No newline at end of file
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleDepartureLog;
import com.xxfc.platform.vehicle.pojo.DepartureLogVo;
import com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;
public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLog>, Mapper<VehicleDepartureLog> {
......@@ -32,4 +34,5 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
String selectDayByVehicleId(String vehicleId);
VehicleDepartureLogVo selectByBookRecordId(Long bookRecordId);
Integer selectAllDepartureLog(Map<String, Object> param);
}
......@@ -30,7 +30,7 @@ public class VehicleCountRecordController {
@GetMapping("/app/unauth/get")
@ResponseBody
public ObjectRestResponse getByTypeAndDate(VehicleCountRecord vehicleCountRecord) {
return vehicleCountRecordBiz.countDepartureVehicle(vehicleCountRecord);
return vehicleCountRecordBiz.selectByTime(vehicleCountRecord);
}
@PostMapping("/app/unauth/export")
......@@ -43,4 +43,10 @@ public class VehicleCountRecordController {
public void download(ExcelParamDto excelParamDto, HttpServletRequest request,HttpServletResponse response) {
DownloadUtil.downloadFile(excelParamDto.getPath(), "export.xls", response,request);
}
@GetMapping("/app/unauth/selectByTime")
public ObjectRestResponse selectByTime(VehicleCountRecord vehicleCountRecord) {
return vehicleCountRecordBiz.selectByTime(vehicleCountRecord);
}
}
......@@ -35,4 +35,12 @@
order by id DESC
</select>
<select id="selectByTime" parameterType = "Map" resultType="com.xxfc.platform.vehicle.entity.VehicleCountRecord">
select * from vehicle_count_record
where count_date &gt;= #{startTime} and count_date &lt;= #{endTime}
<if test="type != null">
and type = #{type}
</if>
order by id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -2,7 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleDepartureLogMapper" >
<resultMap id="searchBookRecord" type="com.xxfc.platform.vehicle.pojo.DepartureLogVo">
<result column="book_record_id" property="bookRecordId" jdbcType="INTEGER" javaType="java.lang.Integer"/>
<association property="vehicleBookRecord" column="id"
select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.selectOne"/>
</resultMap>
<select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog">
select * from vehicle_departure_log
where vehicle_id = #{vehicleId}
......@@ -30,7 +34,55 @@
where vehicle_departure_log.book_record_id = #{id}
order by create_time desc
</select>
<select id="selectAllDepartureLog" resultType="java.lang.Integer" parameterType="Map">
SELECT
count(*)
FROM
vehicle_departure_log v1
LEFT JOIN vehicle_book_record v2 on v1.book_record_id = v2.id
<where>
<if test="startTime != null and status == 1">
and (v1.departure_time between #{startTime} and #{endTime})
</if>
<if test="startTime != null and status == 2">
and (v1.arrival_time between #{startTime} and #{endTime})
</if>
<!--正常出车-->
<if test="startTime != null and status == 1 and type == 1">
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前出车-->
<if test="endTime != null and status == 1 and type == 2">
and v2.book_start_date &gt;= #{endTime}
</if>
<!--延期出车-->
<if test="startTime != null and status == 1 and type == 3">
and v2.book_start_date &lt;= #{startTime}
</if>
<!--正常还车-->
<if test="startTime != null and status == 2 and type == 1">
and (v2.book_start_date between #{startTime} and #{endTime})
</if>
<!--提前还车-->
<if test="endTime != null and status == 2 and type == 2">
and v2.book_start_date &gt;= #{endTime}
</if>
<!--延期还车-->
<if test="startTime != null and status == 2 and type == 3">
and v2.book_start_date &lt;= #{startTime}
</if>
<!--统计客户用车-->
<if test="bookUser != null">
and v2.book_user = #{bookUser}
</if>
<if test="bookUser == null">
and v2.book_user != -2
</if>
</where>
</select>
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
......
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