2025-02-27 00:15:50 +08:00
<?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.yanzhu.manage.mapper.DevAiProjectDataMapper" >
<resultMap type= "DevAiProjectData" id= "DevAiProjectDataResult" >
<result property= "id" column= "id" />
<result property= "comId" column= "com_id" />
<result property= "comName" column= "com_name" />
<result property= "projectId" column= "project_id" />
<result property= "projectName" column= "project_name" />
<result property= "deviceId" column= "device_id" />
<result property= "deviceName" column= "device_name" />
<result property= "serialNumber" column= "serial_number" />
<result property= "ipcSerialNum" column= "IPC_serial_num" />
<result property= "imageUrl" column= "image_url" />
<result property= "channelId" column= "channel_id" />
<result property= "channelName" column= "channel_name" />
<result property= "alarmType" column= "alarm_type" />
2025-04-20 13:31:47 +08:00
<result property= "alarmTypeName" column= "alarm_type_name" />
2025-02-27 00:15:50 +08:00
<result property= "alarmId" column= "alarm_id" />
<result property= "plateNo" column= "plate_no" />
<result property= "alarmVideourl" column= "alarm_videoURL" />
<result property= "alarmVideoName" column= "alarm_video_name" />
<result property= "createTime" column= "create_time" />
<result property= "isDel" column= "is_del" />
</resultMap>
<sql id= "selectDevAiProjectDataVo" >
2025-04-20 13:31:47 +08:00
select dapd.id, dapd.com_id, sd.dept_name as com_name, dapd.project_id, pi.project_name, dapd.device_id, dapd.device_name, dapd.serial_number, dapd.IPC_serial_num, dapd.image_url, dapd.channel_id, dapd.channel_name, dapd.alarm_type, sdd.dict_label as alarm_type_name, dapd.alarm_id, dapd.plate_no, dapd.alarm_videoURL, dapd.alarm_video_name, dapd.create_time, dapd.is_del from dev_ai_project_data dapd
2025-02-27 00:15:50 +08:00
left join pro_project_info pi on pi.id = dapd.project_id
left join sys_dept sd on sd.dept_id = dapd.com_id
2025-04-20 13:31:47 +08:00
left join sys_dict_data sdd on sdd.dict_value = dapd.alarm_type and sdd.dict_type = 'aibox_alarm_type'
2025-02-27 00:15:50 +08:00
</sql>
<select id= "selectDevAiProjectDataList" parameterType= "DevAiProjectData" resultMap= "DevAiProjectDataResult" >
<include refid= "selectDevAiProjectDataVo" />
<where >
<if test= "comId != null " > and dapd.com_id = #{comId}</if>
<if test= "projectId != null " > and dapd.project_id = #{projectId}</if>
<if test= "activeComId != null " > and dapd.com_id = #{activeComId}</if>
<if test= "activeProjectId != null " > and dapd.project_id = #{activeProjectId}</if>
<if test= "deviceId != null " > and dapd.device_id = #{deviceId}</if>
<if test= "deviceName != null and deviceName != ''" > and (dapd.device_name like concat('%', #{deviceName}, '%') or dapd.serial_number like concat('%', #{deviceName}, '%'))</if>
<if test= "channelName != null and channelName != ''" > and dapd.channel_name like concat('%', #{channelName}, '%')</if>
<if test= "alarmType != null " > and dapd.alarm_type = #{alarmType}</if>
2025-04-20 13:31:47 +08:00
<if test= "params.date != null" > and date(dapd.create_time) = date(#{params.date})</if>
2025-02-27 00:15:50 +08:00
<if test= "params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''" > and dapd.create_time between #{params.beginTime} and #{params.endTime}</if>
<if test= "isDel != null and isDel != ''" > and dapd.is_del = #{isDel}</if>
and dapd.is_del != 2
</where>
order by dapd.id desc
</select>
<select id= "selectDevAiProjectDataById" parameterType= "Long" resultMap= "DevAiProjectDataResult" >
<include refid= "selectDevAiProjectDataVo" />
where dapd.id = #{id}
</select>
<insert id= "insertDevAiProjectData" parameterType= "DevAiProjectData" useGeneratedKeys= "true" keyProperty= "id" >
insert into dev_ai_project_data
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "comId != null" > com_id,</if>
<if test= "projectId != null" > project_id,</if>
<if test= "deviceId != null" > device_id,</if>
<if test= "deviceName != null" > device_name,</if>
<if test= "serialNumber != null" > serial_number,</if>
<if test= "ipcSerialNum != null" > IPC_serial_num,</if>
<if test= "imageUrl != null" > image_url,</if>
<if test= "channelId != null" > channel_id,</if>
<if test= "channelName != null" > channel_name,</if>
<if test= "alarmType != null" > alarm_type,</if>
<if test= "alarmId != null" > alarm_id,</if>
<if test= "plateNo != null" > plate_no,</if>
<if test= "alarmVideourl != null" > alarm_videoURL,</if>
<if test= "alarmVideoName != null" > alarm_video_name,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "isDel != null" > is_del,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "comId != null" > #{comId},</if>
<if test= "projectId != null" > #{projectId},</if>
<if test= "deviceId != null" > #{deviceId},</if>
<if test= "deviceName != null" > #{deviceName},</if>
<if test= "serialNumber != null" > #{serialNumber},</if>
<if test= "ipcSerialNum != null" > #{ipcSerialNum},</if>
<if test= "imageUrl != null" > #{imageUrl},</if>
<if test= "channelId != null" > #{channelId},</if>
<if test= "channelName != null" > #{channelName},</if>
<if test= "alarmType != null" > #{alarmType},</if>
<if test= "alarmId != null" > #{alarmId},</if>
<if test= "plateNo != null" > #{plateNo},</if>
<if test= "alarmVideourl != null" > #{alarmVideourl},</if>
<if test= "alarmVideoName != null" > #{alarmVideoName},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "isDel != null" > #{isDel},</if>
</trim>
</insert>
<update id= "updateDevAiProjectData" parameterType= "DevAiProjectData" >
update dev_ai_project_data
<trim prefix= "SET" suffixOverrides= "," >
<if test= "comId != null" > com_id = #{comId},</if>
<if test= "projectId != null" > project_id = #{projectId},</if>
<if test= "deviceId != null" > device_id = #{deviceId},</if>
<if test= "deviceName != null" > device_name = #{deviceName},</if>
<if test= "serialNumber != null" > serial_number = #{serialNumber},</if>
<if test= "ipcSerialNum != null" > IPC_serial_num = #{ipcSerialNum},</if>
<if test= "imageUrl != null" > image_url = #{imageUrl},</if>
<if test= "channelId != null" > channel_id = #{channelId},</if>
<if test= "channelName != null" > channel_name = #{channelName},</if>
<if test= "alarmType != null" > alarm_type = #{alarmType},</if>
<if test= "alarmId != null" > alarm_id = #{alarmId},</if>
<if test= "plateNo != null" > plate_no = #{plateNo},</if>
<if test= "alarmVideourl != null" > alarm_videoURL = #{alarmVideourl},</if>
<if test= "alarmVideoName != null" > alarm_video_name = #{alarmVideoName},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "isDel != null" > is_del = #{isDel},</if>
</trim>
where id = #{id}
</update>
<update id= "deleteDevAiProjectDataById" parameterType= "Long" >
update dev_ai_project_data set is_del = 2 where id = #{id}
</update>
<update id= "deleteDevAiProjectDataByIds" parameterType= "String" >
update dev_ai_project_data set is_del = 2 where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</update>
2025-04-20 13:31:47 +08:00
<select id= "findDaysTrendView" parameterType= "DevAiProjectData" resultType= "map" >
select date(create_time) as create_time, count(1) as total from dev_ai_project_data
<where >
<if test= "projectId != null " > and project_id = #{projectId}</if>
<if test= "deviceName != null and deviceName != ''" > and device_name like concat('%', #{deviceName}, '%')</if>
<if test= "alarmType != null " > and alarm_type = #{alarmType}</if>
<if test= "params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''" > and date(create_time) between #{params.beginTime} and #{params.endTime}</if>
and is_del='0'
</where>
group by date(create_time)
</select>
<select id= "groupCountByAlarmType" parameterType= "DevAiProjectData" resultType= "map" >
select dapd.alarm_type as type,sdd.dict_label as name, count(1) as value from dev_ai_project_data dapd
left join sys_dict_data sdd on sdd.dict_type='aibox_alarm_type' and sdd.dict_value=dapd.alarm_type
<where >
<if test= "projectId != null " > and dapd.project_id = #{projectId}</if>
<if test= "deviceName != null and deviceName != ''" > and dapd.device_name like concat('%', #{deviceName}, '%')</if>
<if test= "alarmType != null " > and dapd.alarm_type = #{alarmType}</if>
<if test= "params.date != null" > and date(dapd.create_time) = date(#{params.date})</if>
and dapd.is_del='0'
</where>
GROUP BY dapd.alarm_type
</select>
2025-02-27 00:15:50 +08:00
</mapper>