Commit 7aa91eea authored by 周健威's avatar 周健威

修改合并

parent 76d1ccb0
...@@ -122,4 +122,8 @@ public class AddOrUpdateVehicleVo { ...@@ -122,4 +122,8 @@ public class AddOrUpdateVehicleVo {
* 生产商 * 生产商
*/ */
private Date receiveTime; private Date receiveTime;
/**
* 最后公里数
*/
private Integer mileageLastUpdate;
} }
\ No newline at end of file
...@@ -85,5 +85,6 @@ public class BookVehicleVO { ...@@ -85,5 +85,6 @@ public class BookVehicleVO {
@ApiModelProperty("是否违章") @ApiModelProperty("是否违章")
private Integer haveViolation; private Integer haveViolation;
//还车分公司
private Integer retCompany;
} }
\ No newline at end of file
...@@ -89,6 +89,10 @@ public class QueryVehicleVo { ...@@ -89,6 +89,10 @@ public class QueryVehicleVo {
* 保养时间 * 保养时间
*/ */
private Date maintenanceDate; private Date maintenanceDate;
/**
* 保养公里
*/
private Integer mileage;
/** /**
* 保养里程数 * 保养里程数
......
...@@ -20,6 +20,10 @@ public class VehicleDepartureLogVo { ...@@ -20,6 +20,10 @@ public class VehicleDepartureLogVo {
String arrivalTime; String arrivalTime;
Integer mileageStart; Integer mileageStart;
Integer mileageEnd; Integer mileageEnd;
Integer mileage;
Integer state; Integer state;
String numberPlate; String numberPlate;
String departureDay;
String departureName;
String arrivalName;
} }
...@@ -14,7 +14,7 @@ public class VehicleDepartureStatisticDataVo { ...@@ -14,7 +14,7 @@ public class VehicleDepartureStatisticDataVo {
/** /**
* 出车天数 * 出车天数
*/ */
Integer departureDay; String departureDay;
/** /**
* 出车公里数 * 出车公里数
*/ */
......
...@@ -31,6 +31,19 @@ public class VehiclePageQueryVo { ...@@ -31,6 +31,19 @@ public class VehiclePageQueryVo {
* 所属分支机构(id) * 所属分支机构(id)
*/ */
private Integer subordinateBranch; private Integer subordinateBranch;
/**
* 所属分支机构(id)
*/
private Integer addrProvince;
/**
* 所属分支机构(id)
*/
private Integer addrCity;
/**
* 片区
*/
private Integer zoneId;
/** /**
* 用途类型:租赁房车(1)、展车等,对应关系见车辆常量表 * 用途类型:租赁房车(1)、展车等,对应关系见车辆常量表
......
...@@ -53,11 +53,15 @@ public class VehicleWarningMsgQueryVo { ...@@ -53,11 +53,15 @@ public class VehicleWarningMsgQueryVo {
*/ */
private Integer vehicleCode; private Integer vehicleCode;
private Integer subordinateBranch;
/** /**
* 对应车牌号 * 对应车牌号
*/ */
private String numberPlate; private String numberPlate;
private Integer mileageLastUpdate;
private Date createTime; private Date createTime;
......
...@@ -243,6 +243,23 @@ ...@@ -243,6 +243,23 @@
vehicle_book_info vbf on vbf.vehicle = vbr.vehicle and vbf.year_month = #{selectedMonth} vehicle_book_info vbf on vbf.vehicle = vbr.vehicle and vbf.year_month = #{selectedMonth}
where where
1=1 1=1
<if test="companyList != null and companyList.size() > 0">
and ( vbr.lift_company in (
<trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId},
</foreach>
</trim>
)
or vbr.ret_company in (
<trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId},
</foreach>
</trim>
)
)
</if>
<if test="liftCompany !=null"> <if test="liftCompany !=null">
and vbr.lift_company = #{liftCompany} and vbr.lift_company = #{liftCompany}
</if> </if>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!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" > <mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleUpkeepLogMapper">
<resultMap id="BaseResultMap" type="com.xxfc.platform.vehicle.entity.VehicleUpkeepLog">
<!--
<select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleDepartureLog"> WARNING - @mbg.generated
select * from vehicle_departure_log -->
where vehicle_id = #{vehicleId} <id column="id" property="id" jdbcType="INTEGER"/>
order by create_time desc <result column="vehicle_id" property="vehicleId" jdbcType="VARCHAR"/>
limit 1 <result column="operator" property="operator" jdbcType="VARCHAR"/>
</select> <result column="date" property="date" jdbcType="TIMESTAMP"/>
<select id="selectByVehicleId"> <result column="mileage" property="mileage" jdbcType="INTEGER"/>
select vehicle_departure_log.*,vehicle.number_plate <result column="amount" property="amount" jdbcType="DECIMAL"/>
from vehicle_departure_log <result column="approvers" property="approvers" jdbcType="VARCHAR"/>
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id <result column="branch_company_id" property="branchCompanyId" jdbcType="INTEGER"/>
where vehicle_id = #{vehicleId} <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
order by create_time desc </resultMap>
</select> <insert id="addItems">
<select id="selectVoAll" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> insert into vehicle_upkeep_log_item(log_id, item_id)
select vehicle_departure_log.*,vehicle.number_plate values
from vehicle_departure_log <trim suffixOverrides=",">
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id <foreach collection="upkeepItems" item="item">
<trim prefix="where"> (#{id}, #{item}),
<if test="numberPlate != null and numberPlate != ''"> </foreach>
vehicle.number_plate = #{numberPlate}
</if>
</trim> </trim>
order by create_time desc </insert>
</select> <delete id="deleteItemsByLogId">
<select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo"> delete from vehicle_upkeep_log_item
select vehicle_departure_log.*,vehicle.number_plate where log_id = #{id}
from vehicle_departure_log </delete>
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id <select id="selectVoAll" resultType="com.xxfc.platform.vehicle.vo.VehicleUpkeepLogVo">
<trim prefix="where" suffixOverrides="and"> select a.*, b.number_plate, c.name as branch_company_name
from vehicle_upkeep_log a
left join vehicle b on a.vehicle_id = b.id
left join branch_company c on a.branch_company_id = c.id
<trim prefix="where">
1=1
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and and b.number_plate = #{numberPlate}
</if> </if>
<if test="companyList != null"> <if test="companyList != null and companyList.size() > 0">
( vehicle.park_branch_company_id in ( and ( a.branch_company_id in (
<foreach collection="companyList" item="companyId">
<trim suffixOverrides=","> <trim suffixOverrides=",">
#{companyId},
</trim>
</foreach>
)
or vehicle.expect_destination_branch_company_id in (
<foreach collection="companyList" item="companyId"> <foreach collection="companyList" item="companyId">
<trim suffixOverrides=",">
#{companyId}, #{companyId},
</trim>
</foreach> </foreach>
</trim>
) )
) )
</if> </if>
</trim> </trim>
order by create_time desc order by a.create_time desc
</select>
<select id="selectVoById" resultType="com.xxfc.platform.vehicle.vo.VehicleUpkeepLogVo">
select a.*, b.number_plate, c.name as branch_company_name
from vehicle_upkeep_log a
left join vehicle b on a.vehicle_id = b.id
left join branch_company c on a.branch_company_id = c.id
where a.id = #{id}
</select> </select>
<select id="selectMileageByVehicleId" resultType="int"> <select id="getItemsByLogId" resultType="com.xxfc.platform.vehicle.vo.VehicleUpkeepLogItemVo">
select sum(mileage_end - mileage_start) select a.*, b.name as item_name
from vehicle_departure_log from vehicle_upkeep_log_item a
where vehicle_id = #{vehicleId}; left join vehicle_upkeep_item b on a.item_id = b.id
where a.log_id = #{id}
</select> </select>
<select id="selectDayByVehicleId" resultType="int"> <select id="selectLastByVehicleId" resultType="com.xxfc.platform.vehicle.entity.VehicleUpkeepLog">
select sum(to_days(arrival_time) - to_days(departure_time)) select *
from vehicle_departure_log from vehicle_upkeep_log
where vehicle_id = #{vehicleId}; where vehicle_id = #{vehicleId}
order by create_time desc
limit 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
<select id="getByPage" parameterType="java.util.Map" <select id="getByPage" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.pojo.QueryVehicleVo"> resultType="com.xxfc.platform.vehicle.pojo.QueryVehicleVo">
select v.`id`, select DISTINCT v.`id`,
v.`code`, v.`code`,
v.`status`, v.`status`,
v.number_plate, v.number_plate,
v.brand, v.brand,
v.subordinate_branch, IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch,
bc.name as subBranchName, IFNULL(bc.name,bc1.name) AS subBranchName,
v.use_type, v.use_type,
v.remark, v.remark,
v.create_time, v.create_time,
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
v.engine_num, v.engine_num,
v.manufacturer, v.manufacturer,
v.receive_time, v.receive_time,
v.update_time v.update_time,
v.mileage_last_update as mileage
<if test=" yearMonthAndParam != null "> <if test=" yearMonthAndParam != null ">
,vbi.booked_date ,vbi.booked_date
</if> </if>
...@@ -55,7 +56,8 @@ ...@@ -55,7 +56,8 @@
left join left join
vehicle_book_info vbi on v.`id` = vbi.vehicle vehicle_book_info vbi on v.`id` = vbi.vehicle
</if> </if>
left join branch_company bc on v.`subordinate_branch` = bc.id LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id 58 left join branch_company bc on v.`subordinate_branch` = bc.id
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
where where
1=1 1=1
<if test="mRangeDateEnd !=null"> <if test="mRangeDateEnd !=null">
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin}a and v.vin = #{vin}
</if> </if>
<if test="subordinateBranch !=null"> <if test="subordinateBranch !=null">
and v.subordinate_branch = #{subordinateBranch} and v.subordinate_branch = #{subordinateBranch}
...@@ -92,7 +94,7 @@ ...@@ -92,7 +94,7 @@
and v.status = #{status} and v.status = #{status}
</if> </if>
<if test="numberPlate !=null and numberPlate != ''"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate = #{numberPlate} and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
<if test="brand !=null"> <if test="brand !=null">
and v.brand = #{brand} and v.brand = #{brand}
...@@ -109,18 +111,36 @@ ...@@ -109,18 +111,36 @@
) )
</foreach> </foreach>
</if> </if>
<if test="subordinateBranch !=null or addrProvince !=null or addrCity !=null or zoneId !=null ">
and (
<trim suffixOverrides="OR">
<if test="subordinateBranch !=null ">
( v.park_branch_company_id = #{subordinateBranch} or v.expect_destination_branch_company_id=#{subordinateBranch} ) OR
</if>
<if test="addrProvince !=null">
(bc.addr_province=#{addrProvince} or bc1.addr_province=#{addrProvince}) OR
</if>
<if test="addrCity !=null">
(bc.addr_city=#{addrProvince} or bc1.addr_city=#{addrProvince}) OR
</if>
<if test="zoneId !=null">
(bc.zone_id=#{zoneId} or bc1.zone_id=#{zoneId}) OR
</if>
</trim>
)
</if>
order by v.code order by v.code
</select> </select>
<select id="getByPageNotAllData" parameterType="java.util.Map" <select id="getByPageNotAllData" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.pojo.QueryVehicleVo"> resultType="com.xxfc.platform.vehicle.pojo.QueryVehicleVo">
select v.`id`, select DISTINCT v.`id`,
v.`code`, v.`code`,
v.`status`, v.`status`,
v.number_plate, v.number_plate,
v.brand, v.brand,
v.subordinate_branch, IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch,
bc.name as subBranchName, IFNULL(bc.name,bc1.name) AS subBranchName,
v.use_type, v.use_type,
v.remark, v.remark,
v.create_time, v.create_time,
...@@ -138,7 +158,8 @@ ...@@ -138,7 +158,8 @@
v.engine_num, v.engine_num,
v.manufacturer, v.manufacturer,
v.receive_time, v.receive_time,
v.update_time v.update_time,
v.mileage_last_update as mileage
<if test=" yearMonthAndParam !=null "> <if test=" yearMonthAndParam !=null ">
,vbi.booked_date ,vbi.booked_date
</if> </if>
...@@ -147,23 +168,24 @@ ...@@ -147,23 +168,24 @@
left join left join
vehicle_book_info vbi on v.`id` = vbi.vehicle vehicle_book_info vbi on v.`id` = vbi.vehicle
</if> </if>
left join branch_company bc on v.`subordinate_branch` = bc.id LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
where where
1=1 1=1
<if test="companyList != null"> <if test="companyList != null">
and ( v.park_branch_company_id in ( and ( v.park_branch_company_id in (
<foreach collection="companyList" item="companyId">
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</trim>
</foreach> </foreach>
</trim>
) )
or v.expect_destination_branch_company_id in ( or v.expect_destination_branch_company_id in (
<foreach collection="companyList" item="companyId">
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</trim>
</foreach> </foreach>
</trim>
) )
) )
</if> </if>
...@@ -201,7 +223,7 @@ ...@@ -201,7 +223,7 @@
and v.status = #{status} and v.status = #{status}
</if> </if>
<if test="numberPlate !=null and numberPlate != ''"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate = #{numberPlate} and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
<if test="brand !=null"> <if test="brand !=null">
and v.brand = #{brand} and v.brand = #{brand}
...@@ -218,6 +240,24 @@ ...@@ -218,6 +240,24 @@
) )
</foreach> </foreach>
</if> </if>
<if test="subordinateBranch !=null or addrProvince !=null or addrCity !=null or zoneId !=null ">
and (
<trim suffixOverrides="OR">
<if test="subordinateBranch !=null ">
( v.park_branch_company_id = #{subordinateBranch} or v.expect_destination_branch_company_id=#{subordinateBranch} ) OR
</if>
<if test="addrProvince !=null">
(bc.addr_province=#{addrProvince} or bc1.addr_province=#{addrProvince}) OR
</if>
<if test="addrCity !=null">
(bc.addr_city=#{addrProvince} or bc1.addr_city=#{addrProvince}) OR
</if>
<if test="zoneId !=null">
(bc.zone_id=#{zoneId} or bc1.zone_id=#{zoneId}) OR
</if>
</trim>
)
</if>
order by v.code order by v.code
</select> </select>
...@@ -243,6 +283,17 @@ ...@@ -243,6 +283,17 @@
where id = #{vehicleId} and status = #{lastStatus} where id = #{vehicleId} and status = #{lastStatus}
</update> </update>
<update id="updateMileageStatusByIdAndStatus">
update vehicle
set status = #{status},maintenance_mileage=#{mileage}
where id = #{vehicleId} and status = #{lastStatus}
</update>
<update id="upMileageByIdAndStatus">
update vehicle
set status = #{status},mileage_last_update=#{mileage}
where id = #{vehicleId} and status = #{lastStatus}
</update>
<select id="searchUsableModel" parameterType="java.util.Map" <select id="searchUsableModel" parameterType="java.util.Map"
resultMap="searchUsableModelMap"> resultMap="searchUsableModelMap">
select distinct vm.id as model_id, bc.id as company_id select distinct vm.id as model_id, bc.id as company_id
......
...@@ -34,8 +34,19 @@ ...@@ -34,8 +34,19 @@
left join vehicle b on a.vehicle_id = b.id left join vehicle b on a.vehicle_id = b.id
left join branch_company c on a.branch_company_id = c.id left join branch_company c on a.branch_company_id = c.id
<trim prefix="where"> <trim prefix="where">
1=1
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
b.number_plate = #{numberPlate} and b.number_plate = #{numberPlate}
</if>
<if test="companyList != null and companyList.size() > 0">
and ( a.branch_company_id in (
<trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId},
</foreach>
</trim>
)
)
</if> </if>
</trim> </trim>
order by a.create_time desc order by a.create_time desc
......
...@@ -24,5 +24,20 @@ ...@@ -24,5 +24,20 @@
select id, type, status, msg, rule_id, msg_key, vehicle_id, create_time, update_time, remark from vehicle_warning_msg where vehicle_id = #{_parameter} select id, type, status, msg, rule_id, msg_key, vehicle_id, create_time, update_time, remark from vehicle_warning_msg where vehicle_id = #{_parameter}
</select> </select>
<select id="getByPages" resultType="com.xxfc.platform.vehicle.pojo.VehicleWarningMsgQueryVo"
parameterType="com.xxfc.platform.vehicle.pojo.QueryVehicleWarningMsgVo">
SELECT id as vehicleId,code as vehicleCode,number_plate as numberPlate,mileage_last_update as mileageLastUpdate,status,
IFNULL(park_branch_company_id,expect_destination_branch_company_id) AS subordinateBranch,
CONCAT('当前公里数为:',mileage_last_update,' 保养公里数:',maintenance_mileage,' 请尽快保养!') as msg
,1 as type,update_time as createTime FROM vehicle
WHERE mileage_last_update>=maintenance_mileage
<if test="vehicleCode != null">
and vcode = #{vehicleCode}
</if>
<if test="numberPlate != null and numberPlate != '' ">
and number_plate = #{numberPlate}
</if>
</select>
</mapper> </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