123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?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.yh.saas.plugin.yiliangyiyun.mapper.FuelFillingInfoMapper">
- <!-- 获得长途记录总数 -->
- <select id="getCountByCondition" parameterType="Map" resultType="java.lang.Integer">
- select
- count(1)
- from(
- SELECT
- COUNT(ff.id)
- FROM fuel_filling_info ff
- left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
- WHERE
- ff.comp_id = #{compId}
- and ff.delete_flag = '0'
- <if test="searchType != null and searchType != ''">
- <!--未完成-->
- <if test="searchType == 1">
- AND ff.travel_status_flag = '1'
- </if>
- <!--已完成-->
- <if test="searchType == 3">
- AND (ff.travel_status_flag = '3' OR ff.travel_status_flag = '5')
- </if>
- </if>
- GROUP BY ff.id
- ) t
- </select>
- <!-- 长途加油记录查询 -->
- <select id="getListByCondition" parameterType="Map"
- resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
- SELECT
- ff.id,
- ff.comp_id as compId,
- ff.common_id as commonId,
- ff.driver_name as driverName,
- ff.car_no as carNo,
- ff.send_warehouse as sendWarehouse,
- ff.receive_warehouse as receiveWarehouse,
- ff.mileage,
- ff.total_mileage as totalMileage,
- ff.origin_province as originProvince,
- ff.origin_city as originCity,
- ff.approve_status as approveStatus,
- ff.create_date as createDate,
- ff.origin_area as originArea,
- ff.origin_longitude as originLongitude,
- ff.origin_latitude as originLatitude,
- ff.destination_province as destinationProvince,
- ff.destination_city as destinationCity,
- ff.destination_area as destinationArea,
- ff.destination_longitude as destinationLongitude,
- ff.destination_latitude as destinationLatitude,
- ff.total_cost as totalCost,
- ff.status_flag as statusFlag,
- ff.status as status,
- ff.workflow_id as workflowId,
- ff.tfc,
- ff.travel_status as travelStatus,
- ff.travel_status_flag as travelStatusFlag,
- fd.oil_consumption as oilConsumption,
- fd.current_oil_price as currentOilPrice,
- fd.current_consumption as currentConsumption,
- fd.address_url as addressUrl
- FROM fuel_filling_info ff
- left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
- WHERE
- ff.comp_id = #{compId}
- and ff.common_id = #{commonId}
- and ff.delete_flag = '0'
- <if test="searchType != null and searchType != ''">
- <!--未完成-->
- <if test="searchType == 1">
- AND ff.travel_status_flag = '1'
- </if>
- <!--已完成-->
- <if test="searchType == 3">
- AND (ff.travel_status_flag = '3' OR ff.travel_status_flag = '5')
- </if>
- </if>
- GROUP BY ff.id
- ORDER BY ff.update_date DESC
- <if test="currentPage != null and currentPage != ''">
- LIMIT ${startRecord}, ${pageSize}
- </if>
- </select>
- <!-- 获得加油管理列表总数 -->
- <select id="getCountByConditionPc" parameterType="Map" resultType="java.lang.Integer">
- select
- count(1)
- from(
- SELECT
- COUNT(ff.id)
- FROM fuel_filling_info ff
- left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
- left join track_detail_info td on ff.id = td.filling_id and td.delete_flag = '0'
- left join short_filling_info sf on ff.id = sf.filling_id and sf.delete_flag = '0'
- WHERE
- ff.comp_id = #{compId}
- and ff.delete_flag = '0'
- <if test="startDate != null">
- AND (DATE_FORMAT(ff.create_date,"%Y%m%d") >=
- DATE_FORMAT(#{startDate},"%Y%m%d"))
- </if>
- <if test="endDate != null">
- AND (DATE_FORMAT(ff.create_date,"%Y%m%d") <=
- DATE_FORMAT(#{endDate},"%Y%m%d"))
- </if>
- <if test="searchType != null and searchType != ''">
- <if test="searchType == 1">
- AND ff.approve_status is not null
- </if>
- <if test="searchType == 2">
- AND ff.status = '已通过'
- </if>
- <if test="searchType == 3">
- AND ff.status = '已驳回' and ff.approve_status is null
- </if>
- </if>
- <if test="searchKeyWord != null and searchKeyWord != ''">
- AND (lower(ff.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(ff.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(sf.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(ff.warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
- </if>
- <if test="strokeType != null and strokeType != ''">
- AND ff.stroke_type = #{strokeType}
- </if>
- GROUP BY ff.id
- ) t
- </select>
- <!-- 加油管理列表查询 -->
- <select id="getListByConditionPc" parameterType="Map"
- resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
- SELECT
- ff.id,
- ff.comp_id as compId,
- ff.common_id as commonId,
- ff.expense_id as expenseId,
- ff.driver_name as driverName,
- ff.workflow_id as workflowId,
- ff.car_no as carNo,
- ff.filling_no as fillingNo,
- ff.amount_requested as amountRequested,
- ff.warehouse_name as warehouseName,
- ff.total_mileage as totalMileage,
- ff.origin_province as originProvince,
- ff.origin_city as originCity,
- ff.approve_status as approveStatus,
- ff.create_date as createDate,
- ff.origin_area as originArea,
- ff.stroke_type as strokeType,
- ff.origin_longitude as originLongitude,
- ff.origin_latitude as originLatitude,
- ff.destination_province as destinationProvince,
- ff.destination_city as destinationCity,
- ff.destination_area as destinationArea,
- ff.destination_longitude as destinationLongitude,
- ff.destination_latitude as destinationLatitude,
- ff.total_cost as totalCost,
- ff.tfc,
- ff.remark,
- ff.status,
- ff.travel_status as travelStatus,
- ff.travel_status_flag as travelStatusFlag,
- fd.oil_consumption as oilConsumption,
- fd.current_oil_price as currentOilPrice,
- fd.current_consumption as currentConsumption,
- fd.address_url as addressUrl
- FROM fuel_filling_info ff
- left join filling_detail_info fd on ff.id = fd.filling_id and fd.delete_flag = '0'
- left join track_detail_info td on ff.id = td.filling_id and td.delete_flag = '0'
- left join short_filling_info sf on ff.id = sf.filling_id and sf.delete_flag = '0'
- WHERE
- ff.comp_id = #{compId}
- and ff.delete_flag = '0'
- <if test="startDate != null">
- AND (DATE_FORMAT(ff.create_date,"%Y%m%d") >=
- DATE_FORMAT(#{startDate},"%Y%m%d"))
- </if>
- <if test="endDate != null">
- AND (DATE_FORMAT(ff.create_date,"%Y%m%d") <=
- DATE_FORMAT(#{endDate},"%Y%m%d"))
- </if>
- <if test="searchType != null and searchType != ''">
- <if test="searchType == 1">
- AND ff.approve_status is not null
- </if>
- <if test="searchType == 2">
- AND ff.status = '已通过'
- </if>
- <if test="searchType == 3">
- AND ff.status = '已驳回' and ff.approve_status is null
- </if>
- </if>
- <if test="searchKeyWord != null and searchKeyWord != ''">
- AND (lower(ff.driver_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(ff.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(sf.car_no) like lower(CONCAT('%',#{searchKeyWord},'%'))
- OR lower(ff.warehouse_name) like lower(CONCAT('%',#{searchKeyWord},'%')))
- </if>
- <if test="strokeType != null and strokeType != ''">
- AND ff.stroke_type = #{strokeType}
- </if>
- GROUP BY ff.id
- ORDER BY ff.create_date DESC
- <if test="currentPage != null and currentPage != ''">
- LIMIT ${startRecord}, ${pageSize}
- </if>
- </select>
- <!-- 获得加油编号列表 -->
- <select id="getListByConditionFilling" parameterType="Map"
- resultType="com.yh.saas.plugin.yiliangyiyun.entity.FuelFillingInfo">
- SELECT filling_no from fuel_filling_info
- WHERE comp_id = #{compId}
- <if test="date != null and date != ''">
- AND (lower(filling_no) like lower(CONCAT('JY',#{date},'%')))
- </if>
- ORDER BY filling_no DESC
- </select>
- </mapper>
|