<?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.sy.mapper.ArdTankLockAlarmMapper">
|
|
<resultMap type="ArdTankLockAlarm" id="ArdTankLockAlarmResult">
|
<result property="lockNum" column="lock_num" />
|
<result property="alarmInfo" column="alarm_info" />
|
<result property="id" column="id" />
|
<result property="lockId" column="lock_id" />
|
<result property="alarmTime" column="alarm_time" />
|
</resultMap>
|
|
<sql id="selectArdTankLockAlarmVo">
|
select lock_num, alarm_info, id, lock_id, alarm_time from ard_tank_lock_alarm
|
</sql>
|
|
<select id="selectArdTankLockAlarmList" parameterType="ArdTankLockAlarm" resultMap="ArdTankLockAlarmResult">
|
<include refid="selectArdTankLockAlarmVo"/>
|
<where>
|
<if test="lockNum != null and lockNum != ''"> and lock_num = #{lockNum}</if>
|
<if test="alarmInfo != null and alarmInfo != ''"> and alarm_info = #{alarmInfo}</if>
|
<if test="lockId != null and lockId != ''"> and lock_id = #{lockId}</if>
|
<if test="alarmTime != null and alarmTime != ''"> and alarm_time = #{alarmTime}</if>
|
</where>
|
</select>
|
|
<select id="selectArdTankLockAlarmByLockNum" parameterType="String" resultMap="ArdTankLockAlarmResult">
|
<include refid="selectArdTankLockAlarmVo"/>
|
where lock_num = #{lockNum}
|
</select>
|
|
<insert id="insertArdTankLockAlarm" parameterType="ArdTankLockAlarm">
|
insert into ard_tank_lock_alarm
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="lockNum != null">lock_num,</if>
|
<if test="alarmInfo != null">alarm_info,</if>
|
<if test="id != null">id,</if>
|
<if test="lockId != null">lock_id,</if>
|
<if test="alarmTime != null">alarm_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="lockNum != null">#{lockNum},</if>
|
<if test="alarmInfo != null">#{alarmInfo},</if>
|
<if test="id != null">#{id},</if>
|
<if test="lockId != null">#{lockId},</if>
|
<if test="alarmTime != null">#{alarmTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateArdTankLockAlarm" parameterType="ArdTankLockAlarm">
|
update ard_tank_lock_alarm
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="alarmInfo != null">alarm_info = #{alarmInfo},</if>
|
<if test="id != null">id = #{id},</if>
|
<if test="lockId != null">lock_id = #{lockId},</if>
|
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
|
</trim>
|
where lock_num = #{lockNum}
|
</update>
|
|
<delete id="deleteArdTankLockAlarmByLockNum" parameterType="String">
|
delete from ard_tank_lock_alarm where lock_num = #{lockNum}
|
</delete>
|
|
<delete id="deleteArdTankLockAlarmByLockNums" parameterType="String">
|
delete from ard_tank_lock_alarm where lock_num in
|
<foreach item="lockNum" collection="array" open="(" separator="," close=")">
|
#{lockNum}
|
</foreach>
|
</delete>
|
|
<select id="selectArdTankLockAlarmBylockIdAndTime" parameterType="java.lang.String" resultType="java.util.Map">
|
select atlm.id,atlm.lock_id as "lockId",atlm.lock_num as "lockNum",
|
atlm.alarm_info as "alarmInfo",atlm.alarm_time as "alarmTime",
|
atl.lock_name as "lockName",atl.car_id as "carId"
|
from ard_tank_lock_alarm atlm
|
inner join ard_tank_lock atl on atlm.lock_id = atl."id"
|
<where>
|
<if test="carId != null and carId != ''"> and car_id = #{carId}</if>
|
<if test="lockId != null and lockId != ''"> and lock_id = #{lockId}</if>
|
<if test="beginTime != null and beginTime != ''"> and alarm_time >= #{beginTime}</if>
|
<if test="endTime != null and endTime != ''"> and alarm_time <= #{endTime}</if>
|
</where>
|
order by atlm.alarm_time desc
|
</select>
|
|
<select id="selectArdTankLockAlarmTotalBylockIdAndTime" parameterType="java.lang.String" resultType="java.lang.Long">
|
select count(*)
|
from ard_tank_lock_alarm atlm
|
inner join ard_tank_lock atl on atlm.lock_id = atl."id"
|
<where>
|
<if test="carId != null and carId != ''"> and car_id = #{carId}</if>
|
<if test="lockId != null and lockId != ''"> and lock_id = #{lockId}</if>
|
<if test="beginTime != null and beginTime != ''"> and alarm_time >= #{beginTime}</if>
|
<if test="endTime != null and endTime != ''"> and alarm_time <= #{endTime}</if>
|
</where>
|
</select>
|
|
<select id="selectArdTankLockAlarmByDeptIdAndTime" resultType="java.util.Map">
|
select atlm.id,atlm.lock_id as "lockId",atlm.lock_num as "lockNum",
|
atlm.alarm_info as "alarmInfo",atlm.alarm_time as "alarmTime",
|
atl.lock_name as "lockName",atl.car_id as "carId"
|
from ard_tank_lock_alarm atlm
|
inner join ard_tank_lock atl on atlm.lock_id = atl."id"
|
<where>
|
<if test="beginTime != null and beginTime != ''"> and alarm_time >= #{beginTime}</if>
|
<if test="endTime != null and endTime != ''"> and alarm_time <= #{endTime}</if>
|
<if test="deptId != null">
|
and atl.car_id in (select car_id from ard_sy_car "asc" where "asc".dept_id in (
|
with recursive rsd as (
|
select sd.dept_id from sys_dept sd where sd.dept_id = #{deptId}
|
union
|
select csd.dept_id from sys_dept csd inner join rsd on rsd.dept_id = csd.parent_id
|
)
|
select * from rsd))
|
</if>
|
</where>
|
order by atlm.alarm_time desc
|
</select>
|
|
<select id="selectArdTankLockAlarmTotalByDeptIdAndTime" resultType="java.lang.Long">
|
select count(*)
|
from ard_tank_lock_alarm atlm
|
inner join ard_tank_lock atl on atlm.lock_id = atl."id"
|
<where>
|
<if test="beginTime != null and beginTime != ''"> and alarm_time >= #{beginTime}</if>
|
<if test="endTime != null and endTime != ''"> and alarm_time <= #{endTime}</if>
|
<if test="deptId != null">
|
and atl.car_id in (select car_id from ard_sy_car "asc" where "asc".dept_id in (
|
with recursive rsd as (
|
select sd.dept_id from sys_dept sd where sd.dept_id = #{deptId}
|
union
|
select csd.dept_id from sys_dept csd inner join rsd on rsd.dept_id = csd.parent_id
|
)
|
select * from rsd))
|
</if>
|
</where>
|
</select>
|
</mapper>
|