<?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.ruoyi.system.mapper.VehicleAbnormalAlertMapper">
|
|
<resultMap type="VehicleAbnormalAlert" id="VehicleAbnormalAlertResult">
|
<result property="alertId" column="alert_id" />
|
<result property="vehicleId" column="vehicle_id" />
|
<result property="vehicleNo" column="vehicle_no" />
|
<result property="alertDate" column="alert_date" />
|
<result property="alertTime" column="alert_time" />
|
<result property="mileage" column="mileage" />
|
<result property="alertType" column="alert_type" />
|
<result property="alertReason" column="alert_reason" />
|
<result property="startTime" column="start_time" />
|
<result property="endTime" column="end_time" />
|
<result property="alertCount" column="alert_count" />
|
<result property="status" column="status" />
|
<result property="handlerId" column="handler_id" />
|
<result property="handlerName" column="handler_name" />
|
<result property="handleTime" column="handle_time" />
|
<result property="handleRemark" column="handle_remark" />
|
<result property="notifyStatus" column="notify_status" />
|
<result property="notifyTime" column="notify_time" />
|
<result property="notifyUsers" column="notify_users" />
|
<result property="deptId" column="dept_id" />
|
<result property="deptName" column="dept_name" />
|
<result property="createTime" column="create_time" />
|
<result property="updateTime" column="update_time" />
|
</resultMap>
|
|
<sql id="selectVehicleAbnormalAlertVo">
|
select alert_id, vehicle_id, vehicle_no, alert_date, alert_time, mileage, alert_type, alert_reason,
|
start_time, end_time, alert_count, status, handler_id, handler_name, handle_time, handle_remark,
|
notify_status, notify_time, notify_users, dept_id, dept_name, create_time, update_time
|
from tb_vehicle_abnormal_alert
|
</sql>
|
|
<select id="selectVehicleAbnormalAlertList" parameterType="VehicleAbnormalAlert" resultMap="VehicleAbnormalAlertResult">
|
<include refid="selectVehicleAbnormalAlertVo"/>
|
<where>
|
<if test="vehicleId != null "> and vehicle_id = #{vehicleId}</if>
|
<if test="vehicleNo != null and vehicleNo != ''"> and vehicle_no like concat('%', #{vehicleNo}, '%')</if>
|
<if test="alertDate != null "> and date(alert_date) = date(#{alertDate})</if>
|
<if test="params.beginAlertTime != null and params.beginAlertTime != ''"><!-- 开始时间检索 -->
|
AND date_format(alert_time,'%y%m%d') >= date_format(#{params.beginAlertTime},'%y%m%d')
|
</if>
|
<if test="params.endAlertTime != null and params.endAlertTime != ''"><!-- 结束时间检索 -->
|
AND date_format(alert_time,'%y%m%d') <= date_format(#{params.endAlertTime},'%y%m%d')
|
</if>
|
<if test="alertType != null and alertType != ''"> and alert_type = #{alertType}</if>
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
</where>
|
order by alert_time desc
|
</select>
|
|
<select id="selectVehicleAbnormalAlertByAlertId" parameterType="Long" resultMap="VehicleAbnormalAlertResult">
|
<include refid="selectVehicleAbnormalAlertVo"/>
|
where alert_id = #{alertId}
|
</select>
|
|
<insert id="insertVehicleAbnormalAlert" parameterType="VehicleAbnormalAlert" useGeneratedKeys="true" keyProperty="alertId">
|
insert into tb_vehicle_abnormal_alert
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="vehicleId != null">vehicle_id,</if>
|
<if test="vehicleNo != null and vehicleNo != ''">vehicle_no,</if>
|
<if test="alertDate != null">alert_date,</if>
|
<if test="alertTime != null">alert_time,</if>
|
<if test="mileage != null">mileage,</if>
|
<if test="alertType != null">alert_type,</if>
|
<if test="alertReason != null">alert_reason,</if>
|
<if test="startTime != null">start_time,</if>
|
<if test="endTime != null">end_time,</if>
|
<if test="alertCount != null">alert_count,</if>
|
<if test="status != null">status,</if>
|
<if test="handlerId != null">handler_id,</if>
|
<if test="handlerName != null">handler_name,</if>
|
<if test="handleTime != null">handle_time,</if>
|
<if test="handleRemark != null">handle_remark,</if>
|
<if test="notifyStatus != null">notify_status,</if>
|
<if test="notifyTime != null">notify_time,</if>
|
<if test="notifyUsers != null">notify_users,</if>
|
<if test="deptId != null">dept_id,</if>
|
<if test="deptName != null">dept_name,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="vehicleId != null">#{vehicleId},</if>
|
<if test="vehicleNo != null and vehicleNo != ''">#{vehicleNo},</if>
|
<if test="alertDate != null">#{alertDate},</if>
|
<if test="alertTime != null">#{alertTime},</if>
|
<if test="mileage != null">#{mileage},</if>
|
<if test="alertType != null">#{alertType},</if>
|
<if test="alertReason != null">#{alertReason},</if>
|
<if test="startTime != null">#{startTime},</if>
|
<if test="endTime != null">#{endTime},</if>
|
<if test="alertCount != null">#{alertCount},</if>
|
<if test="status != null">#{status},</if>
|
<if test="handlerId != null">#{handlerId},</if>
|
<if test="handlerName != null">#{handlerName},</if>
|
<if test="handleTime != null">#{handleTime},</if>
|
<if test="handleRemark != null">#{handleRemark},</if>
|
<if test="notifyStatus != null">#{notifyStatus},</if>
|
<if test="notifyTime != null">#{notifyTime},</if>
|
<if test="notifyUsers != null">#{notifyUsers},</if>
|
<if test="deptId != null">#{deptId},</if>
|
<if test="deptName != null">#{deptName},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateVehicleAbnormalAlert" parameterType="VehicleAbnormalAlert">
|
update tb_vehicle_abnormal_alert
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="vehicleId != null">vehicle_id = #{vehicleId},</if>
|
<if test="vehicleNo != null and vehicleNo != ''">vehicle_no = #{vehicleNo},</if>
|
<if test="alertDate != null">alert_date = #{alertDate},</if>
|
<if test="alertTime != null">alert_time = #{alertTime},</if>
|
<if test="mileage != null">mileage = #{mileage},</if>
|
<if test="alertType != null">alert_type = #{alertType},</if>
|
<if test="alertReason != null">alert_reason = #{alertReason},</if>
|
<if test="startTime != null">start_time = #{startTime},</if>
|
<if test="endTime != null">end_time = #{endTime},</if>
|
<if test="alertCount != null">alert_count = #{alertCount},</if>
|
<if test="status != null">status = #{status},</if>
|
<if test="handlerId != null">handler_id = #{handlerId},</if>
|
<if test="handlerName != null">handler_name = #{handlerName},</if>
|
<if test="handleTime != null">handle_time = #{handleTime},</if>
|
<if test="handleRemark != null">handle_remark = #{handleRemark},</if>
|
<if test="notifyStatus != null">notify_status = #{notifyStatus},</if>
|
<if test="notifyTime != null">notify_time = #{notifyTime},</if>
|
<if test="notifyUsers != null">notify_users = #{notifyUsers},</if>
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="deptName != null">dept_name = #{deptName},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
</trim>
|
where alert_id = #{alertId}
|
</update>
|
|
<delete id="deleteVehicleAbnormalAlertByAlertId" parameterType="Long">
|
delete from tb_vehicle_abnormal_alert where alert_id = #{alertId}
|
</delete>
|
|
<delete id="deleteVehicleAbnormalAlertByAlertIds" parameterType="String">
|
delete from tb_vehicle_abnormal_alert where alert_id in
|
<foreach item="alertId" collection="array" open="(" separator="," close=")">
|
#{alertId}
|
</foreach>
|
</delete>
|
|
<select id="selectDailyAlertCount" resultType="int">
|
select count(*) from tb_vehicle_abnormal_alert
|
where vehicle_id = #{vehicleId} and date(alert_date) = date(#{alertDate})
|
</select>
|
|
<select id="selectLastAlertTime" resultType="java.util.Date">
|
select max(alert_time) from tb_vehicle_abnormal_alert
|
where vehicle_id = #{vehicleId}
|
</select>
|
|
<update id="batchHandleAlert">
|
update tb_vehicle_abnormal_alert
|
set status = '1',
|
handler_id = #{handlerId},
|
handler_name = #{handlerName},
|
handle_time = now(),
|
handle_remark = #{handleRemark}
|
where alert_id in
|
<foreach item="alertId" collection="alertIds" open="(" separator="," close=")">
|
#{alertId}
|
</foreach>
|
</update>
|
</mapper>
|