Commit 9a44ae1a authored by jiaorz's avatar jiaorz

车辆安排接口

parent 99a76563
......@@ -18,7 +18,7 @@ public class VehicleBookRecord {
/**
* 车辆id
*/
private String vehicle;
private String vehicleId;
/**
* 申请状态:1-申请中 2-已通过 3-已归还 4-拒绝 5-逾期归还
......
package com.xxfc.platform.vehicle.pojo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class VehicleCountVo {
@ApiModelProperty(value = "总数")
private Integer total;
@ApiModelProperty(value = "车辆状态")
private Integer travelStatus;
@ApiModelProperty(value = "状态描述")
private String detail;
}
package com.xxfc.platform.vehicle.pojo;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import lombok.Data;
@Data
public class VehicleRecordInfoVo extends VehicleBookRecord {
Vehicle vehicle;
}
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class VehiclePlanDto extends PageParam {
@ApiModelProperty(value = "车辆Id")
private String vehicleId;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "车辆状态")
private Integer status;
@ApiModelProperty(value = "车牌")
private String numberPlate;
@ApiModelProperty(value = "所属分公司Id")
private Integer subordinateBranch;
@ApiModelProperty(value = "停车分公司Id")
private Integer parkBranchCompanyId;
}
......@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleBookInfoMapper;
import com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper;
import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils;
......@@ -295,7 +296,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
//加入预定申请记录
VehicleBookRecord vehicleBookRecord = new VehicleBookRecord();
vehicleBookRecord.setVehicle(bookVehicleVo.getVehicle());
vehicleBookRecord.setVehicleId(bookVehicleVo.getVehicle());
vehicleBookRecord.setBookType(BookType.EMPLOYEE_APPLY.getCode());
vehicleBookRecord.setStatus(VehicleBookRecordStatus.APPLY.getCode());
vehicleBookRecord.setBookUser(userId);
......@@ -912,4 +913,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
PageInfo<Vehicle> usableVehicleInfo = new PageInfo<>(lists);
return PageDataVO.pageInfo(usableVehicleInfo);
}
public List<VehicleCountVo> countVehicleByParam(VehiclePlanDto vehiclePlanDto) {
return mapper.countVehicleByParam(vehiclePlanDto);
}
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
......@@ -17,6 +18,7 @@ import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.mapper.BookRecordAccItemMapper;
import com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils;
......@@ -313,6 +315,12 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
public PageDataVO<VehicleRecordInfoVo> getListByParam(VehiclePlanDto vehiclePlanDto) {
Query query = new Query(vehiclePlanDto);
PageDataVO<VehicleRecordInfoVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getByParam(query.getSuper()));
return pageDataVO;
}
private String getTbNameNow(){
return TB_NAME_PREFIX+ DateTime.now().toString(YEAR_DATE_TIME_FORMATTER);
}
......
......@@ -14,6 +14,7 @@ import com.xxfc.platform.vehicle.entity.VehicleWarningRule;
import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.mapper.VehicleWarningMsgMapper;
import com.xxfc.platform.vehicle.mapper.VehicleWarningRuleMapper;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import com.xxfc.platform.vehicle.util.JSUtil;
import com.xxfc.platform.vehicle.pojo.AddVehicleWarningMsgVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
......@@ -212,5 +213,8 @@ public class VehicleWarningMsgBiz extends BaseBiz<VehicleWarningMsgMapper, Vehic
}
}
public List<VehicleWarningMsg> getAllByParam(VehiclePlanDto vehiclePlanDto) {
return mapper.getAllByparam(vehiclePlanDto);
}
}
......@@ -3,6 +3,8 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleBookRecord;
import com.xxfc.platform.vehicle.pojo.QueryVehicleBookRecordVo;
import com.xxfc.platform.vehicle.pojo.VehicleBookRecordAndTbNameVo;
import com.xxfc.platform.vehicle.pojo.VehicleRecordInfoVo;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -28,4 +30,6 @@ public interface VehicleBookRecordMapper extends Mapper<VehicleBookRecord> {
public VehicleBookRecord getById(Map<String, Object> params);
public List<VehicleRecordInfoVo> getByParam(Map<String, Object> params);
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo;
import com.xxfc.platform.vehicle.pojo.QueryVehicleVo;
import com.xxfc.platform.vehicle.pojo.UsableVehicleModelVO;
import com.xxfc.platform.vehicle.pojo.VehicleCountVo;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import org.springframework.data.repository.query.Param;
import tk.mybatis.mapper.common.Mapper;
......@@ -13,12 +15,14 @@ import java.util.Map;
public interface VehicleMapper extends Mapper<Vehicle> {
public List<QueryVehicleVo> getByPage(Map<String, Object> params);
public List<QueryVehicleVo> getByPageNotAllData(Map<String, Object> params);
public int updateStatusById(Map<String, Object> params);
/**
* 锁定相关编码 或 车牌 的行
*
* @param addOrUpdateVehicleVo
* @return
*/
......@@ -32,4 +36,6 @@ public interface VehicleMapper extends Mapper<Vehicle> {
List<UsableVehicleModelVO> searchUsableModel(Map<String, Object> params);
List<Vehicle> searchUsableVehicle(Map<String, Object> params);
List<VehicleCountVo> countVehicleByParam(VehiclePlanDto vehiclePlanDto);
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleWarningMsg;
import com.xxfc.platform.vehicle.pojo.QueryVehicleWarningMsgVo;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -13,4 +14,6 @@ public interface VehicleWarningMsgMapper extends Mapper<VehicleWarningMsg> {
public List<VehicleWarningMsg> getMsgByVehicle(String vehicleId);
public List<VehicleWarningMsg> getAllByparam(VehiclePlanDto vehiclePlanDto);
}
......@@ -14,9 +14,11 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleBookRecordBiz;
import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import com.xxfc.platform.vehicle.biz.VehicleWarningMsgBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse;
......@@ -25,8 +27,11 @@ import com.xxfc.platform.vehicle.constant.VehicleBookRecordStatus;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleBookInfo;
import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import com.xxfc.platform.vehicle.entity.VehicleWarningMsg;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -71,6 +76,9 @@ public class VehicleController extends BaseController<VehicleBiz> {
@Autowired
private VehiclePlatCataBiz vehiclePlatCataBiz;
@Autowired
private VehicleWarningMsgBiz vehicleWarningMsgBiz;
private static Integer MAX_DRIVING_LICENSE_SIZE = 10 * 1024 * 1024;//10M
public static final DateTimeFormatter DEFAULT_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
......@@ -138,6 +146,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
}
@RequestMapping(value = "/upload/drivingLicense", method = RequestMethod.POST)
@ApiOperation(value = "上传驾驶员驾驶证")
public RestResponse uploadDrivingLicense(@RequestParam("file") MultipartFile file)
throws Exception {
String contentType = file.getContentType(); //图片文件类型
......@@ -154,16 +163,19 @@ public class VehicleController extends BaseController<VehicleBiz> {
@IgnoreUserToken
@RequestMapping(value = "/download/drivingLicense", method = RequestMethod.GET) //匹配的是href中的download请求
@ApiOperation(value = "下载驾驶证")
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return baseBiz.downloadDrivingLicense(realFileRelPath);
}
@RequestMapping(value = "/bookedInfo/{vehicleId}/{yearMonth}", method = RequestMethod.GET)
@ApiOperation(value = "获取车辆预定信息")
public RestResponse<VehicleBookInfo> getBookedInfo(@PathVariable String vehicleId, @PathVariable String yearMonth) {
return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId, yearMonth));
}
@RequestMapping(value = "/bookedInfo/{vehicleId}", method = RequestMethod.GET)
@ApiOperation(value = "根据车辆Id获取所有的预定信息")
public RestResponse<List<VehicleBookInfo>> getBookedInfo(@PathVariable String vehicleId) {
return RestResponse.data(baseBiz.getByVehicleIdAndYearMonth(vehicleId));
}
......@@ -175,6 +187,7 @@ public class VehicleController extends BaseController<VehicleBiz> {
* @return
*/
@RequestMapping(value = "/book/4employee", method = RequestMethod.POST)
@ApiOperation(value = "申请预定车辆信息")
public RestResponse<Integer> applyVehicle(@RequestBody BookVehicleVO bookVehicleVo) throws Exception {
Integer operatorId = Integer.parseInt(BaseContextHandler.getUserID());
String userName = BaseContextHandler.getName();
......@@ -364,4 +377,23 @@ public class VehicleController extends BaseController<VehicleBiz> {
return ObjectRestResponse.succ(bookVehicleVo.getVehicle());
}
@RequestMapping(value = "/getVehiclePlanList", method = RequestMethod.GET)
@ApiOperation(value = "获取排车信息")
@IgnoreClientToken
public ObjectRestResponse<Map<String, Object>> getVehiclePlanList(VehiclePlanDto vehiclePlanDto) {
//获取统计信息
List<VehicleCountVo> vehicleCountVos = baseBiz.countVehicleByParam(vehiclePlanDto);
//获取警告信息
List<VehicleWarningMsg> vehicleWarningMsgs = vehicleWarningMsgBiz.getAllByParam(vehiclePlanDto);
//获取列表
PageDataVO<VehicleRecordInfoVo> pageDataVO = vehicleBookRecordBiz.getListByParam(vehiclePlanDto);
Map<String, Object> map = Maps.newHashMap();
map.put("vehicleCountVos",vehicleCountVos);
map.put("vehicleWarningMsgs",vehicleWarningMsgs);
map.put("vehicleRecordInfoVo",pageDataVO);
return ObjectRestResponse.succ(map);
}
}
......@@ -2,6 +2,10 @@
<!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.VehicleBookRecordMapper" >
<resultMap id="getVehicleMap" type="com.xxfc.platform.vehicle.pojo.VehicleRecordInfoVo">
<association property="vehicleId" column="vehicle" select="com.xxfc.platform.vehicle.mapper.VehicleMapper.selectByPrimaryKey" />
</resultMap>
<update id="changeRecordStatus" parameterType="java.util.Map">
update vehicle_book_record set
<if test="reviewerApply != null ">
......@@ -87,7 +91,7 @@
<insert id="insertHis" parameterType="java.util.Map">
insert into ${tbName} (
`id`,
`vehicle`,
`vehicle_id`,
`status`,
`book_type`,
`book_user`,
......@@ -119,7 +123,7 @@
)
values(
#{id},
#{vehicle},
#{vehicleId},
#{status},
#{bookType},
#{bookUser},
......@@ -154,7 +158,7 @@
<select id="getByPage4Month" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord">
select
`id`,
`vehicle`,
`vehicle_id`,
`status`,
`book_type`,
`book_user`,
......@@ -196,7 +200,7 @@
<select id="getByPage" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.pojo.QueryVehicleBookRecordVo">
select
vbr.`id`,
vbr.`vehicle`,
vbr.`vehicle_id`,
vbr.`status`,
vbr.`book_type`,
vbr.`book_user`,
......@@ -236,11 +240,11 @@
vbf.booked_date as bookedDate
from
${tbName} vbr left join
vehicle v on vbr.vehicle = v.id left join
vehicle v on vbr.vehicle_id = v.id left join
branch_company bc on bc.id = v.subordinate_branch left join
branch_company bcl on bcl.id = vbr.lift_company left join
branch_company bcr on bcr.id = vbr.ret_company left join
vehicle_book_info vbf on vbf.vehicle = vbr.vehicle and vbf.year_month = #{selectedMonth}
vehicle_book_info vbf on vbf.vehicle = vbr.vehicle_id and vbf.year_month = #{selectedMonth}
where
1=1
<if test="liftCompany !=null">
......@@ -273,7 +277,7 @@
<select id="getById" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleBookRecord" >
select
vbr.`id`,
vbr.`vehicle`,
vbr.`vehicle_id`,
vbr.`status`,
vbr.`book_type`,
vbr.`book_user`,
......@@ -309,12 +313,32 @@
</select>
<select id="getByParam" parameterType="java.util.Map" resultMap="getVehicleMap">
select v1.* from vehicle_book_record v1
left join vehicle v2 on v2.id = v1.vehicle
<where>
<if test="startTime != null">
and v1.create_time between startTime and endTime
</if>
<if test="numberPlate != null">
and v2.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v2.status = #{status}
</if>
<if test="subordinateBranch != null">
and v2.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v2.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
</select>
<insert id="createTbIfNotExists" parameterType="java.lang.String">
CREATE TABLE IF NOT EXISTS ${_parameter} (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`vehicle` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '车辆id',
`vehicle_id` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '车辆id',
`status` int(255) NULL DEFAULT NULL COMMENT '申请状态:1-申请中 2-已通过 3-已归还 4-拒绝 5-逾期归还 6-已取消',
`book_type` int(11) NOT NULL COMMENT '预定类型,1-用户租赁、2-内部员工申请 3-维修',
`book_user` int(11) NOT NULL COMMENT '预定用户id',
......@@ -346,7 +370,7 @@
`mileage_ret` int(10) NULL DEFAULT NULL COMMENT '还车里程数',
`have_violation` tinyint(4) NULL DEFAULT NULL COMMENT '是否违章',
PRIMARY KEY (`id`) USING BTREE,
INDEX `i_vehicle`(`vehicle`) USING BTREE,
INDEX `i_vehicle`(`vehicle_id`) USING BTREE,
INDEX `i_book_user`(`book_user`) USING BTREE,
INDEX `i_book_end_date`(`book_end_date`) USING BTREE COMMENT '迁移至历史表时查询用到该索引(暂时)'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '汽车预定记录历史表,按年分表' ROW_FORMAT = Dynamic;
......
......@@ -3,13 +3,15 @@
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleMapper">
<resultMap id="searchUsableModelMap" type="com.xxfc.platform.vehicle.pojo.UsableVehicleModelVO">
<!-- <collection column="company_id" property="id" ofType="com.xxfc.platform.vehicle.entity.BranchCompany" select="com.xxfc.platform.vehicle.mapper.BranchCompanyMapper.selectByPrimaryKey" />-->
<!-- <result column="company_id" property="companyId" jdbcType="VARCHAR" javaType="java.lang.Integer"/>-->
<!-- <result column="model_id" property="modelId" jdbcType="INTEGER" javaType="java.lang.Integer"/>-->
<!-- <result column="vehicle_id" property="modelId" jdbcType="INTEGER" javaType="java.lang.Integer"/>-->
<association property="company" column="company_id" select="com.xxfc.platform.vehicle.mapper.BranchCompanyMapper.selectByPrimaryKey" />
<association property="vehicleModel" column="model_id" select="com.xxfc.platform.vehicle.mapper.VehicleModelMapper.selectByPrimaryKey" />
<!-- <association property="vehicle" column="vehicle_id" select="com.xxfc.platform.vehicle.mapper.VehicleMapper.selectByPrimaryKey" />-->
<!-- <collection column="company_id" property="id" ofType="com.xxfc.platform.vehicle.entity.BranchCompany" select="com.xxfc.platform.vehicle.mapper.BranchCompanyMapper.selectByPrimaryKey" />-->
<!-- <result column="company_id" property="companyId" jdbcType="VARCHAR" javaType="java.lang.Integer"/>-->
<!-- <result column="model_id" property="modelId" jdbcType="INTEGER" javaType="java.lang.Integer"/>-->
<!-- <result column="vehicle_id" property="modelId" jdbcType="INTEGER" javaType="java.lang.Integer"/>-->
<association property="company" column="company_id"
select="com.xxfc.platform.vehicle.mapper.BranchCompanyMapper.selectByPrimaryKey"/>
<association property="vehicleModel" column="model_id"
select="com.xxfc.platform.vehicle.mapper.VehicleModelMapper.selectByPrimaryKey"/>
<!-- <association property="vehicle" column="vehicle_id" select="com.xxfc.platform.vehicle.mapper.VehicleMapper.selectByPrimaryKey" />-->
</resultMap>
<update id="updateStatusById" parameterType="java.util.Map">
......@@ -255,7 +257,8 @@
<include refid="searchUsableSql"/>
GROUP BY model_id, company_id<if test="lon != null and lat != null">, distance</if>
GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if>
<!-- 循环 相同父级 数据做并集, 不同父级做或集 -->
<if test=" catas != null ">
......@@ -295,6 +298,109 @@
</if>
</select>
<select id="countVehicleByParam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
resultType="com.xxfc.platform.vehicle.pojo.VehicleCountVo">
SELECT count(*) total ,
CASE
WHEN travel_status = 1 THEN
'1'
WHEN travel_status = 2 THEN
'2'
WHEN travel_status = 3 THEN
'3'
WHEN travel_status = 4 THEN
'4'
ELSE
'-1'
END travel_status,
CASE
WHEN travel_status = 1 THEN
'出行中'
WHEN travel_status = 2 THEN
'预约中'
WHEN travel_status = 3 THEN
'空闲中'
WHEN travel_status = 4 THEN
'保养中'
ELSE
'不可用'
END detail
from vehicle v1 GROUP BY travel_status
<where>
<if test="startTime != null">
and v1.update_time between startTime and endTime
</if>
<if test="numberPlate != null">
and v1.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v1.status = #{status}
</if>
<if test="subordinateBranch != null">
and v1.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v1.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
union all
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
<where>
<if test="startTime != null">
and v2.update_time between startTime and endTime
</if>
<if test="numberPlate != null">
and v2.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v2.status = #{status}
</if>
<if test="subordinateBranch != null">
and v2.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v2.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
union all
SELECT count(*) total,
CASE
WHEN status = 1 THEN
'5'
WHEN status = 2 THEN
'6'
ELSE
'7'
END travel_status,
CASE
WHEN status = 1 THEN
'正常运行'
WHEN status = 2 THEN
'维修'
ELSE
'报废'
END travel_status
FROM vehicle v3 GROUP BY status
<where>
<if test="startTime != null">
and v3.update_time between startTime and endTime
</if>
<if test="numberPlate != null">
and v3.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v3.status = #{status}
</if>
<if test="subordinateBranch != null">
and v3.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v3.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
</select>
<sql id="searchUsableSql">
from vehicle v
<if test=" yearMonthAndParam !=null ">
......@@ -312,7 +418,8 @@
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs}
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} =
#{andOperation.andOperationRs}
)
</foreach>
</if>
......
......@@ -20,8 +20,35 @@
</select>
<select id="getMsgByVehicle" parameterType="String" resultType="com.xxfc.platform.vehicle.entity.VehicleWarningMsg" >
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="getMsgByVehicle" parameterType="java.util.Map" resultType="com.xxfc.platform.vehicle.entity.VehicleWarningMsg" >
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="getAllByparam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto" resultType="com.xxfc.platform.vehicle.entity.VehicleWarningMsg" >
select w.*
from vehicle_warning_msg w
left join vehicle v on w.vehicle_id = v.id
<where>
<if test="vehicleId != null">
and w.vehicle_id = #{vehicleId}
</if>
<if test="startTime != null">
and w.create_time between startTime and endTime
</if>
<if test="numberPlate != null">
and v.number_plate = #{numberPlate}
</if>
<if test="status != null">
and v.status = #{status}
</if>
<if test="subordinateBranch != null">
and v.subordinate_branch = #{subordinateBranch}
</if>
<if test="parkBranchCompanyId != null">
and v.park_branch_company_id = #{parkBranchCompanyId}
</if>
</where>
</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