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

修改合并

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