Commit ae536326 authored by jiaorz's avatar jiaorz

Merge branch 'master-background-manager'

parents 007f5229 1ec59eec
...@@ -134,6 +134,7 @@ public class VehicleModel implements Serializable { ...@@ -134,6 +134,7 @@ public class VehicleModel implements Serializable {
private Integer hotSign; private Integer hotSign;
@ApiModelProperty(value = "是否删除") @ApiModelProperty(value = "是否删除")
@Column(name = "isdel")
private Integer isdel; private Integer isdel;
@Column(name = "rent_discount_status") @Column(name = "rent_discount_status")
@ApiModelProperty(value = "租车优惠状态 0--没有优惠;1--会员折扣;2--固定值") @ApiModelProperty(value = "租车优惠状态 0--没有优惠;1--会员折扣;2--固定值")
......
...@@ -49,6 +49,11 @@ public class VehiclePageQueryVo { ...@@ -49,6 +49,11 @@ public class VehiclePageQueryVo {
* 用途类型:租赁房车(1)、展车等,对应关系见车辆常量表 * 用途类型:租赁房车(1)、展车等,对应关系见车辆常量表
*/ */
private Integer useType; private Integer useType;
/**
* 托管人
*/
private String belongToName;
/** /**
* 预定目标日期(开始) * 预定目标日期(开始)
*/ */
......
...@@ -1491,6 +1491,29 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1491,6 +1491,29 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return count > 0; return count > 0;
} }
public Boolean checkVinExist(String vin, String id) {
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("vin", vin);
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotEmpty(id)) {
criteria.andNotEqualTo("id", id);
}
int count = mapper.selectCountByExample(example);
return count > 0;
}
public Boolean checkEngineNumExist(String engineNum, String id) {
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("engineNum", engineNum);
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotEmpty(id)) {
criteria.andNotEqualTo("id", id);
}
int count = mapper.selectCountByExample(example);
return count > 0;
}
public List<String> findbyPlateNumberAndVehicleCod(String plateNumber,String vehicleCode) { public List<String> findbyPlateNumberAndVehicleCod(String plateNumber,String vehicleCode) {
List<String> vehicleIds = Lists.newArrayList(); List<String> vehicleIds = Lists.newArrayList();
......
...@@ -29,7 +29,6 @@ import org.apache.commons.beanutils.BeanUtils; ...@@ -29,7 +29,6 @@ import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
...@@ -195,51 +194,6 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -195,51 +194,6 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
} }
vehicleBookRecordQueryVo.setCompanyIds(companyList); vehicleBookRecordQueryVo.setCompanyIds(companyList);
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 3) { //待出行
vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus3(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
vehicleBookRecordVoPageDataVO.setPageNum(pageNo);
vehicleBookRecordVoPageDataVO.setPageSize(pageSize);
vehicleBookRecordVoPageDataVO.setTotalCount((long) vehicleBookRecordVoPageInfo.getList().size());
vehicleBookRecordVoPageDataVO.setTotalPage((vehicleBookRecordVoPageInfo.getList().size() + pageSize - 1) / pageSize);
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO);
}
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 5) { //出行中
vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus5(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
vehicleBookRecordVoPageDataVO.setPageNum(pageNo);
vehicleBookRecordVoPageDataVO.setPageSize(pageSize);
vehicleBookRecordVoPageDataVO.setTotalCount((long) vehicleBookRecordVoPageInfo.getList().size());
vehicleBookRecordVoPageDataVO.setTotalPage((vehicleBookRecordVoPageInfo.getList().size() + pageSize - 1) / pageSize);
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO);
}
if (vehicleBookRecordQueryVo.getStatus() != null && vehicleBookRecordQueryVo.getStatus() == 7) { //已完成
vehicleBookRecordQueryVo.setStatus(2);
Query query = new Query(vehicleBookRecordQueryVo);
List<VehicleBookRecordVo> list = mapper.getBookRecordInfo(query.getSuper());
removeStatus7(list);
PageInfo<VehicleBookRecordVo> vehicleBookRecordVoPageInfo = new PageInfo<>(list);
getupKeeps(vehicleBookRecordVoPageInfo.getList());
PageDataVO<VehicleBookRecordVo> vehicleBookRecordVoPageDataVO = PageDataVO.pageInfo(vehicleBookRecordVoPageInfo);
vehicleBookRecordVoPageDataVO.setPageNum(pageNo);
vehicleBookRecordVoPageDataVO.setPageSize(pageSize);
vehicleBookRecordVoPageDataVO.setTotalCount((long) vehicleBookRecordVoPageInfo.getList().size());
vehicleBookRecordVoPageDataVO.setTotalPage((vehicleBookRecordVoPageInfo.getList().size() + pageSize - 1) / pageSize);
vehicleBookRecordVoPageDataVO.setData(getData(vehicleBookRecordVoPageInfo.getList(), pageNo, pageSize));
return RestResponse.suc(vehicleBookRecordVoPageDataVO);
}
Query query = new Query(vehicleBookRecordQueryVo); Query query = new Query(vehicleBookRecordQueryVo);
PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper())); PageDataVO<VehicleBookRecordVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getBookRecordInfo(query.getSuper()));
getupKeeps(pageDataVO.getData()); getupKeeps(pageDataVO.getData());
...@@ -259,47 +213,6 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -259,47 +213,6 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
} }
} }
//筛选未出车的记录
public void removeStatus3(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() != null) {
iterator.remove();
}
vehicleBookRecordVo.setState(3);
}
}
}
//筛选已出车未还车记录
public void removeStatus5(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() == null || (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() ==1)) {
iterator.remove();
}
vehicleBookRecordVo.setState(5);
}
}
}
//筛选已完成记录
public void removeStatus7(List<VehicleBookRecordVo> list) {
if (list != null && list.size() > 0) {
Iterator<VehicleBookRecordVo> iterator = list.iterator();
while (iterator.hasNext()) {
VehicleBookRecordVo vehicleBookRecordVo = iterator.next();
if (vehicleBookRecordVo.getVehicleDepartureLogVo() == null || (vehicleBookRecordVo.getVehicleDepartureLogVo() != null && vehicleBookRecordVo.getVehicleDepartureLogVo().getState() !=1)) {
iterator.remove();
}
vehicleBookRecordVo.setState(5);
}
}
}
/** /**
* 获取随身物品 * 获取随身物品
*/ */
......
...@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper, ...@@ -34,17 +34,17 @@ public class VehicleDepartureService extends BaseBiz<VehicleDepartureLogMapper,
@Autowired @Autowired
VehicleMapper vehicleMapper; VehicleMapper vehicleMapper;
public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId, String time, Integer page, Integer limit) { public PageInfo<VehicleDepartureLogVo> page(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,time)); return new PageInfo<>(mapper.selectVoAll(numberPlate,code,zoneId,departureId,startTime, endTime));
} }
public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId, String time, Integer page, Integer limit, List<Integer> companyList) { public PageInfo<VehicleDepartureLogVo> pageNotAllData(String numberPlate,Integer code,Integer zoneId,Integer departureId, String startTime,String endTime, Integer page, Integer limit, List<Integer> companyList) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
if (companyList == null || companyList.size() == 0) { if (companyList == null || companyList.size() == 0) {
companyList = Arrays.asList(-1); companyList = Arrays.asList(-1);
} }
return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,time, companyList)); return new PageInfo<>(mapper.selectVoAllNotAllData(numberPlate,code,zoneId,departureId,startTime, endTime, companyList));
} }
public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) { public PageInfo<VehicleDepartureLogVo> findByVehicle(String vehicleId, Integer page, Integer limit) {
......
...@@ -20,13 +20,16 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -20,13 +20,16 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("code") Integer code, @Param("code") Integer code,
@Param("zoneId") Integer zoneId, @Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId, @Param("departureId") Integer departureId,
@Param("time") String time); @Param("startTime") String startTime,
@Param("endTime") String endTime
);
List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate, List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate,
@Param("code") Integer code, @Param("code") Integer code,
@Param("zoneId") Integer zoneId, @Param("zoneId") Integer zoneId,
@Param("departureId") Integer departureId, @Param("departureId") Integer departureId,
@Param("time") String time, @Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("companyList") List<Integer> companyList); @Param("companyList") List<Integer> companyList);
Integer selectMileageByVehicleId(String vehicleId); Integer selectMileageByVehicleId(String vehicleId);
......
...@@ -412,7 +412,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -412,7 +412,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
companyList.clear(); companyList.clear();
companyList.add(vehiclePlanDto.getParkBranchCompanyId()); companyList.add(vehiclePlanDto.getParkBranchCompanyId());
} else { } else {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ(Maps.newHashMap());
} }
} }
} }
...@@ -422,7 +422,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -422,7 +422,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
companyList.clear(); companyList.clear();
companyList.add(vehiclePlanDto.getSubordinateBranch()); companyList.add(vehiclePlanDto.getSubordinateBranch());
} else { } else {
return ObjectRestResponse.succ(); return ObjectRestResponse.succ(Maps.newHashMap());
} }
} }
} }
...@@ -437,7 +437,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -437,7 +437,7 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
map.put("vehicleWarningMsgs",vehicleWarningMsgs); map.put("vehicleWarningMsgs",vehicleWarningMsgs);
map.put("vehicleAndModelInfoVo",pageDataVO); map.put("vehicleAndModelInfoVo",pageDataVO);
map.put("vehicleCountVos",vehicleCountVos); map.put("vehicleCountVos",vehicleCountVos);
return ObjectRestResponse.succ(map); return ObjectRestResponse.succ(map);
} }
...@@ -561,6 +561,17 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use ...@@ -561,6 +561,17 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
return ObjectRestResponse.succ(exist); return ObjectRestResponse.succ(exist);
} }
@GetMapping("/exist_vin/{vin}")
public ObjectRestResponse<Boolean> checkVinExist(@PathVariable(value = "vin") String vin,@RequestParam(value = "id") String id){
Boolean exist = vehicleBiz.checkVinExist(vin,id);
return ObjectRestResponse.succ(exist);
}
@GetMapping("/exist_engineNum/{engineNum}")
public ObjectRestResponse<Boolean> checkEngineNumExist(@PathVariable(value = "engineNum") String engineNum,@RequestParam(value = "id") String id){
Boolean exist = vehicleBiz.checkEngineNumExist(engineNum,id);
return ObjectRestResponse.succ(exist);
}
@GetMapping("/findVehicleIds") @GetMapping("/findVehicleIds")
public List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber",required = false) String plateNumber,@RequestParam(value = "vehicleCode",required = false) String vehicleCode){ public List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber",required = false) String plateNumber,@RequestParam(value = "vehicleCode",required = false) String vehicleCode){
......
...@@ -36,7 +36,7 @@ public class VehicleDepartureController { ...@@ -36,7 +36,7 @@ public class VehicleDepartureController {
/** /**
* @param numberPlate 车牌 * @param numberPlate 车牌
* @param code 车辆编码 * @param code 车辆编码
* @param time * @param
* @param departureId 出发分公司id * @param departureId 出发分公司id
* @param page * @param page
* @param limit * @param limit
...@@ -45,7 +45,7 @@ public class VehicleDepartureController { ...@@ -45,7 +45,7 @@ public class VehicleDepartureController {
*/ */
@GetMapping("page") @GetMapping("page")
public RestResponse page(String numberPlate, public RestResponse page(String numberPlate,
@RequestParam(value = "code", required = false) Integer code, String time, @RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,
@RequestParam(value = "zoneId",required = false) Integer zoneId, @RequestParam(value = "zoneId",required = false) Integer zoneId,
@RequestParam(value = "departureId", required = false) Integer departureId, @RequestParam(value = "departureId", required = false) Integer departureId,
Integer page, Integer limit, HttpServletRequest request) { Integer page, Integer limit, HttpServletRequest request) {
...@@ -57,15 +57,15 @@ public class VehicleDepartureController { ...@@ -57,15 +57,15 @@ public class VehicleDepartureController {
if (userDTO != null) { if (userDTO != null) {
if (userDTO.getDataAll() == 2) { if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany()); List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId,departureId, time, page, limit, companyList)); return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit, companyList));
} }
} }
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId,departureId, time, page, limit)); return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, zoneId,departureId, startTime, endTime, page, limit));
} }
@GetMapping("small/page") @GetMapping("small/page")
@IgnoreUserToken @IgnoreUserToken
public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String time, Integer page, Integer limit, Integer uid, HttpServletRequest request) { public RestResponse pageBySmall(String numberPlate, @RequestParam(value = "code", required = false) Integer code, String startTime, String endTime,Integer page, Integer limit, Integer uid, HttpServletRequest request) {
if (page == null || limit == null) { if (page == null || limit == null) {
page = 1; page = 1;
limit = 10; limit = 10;
...@@ -74,10 +74,10 @@ public class VehicleDepartureController { ...@@ -74,10 +74,10 @@ public class VehicleDepartureController {
if (userDTO != null) { if (userDTO != null) {
if (userDTO.getDataAll() == 2) { if (userDTO.getDataAll() == 2) {
List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany()); List<Integer> companyList = vehicleBiz.dataCompany(userDTO.getDataZone(), userDTO.getDataCompany());
return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null,null, time, page, limit, companyList)); return RestResponse.data(vehicleDepartureService.pageNotAllData(numberPlate, code, null,null, startTime,endTime, page, limit, companyList));
} }
} }
return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null,null, time, page, limit)); return RestResponse.suc(vehicleDepartureService.page(numberPlate, code, null,null, startTime,endTime, page, limit));
} }
/** /**
......
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
CONCAT(#{selectedMonth}, "%")) CONCAT(#{selectedMonth}, "%"))
</if> </if>
<if test="numberPlate != null"> <if test="numberPlate != null">
and v3.number_plate = #{numberPlate} and v3.number_plate like concat('%', #{numberPlate}, '%')
</if> </if>
<if test="bookType != null"> <if test="bookType != null">
and v1.book_type = #{bookType} and v1.book_type = #{bookType}
...@@ -490,9 +490,18 @@ ...@@ -490,9 +490,18 @@
#{id} #{id}
</foreach>) </foreach>)
</if> </if>
<if test="status != null and status != 0 and status != -1 and status != -2"> <if test="status != null and status != 0 and status != -1 and status != -2 and status != 3 and status != 5 and status != 7">
and v1.status = #{status} and v1.status = #{status}
</if> </if>
<if test="status != null and status == 3 ">
and v4.id is null and v1.status = 2
</if>
<if test="status != null and status == 5 ">
and v4.id is not null and v1.status = 2 and v4.state = 0
</if>
<if test="status != null and status == 7 ">
and v4.id is not null and v1.status = 2 and v4.state = 1
</if>
<if test="status != null and status == 0 "> <if test="status != null and status == 0 ">
and v4.state = 0 and v4.state = 0
</if> </if>
......
...@@ -100,18 +100,12 @@ ...@@ -100,18 +100,12 @@
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
and vehicle.number_plate = #{numberPlate} and vehicle.number_plate = #{numberPlate}
</if> </if>
<if test="time != null and time != ''"> <if test="startTime != null and startTime != ''">
and (vehicle_departure_log.arrival_time >= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
)
and and
( vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
vehicle_departure_log.departure_time &lt;= str_to_date(#{time}, '%Y-%m-%d %H') </if>
or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H')) <if test="endTime != null and endTime != ''">
or vehicle_departure_log.departure_time is null and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
)
</if> </if>
<if test="code!=null"> <if test="code!=null">
and vehicle.code=#{code} and vehicle.code=#{code}
...@@ -158,17 +152,17 @@ ...@@ -158,17 +152,17 @@
) )
) )
</if> </if>
<if test="time != null and time != ''"> <if test="startTime != null and startTime != ''">
and (vehicle_departure_log.arrival_time >= str_to_date(#{time}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
)
and and
( vehicle_departure_log.departure_time &lt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
vehicle_departure_log.departure_time &lt;= str_to_date(#{time}, '%Y-%m-%d %H') or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{startTime}, '%Y-%m-%d %H'))
or TO_DAYS(vehicle_departure_log.departure_time)=TO_DAYS(str_to_date(#{time}, '%Y-%m-%d %H'))
or vehicle_departure_log.departure_time is null or vehicle_departure_log.departure_time is null
)
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
</if> </if>
<if test="code!=null"> <if test="code!=null">
and vehicle.code=#{code} and vehicle.code=#{code}
......
...@@ -41,11 +41,10 @@ ...@@ -41,11 +41,10 @@
SELECT r.* FROM ( SELECT r.* FROM (
select DISTINCT v.`id`, select DISTINCT v.`id`,
v.`code`, v.`code`,
v.`status`, (CASE WHEN #{status} != null THEN #{status}
ELSE v.status END) status ,
v.number_plate, v.number_plate,
v.brand, v.brand,
-- IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch,
-- IFNULL(bc.name,bc1.name) AS subBranchName,
v.park_branch_company_id, v.park_branch_company_id,
bc.name as parkBranchCompanyName, bc.name as parkBranchCompanyName,
v.expect_destination_branch_company_id, v.expect_destination_branch_company_id,
...@@ -80,14 +79,14 @@ ...@@ -80,14 +79,14 @@
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.park_branch_company_id = bc.id
-- LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 停车分公司 -- 停车分公司
LEFT JOIN branch_company bc ON v.park_branch_company_id = 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 LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司 -- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
where where
v.is_del=0 v.is_del=0
<if test="mRangeDateEnd !=null"> <if test="mRangeDateEnd !=null">
...@@ -114,18 +113,27 @@ ...@@ -114,18 +113,27 @@
<if test="insuranceCompany !=null"> <if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="belongToName !=null and belongToName != ''">
and v.belong_to_name like concat('%',#{belongToName},'%')
</if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin} and v.vin = #{vin}
</if> </if>
<!-- <if test="subordinateBranch !=null">--> <!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}--> <!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>--> <!-- </if>-->
<if test="code !=null"> <if test="code !=null">
and v.code = #{code} and v.code = #{code}
</if> </if>
<if test="status !=null"> <if test="status !=null and status != 6 and status != 7">
and v.status = #{status} and v.status = #{status}
</if> </if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%') and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
...@@ -153,17 +161,16 @@ ...@@ -153,17 +161,16 @@
and ( v.park_branch_company_id = #{subordinateBranch}) and ( v.park_branch_company_id = #{subordinateBranch})
</if> </if>
<if test=" addrProvince !=null or addrCity !=null or zoneId !=null "> <if test=" addrProvince !=null or addrCity !=null or zoneId !=null ">
<if test="addrProvince !=null"> <if test="addrProvince !=null">
and bc.addr_province=#{addrProvince} and bc.addr_province=#{addrProvince}
</if> </if>
<if test="addrCity !=null"> <if test="addrCity !=null">
and bc.addr_city=#{addrCity} and bc.addr_city=#{addrCity}
</if> </if>
<if test="zoneId !=null"> <if test="zoneId !=null">
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
</if> </if>
order by v.code
) r ORDER BY r.parkBranchCompanyName ) r ORDER BY r.parkBranchCompanyName
</select> </select>
...@@ -172,7 +179,8 @@ ...@@ -172,7 +179,8 @@
SELECT r.* FROM ( SELECT r.* FROM (
select DISTINCT v.`id`, select DISTINCT v.`id`,
v.`code`, v.`code`,
v.`status`, (CASE WHEN #{status} != null THEN #{status}
ELSE v.status END) status ,
v.number_plate, v.number_plate,
v.brand, v.brand,
-- IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch, -- IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch,
...@@ -217,29 +225,31 @@ ...@@ -217,29 +225,31 @@
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司 -- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
where where
v.is_del=0 v.is_del=0
<if test="companyList != null"> <if test="companyList != null">
and ( v.park_branch_company_id in ( and ( v.park_branch_company_id in (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId"> <foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</foreach> </foreach>
</trim> </trim>
) )
<!--or v.expect_destination_branch_company_id in ( <!--or v.expect_destination_branch_company_id in (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId"> <foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</foreach> </foreach>
</trim> </trim>
)--> )-->
<!-- or v.subordinate_branch in (--> <!-- or v.subordinate_branch in (-->
<!-- <trim suffixOverrides=",">--> <!-- <trim suffixOverrides=",">-->
<!-- <foreach collection="companyList" item="companyId">--> <!-- <foreach collection="companyList" item="companyId">-->
<!-- #{companyId},--> <!-- #{companyId},-->
<!-- </foreach>--> <!-- </foreach>-->
<!-- </trim>--> <!-- </trim>-->
) )
</if> </if>
<if test="mRangeDateEnd !=null"> <if test="mRangeDateEnd !=null">
...@@ -266,18 +276,27 @@ ...@@ -266,18 +276,27 @@
<if test="insuranceCompany !=null"> <if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="belongToName !=null and belongToName != ''">
and v.belong_to_name like concat('%',#{belongToName},'%')
</if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin} and v.vin = #{vin}
</if> </if>
<!-- <if test="subordinateBranch !=null">--> <!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}--> <!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>--> <!-- </if>-->
<if test="code !=null"> <if test="code !=null">
and v.code = #{code} and v.code = #{code}
</if> </if>
<if test="status !=null"> <if test="status !=null and status != 6 and status != 7">
and v.status = #{status} and v.status = #{status}
</if> </if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%') and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
...@@ -315,7 +334,6 @@ ...@@ -315,7 +334,6 @@
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
</if> </if>
order by v.code
) r ORDER BY r.parkBranchCompanyName ) r ORDER BY r.parkBranchCompanyName
</select> </select>
......
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