|
|
<?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.inspect.partrolresult.mapper.PatrolResultMapper">
|
|
|
|
|
|
<resultMap type="PatrolResult" id="PatrolResultResult">
|
|
|
<result property="lineId" column="line_id"/>
|
|
|
<result property="patrolDeviceName" column="patrol_device_name"/>
|
|
|
<result property="patrolDeviceCode" column="patrol_device_code"/>
|
|
|
<result property="taskName" column="task_name"/>
|
|
|
<result property="taskCode" column="task_code"/>
|
|
|
<result property="deviceName" column="device_name"/>
|
|
|
<result property="deviceId" column="device_id"/>
|
|
|
<result property="valueType" column="value_type"/>
|
|
|
<result property="value" column="value"/>
|
|
|
<result property="valueUnit" column="value_unit"/>
|
|
|
<result property="unit" column="unit"/>
|
|
|
<result property="time" column="time"/>
|
|
|
<result property="recognitionType" column="recognition_type"/>
|
|
|
<result property="fileType" column="file_type"/>
|
|
|
<result property="filePath" column="file_path"/>
|
|
|
<result property="rectangle" column="rectangle"/>
|
|
|
<result property="taskPatrolledId" column="task_patrolled_id"/>
|
|
|
<result property="valid" column="valid"/>
|
|
|
<result property="patrolStatus" column="patrol_status"/>
|
|
|
<result property="checkPerson" column="check_person"/>
|
|
|
<result property="checkTime" column="check_time"/>
|
|
|
<result property="checkResult" column="check_result"/>
|
|
|
<result property="materialId" column="material_id"/>
|
|
|
<result property="dataType" column="data_type"/>
|
|
|
<result property="threshold" column="threshold"/>
|
|
|
<result property="taskId" column="task_id"/>
|
|
|
<result property="mainId" column="main_id"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectPatrolResultVo">
|
|
|
select line_id,
|
|
|
main_id,
|
|
|
check_result,
|
|
|
create_time,
|
|
|
task_id,
|
|
|
patrol_device_name,
|
|
|
patrol_status,
|
|
|
check_person,
|
|
|
check_time,
|
|
|
patrol_device_code,
|
|
|
task_name,
|
|
|
task_code,
|
|
|
device_name,
|
|
|
device_id,
|
|
|
value_type,
|
|
|
value,
|
|
|
value_unit,
|
|
|
unit, time, recognition_type, file_type, file_path, rectangle, task_patrolled_id, valid, material_id, data_type, threshold
|
|
|
from patrol_result
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectPatrolResultList" parameterType="PatrolResult" resultMap="PatrolResultResult">
|
|
|
<include refid="selectPatrolResultVo"/>
|
|
|
<where>
|
|
|
<if test="patrolDeviceName != null and patrolDeviceName != ''">and patrol_device_name like concat('%',
|
|
|
#{patrolDeviceName}, '%')
|
|
|
</if>
|
|
|
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">and patrol_device_code =
|
|
|
#{patrolDeviceCode}
|
|
|
</if>
|
|
|
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
|
|
|
<if test="lineId != null and lineId != ''">and line_id = #{lineId}</if>
|
|
|
<if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
|
|
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
|
|
</if>
|
|
|
<if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if>
|
|
|
<if test="valueType != null and valueType != ''">and value_type = #{valueType}</if>
|
|
|
<if test="value != null and value != ''">and value = #{value}</if>
|
|
|
<if test="valueUnit != null and valueUnit != ''">and value_unit = #{valueUnit}</if>
|
|
|
<if test="unit != null and unit != ''">and unit = #{unit}</if>
|
|
|
<if test="time != null ">and time = #{time}</if>
|
|
|
<if test="recognitionType != null and recognitionType != ''">and recognition_type = #{recognitionType}</if>
|
|
|
<if test="fileType != null and fileType != ''">and file_type = #{fileType}</if>
|
|
|
<if test="filePath != null and filePath != ''">and file_path = #{filePath}</if>
|
|
|
<if test="rectangle != null and rectangle != ''">and rectangle = #{rectangle}</if>
|
|
|
<if test="taskPatrolledId != null and taskPatrolledId != ''">and task_patrolled_id = #{taskPatrolledId}
|
|
|
</if>
|
|
|
<if test="valid != null and valid != ''">and valid = #{valid}</if>
|
|
|
<if test="patrolStatus != null and patrolStatus != ''">and patrol_status = #{patrolStatus}</if>
|
|
|
<if test="checkPerson != null and checkPerson != ''">and check_person = #{checkPerson}</if>
|
|
|
<if test="checkTime != null ">and check_time = #{checkTime}</if>
|
|
|
<if test="checkResult != null ">and check_result = #{checkResult}</if>
|
|
|
<if test="materialId != null and materialId != ''">and material_id = #{materialId}</if>
|
|
|
<if test="dataType != null and dataType != ''">and data_type = #{dataType}</if>
|
|
|
<if test="threshold != null and threshold != ''">and threshold = #{threshold}</if>
|
|
|
<if test="taskId != null and taskId != ''">and task_id = #{taskId}</if>
|
|
|
<if test="mainId != null and mainId != ''">and main_id = #{mainId}</if>
|
|
|
ORDER BY line_id desc
|
|
|
</where>
|
|
|
</select>
|
|
|
<select id="selectPatrolResultListOrderBy" parameterType="PatrolResult" resultMap="PatrolResultResult">
|
|
|
<include refid="selectPatrolResultVo"/>
|
|
|
<where>
|
|
|
<if test="patrolDeviceName != null and patrolDeviceName != ''">and patrol_device_name like concat('%',
|
|
|
#{patrolDeviceName}, '%')
|
|
|
</if>
|
|
|
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">and patrol_device_code =
|
|
|
#{patrolDeviceCode}
|
|
|
</if>
|
|
|
<if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
|
|
|
<if test="lineId != null and lineId != ''">and line_id = #{lineId}</if>
|
|
|
<if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
|
|
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
|
|
</if>
|
|
|
<if test="deviceId != null and deviceId != ''">and device_id = #{deviceId}</if>
|
|
|
<if test="valueType != null and valueType != ''">and value_type = #{valueType}</if>
|
|
|
<if test="value != null and value != ''">and value = #{value}</if>
|
|
|
<if test="valueUnit != null and valueUnit != ''">and value_unit = #{valueUnit}</if>
|
|
|
<if test="unit != null and unit != ''">and unit = #{unit}</if>
|
|
|
<if test="time != null ">and time = #{time}</if>
|
|
|
<if test="recognitionType != null and recognitionType != ''">and recognition_type = #{recognitionType}</if>
|
|
|
<if test="fileType != null and fileType != ''">and file_type = #{fileType}</if>
|
|
|
<if test="filePath != null and filePath != ''">and file_path = #{filePath}</if>
|
|
|
<if test="rectangle != null and rectangle != ''">and rectangle = #{rectangle}</if>
|
|
|
<if test="taskPatrolledId != null and taskPatrolledId != ''">and task_patrolled_id = #{taskPatrolledId}
|
|
|
</if>
|
|
|
<if test="valid != null and valid != ''">and valid = #{valid}</if>
|
|
|
<if test="patrolStatus != null and patrolStatus != ''">and patrol_status = #{patrolStatus}</if>
|
|
|
<if test="checkPerson != null and checkPerson != ''">and check_person = #{checkPerson}</if>
|
|
|
<if test="checkTime != null ">and check_time = #{checkTime}</if>
|
|
|
<if test="checkResult != null ">and check_result = #{checkResult}</if>
|
|
|
<if test="materialId != null and materialId != ''">and material_id = #{materialId}</if>
|
|
|
<if test="dataType != null and dataType != ''">and data_type = #{dataType}</if>
|
|
|
<if test="threshold != null and threshold != ''">and threshold = #{threshold}</if>
|
|
|
<if test="taskId != null and taskId != ''">and task_id = #{taskId}</if>
|
|
|
<if test="mainId != null and mainId != ''">and main_id = #{mainId}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
<resultMap type="PatrolData" id="PatrolDataResult">
|
|
|
<result property="lineId" column="line_id"/>
|
|
|
<result property="pointName" column="point_name"/>
|
|
|
<result property="patrolTime" column="patrol_time"/>
|
|
|
<result property="pointStatus" column="point_status"/>
|
|
|
<result property="warnStatus" column="warn_status"/>
|
|
|
<result property="desc" column="desc"/>
|
|
|
<result property="img" column="img"/>
|
|
|
<result property="imgType" column="img_type"/>
|
|
|
<result property="dataType" column="data_type"/>
|
|
|
<result property="imgAnalyse" column="img_analysis"/>
|
|
|
</resultMap>
|
|
|
<select id="selectPatrolDataResultByTaskCode" parameterType="PatrolResult" resultMap="PatrolDataResult">
|
|
|
select
|
|
|
a.line_id ,
|
|
|
a.device_name as point_name,
|
|
|
a.create_time as patrol_time,
|
|
|
b.point_status ,
|
|
|
b.result_type as warn_status,
|
|
|
b.description as 'desc',
|
|
|
a.file_path as img,
|
|
|
a.file_type as img_type,
|
|
|
a.data_type,
|
|
|
JSON_VALUE(b.result_content, '$**.resImageUrl') imgAnaly
|
|
|
from patrol_result a
|
|
|
LEFT JOIN result_analysis b on a.line_id=b.business_id
|
|
|
<where>
|
|
|
<if test="taskCode != null and taskCode != ''">and a.task_code = #{taskCode}</if>
|
|
|
<if test="taskPatrolledId != null and taskPatrolledId != ''">and a.task_patrolled_id=#{taskPatrolledId}
|
|
|
</if>
|
|
|
<if test="dataType != null and dataType != ''">and a.data_type = #{dataType}</if>
|
|
|
<if test="recognitionType != null and recognitionType != ''">and a.recognition_type = #{recognitionType}
|
|
|
</if>
|
|
|
<if test="valid != null and valid != ''">and a.valid = #{valid}</if>
|
|
|
<if test="patrolStatus != null and patrolStatus != ''">and a.patrol_status = #{patrolStatus}</if>
|
|
|
</where>
|
|
|
ORDER BY line_id desc
|
|
|
|
|
|
</select>
|
|
|
<select id="selectPatrolDataResultByTaskCodeList" parameterType="PatrolResult" resultMap="PatrolDataResult">
|
|
|
select
|
|
|
a.line_id,
|
|
|
a.device_name AS point_name,
|
|
|
a.create_time AS patrol_time,
|
|
|
a.valid AS 'desc',
|
|
|
a.file_path AS img,
|
|
|
a.file_type AS img_type
|
|
|
from patrol_result a
|
|
|
<where>
|
|
|
<if test="taskCode != null and taskCode != ''">and a.task_code = #{taskCode}</if>
|
|
|
<if test="taskPatrolledId != null and taskPatrolledId != ''">and a.task_patrolled_id=#{taskPatrolledId}
|
|
|
</if>
|
|
|
</where>
|
|
|
ORDER BY line_id desc
|
|
|
</select>
|
|
|
<resultMap type="com.inspect.system.base.openDomain.BasedataEqpBookMoMain" id="BasedataEqpBookResult">
|
|
|
<result property="eqpBookId" column="eqp_book_id"/>
|
|
|
<result property="stationName" column="station_name"/>
|
|
|
<result property="stationCode" column="station_code"/>
|
|
|
<result property="areaId" column="area_id"/>
|
|
|
<result property="areaName" column="area_name"/>
|
|
|
<result property="patrolDeviceName" column="patrol_device_name"/>
|
|
|
<result property="patrolDeviceCode" column="patrol_device_code"/>
|
|
|
<result property="deviceModel" column="device_model"/>
|
|
|
<result property="manufacturer" column="manufacturer"/>
|
|
|
<result property="useUnit" column="use_unit"/>
|
|
|
<result property="deviceSource" column="device_source"/>
|
|
|
<result property="productionDate" column="production_date"/>
|
|
|
<result property="productionCode" column="production_code"/>
|
|
|
<result property="isTransport" column="is_transport"/>
|
|
|
<result property="useMode" column="use_mode"/>
|
|
|
<result property="videoMode" column="video_mode"/>
|
|
|
<result property="place" column="place"/>
|
|
|
<result property="positionX" column="position_x"/>
|
|
|
<result property="positionY" column="position_y"/>
|
|
|
<result property="positionZ" column="position_z"/>
|
|
|
<result property="type" column="type"/>
|
|
|
<result property="patrolDeviceInfo" column="patrol_device_info"/>
|
|
|
<result property="robotsCode" column="robots_code"/>
|
|
|
<result property="ipAddr" column="ip_addr"/>
|
|
|
<result property="port" column="port"/>
|
|
|
<result property="user" column="user"/>
|
|
|
<result property="password" column="password"/>
|
|
|
<result property="delFlag" column="del_flag"/>
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
<result property="mainSystemCode" column="main_system_code"/>
|
|
|
</resultMap>
|
|
|
<select id="selectBasedataEqpBookList" parameterType="com.inspect.system.base.openDomain.BasedataEqpBookMoMain"
|
|
|
resultMap="BasedataEqpBookResult">
|
|
|
select * from basedata_eqpbook
|
|
|
|
|
|
<where>
|
|
|
<if test="stationName != null and stationName != ''">and station_name like concat('%', #{stationName},
|
|
|
'%')
|
|
|
</if>
|
|
|
<if test="stationCode != null and stationCode != ''">and station_code = #{stationCode}</if>
|
|
|
<if test="areaId != null ">and area_id = #{areaId}</if>
|
|
|
<if test="type != null ">and `type` = #{type}</if>
|
|
|
<if test="areaName != null and areaName != ''">and area_name like concat('%', #{areaName}, '%')</if>
|
|
|
<if test="patrolDeviceName != null and patrolDeviceName != ''">and patrol_device_name like concat('%',
|
|
|
#{patrolDeviceName}, '%')
|
|
|
</if>
|
|
|
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">and patrol_device_code =
|
|
|
#{patrolDeviceCode}
|
|
|
</if>
|
|
|
<if test="deviceModel != null and deviceModel != ''">and device_model = #{deviceModel}</if>
|
|
|
<if test="manufacturer != null and manufacturer != ''">and manufacturer = #{manufacturer}</if>
|
|
|
<if test="useUnit != null and useUnit != ''">and use_unit = #{useUnit}</if>
|
|
|
<if test="deviceSource != null and deviceSource != ''">and device_source = #{deviceSource}</if>
|
|
|
<if test="productionDate != null and productionDate != ''">and production_date = #{productionDate}</if>
|
|
|
<if test="productionCode != null and productionCode != ''">and production_code = #{productionCode}</if>
|
|
|
<if test="isTransport != null and isTransport != ''">and is_transport = #{isTransport}</if>
|
|
|
<if test="useMode != null and useMode != ''">and use_mode = #{useMode}</if>
|
|
|
<if test="videoMode != null and videoMode != ''">and video_mode = #{videoMode}</if>
|
|
|
<if test="place != null and place != ''">and place = #{place}</if>
|
|
|
<if test="positionX != null and positionX != ''">and position_x = #{positionX}</if>
|
|
|
<if test="positionY != null and positionY != ''">and position_y = #{positionY}</if>
|
|
|
<if test="positionZ != null and positionZ != ''">and position_z = #{positionZ}</if>
|
|
|
<!-- <if test="type != null and type != ''"> and type in concat('(',#{type},')') </if>-->
|
|
|
<if test="algId != null and algId != ''">and type in
|
|
|
<foreach item="algIda" collection="algId" open="(" separator="," close=")">
|
|
|
#{algIda}
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
<if test="patrolDeviceInfo != null and patrolDeviceInfo != ''">and patrol_device_info =
|
|
|
#{patrolDeviceInfo}
|
|
|
</if>
|
|
|
<if test="robotsCode != null and robotsCode != ''">and robots_code = #{robotsCode}</if>
|
|
|
<if test="ipAddr != null and ipAddr != ''">and ip_addr = #{ipAddr}</if>
|
|
|
<if test="port != null and port != ''">and port = #{port}</if>
|
|
|
<if test="user != null and user != ''">and user = #{user}</if>
|
|
|
<if test="password != null and password != ''">and password = #{password}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
<select id="selectPatroByAllDev" parameterType="PatrolResult" resultMap="PatrolResultResult">
|
|
|
select a.*,c.area_name from patrol_result a
|
|
|
left JOIN basedata_patrolpoint b on a.device_id=b.patrol_point_id
|
|
|
left join basedata_device c on b.main_device_id = c.device_id
|
|
|
left JOIN basedata_area d on c.area_id =d.area_id
|
|
|
left JOIN basedata_devicetype e on e.device_type_id =c.device_type_id
|
|
|
<where>
|
|
|
<if test="areaName != null and areaName != ''">and d.area_name like concat('%',#{areaName},'%')</if>
|
|
|
<if test="areaType != null and areaType != ''">and d.area_name like concat('%',#{areaType},'%') and
|
|
|
area_type ='bayunit'
|
|
|
</if>
|
|
|
<if test="deviceName != null and deviceName != ''">and a.device_name like concat('%',#{deviceName},'%')
|
|
|
</if>
|
|
|
<if test="deviceTypeName != null and deviceTypeName != ''">and e.devicetype_name like
|
|
|
concat('%',#{deviceTypeName},'%')
|
|
|
</if>
|
|
|
<if test="mainId != null and mainId != ''">and a.main_id =#{mainId}</if>
|
|
|
<if test="taskName != null and taskName != ''">and a.task_name like concat('%',#{taskName},'%')</if>
|
|
|
</where>
|
|
|
ORDER BY line_id desc
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<resultMap type="AlgInfo" id="AlgInfoResult">
|
|
|
<result property="algSubtypeName" column="alg_subtype_name"/>
|
|
|
<result property="algSubtypeCode" column="alg_subtype_code"/>
|
|
|
<result property="algName" column="alg_name"/>
|
|
|
</resultMap>
|
|
|
<select id="selectAlgInfo" parameterType="PatrolResult" resultMap="AlgInfoResult">
|
|
|
select a.alg_subtype_name,a.alg_subtype_code ,b.alg_name from basedata_alg_subtype a
|
|
|
left join basedata_alg b on a.alg_id=b.alg_id
|
|
|
<where>
|
|
|
<if test="algId != null and algId != ''">and a.alg_subtype_id in
|
|
|
<foreach item="algIda" collection="algId" open="(" separator="," close=")">
|
|
|
#{algIda}
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
order by a.alg_subtype_id
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="queryPatrolResultByPointID" resultMap="PatrolResultResult">
|
|
|
select *
|
|
|
from patrol_result
|
|
|
where device_id = #{deviceId}
|
|
|
and time between #{startTime}
|
|
|
and #{endTime}
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<resultMap type="PatrolPresetPosModule" id="PatrolPresetPosResult">
|
|
|
<result property="presetPosId" column="preset_pos_id"/>
|
|
|
<result property="presetPosCode" column="preset_pos_code"/>
|
|
|
<result property="presetPosName" column="preset_pos_name"/>
|
|
|
<result property="eqpBookId" column="eqp_book_id"/>
|
|
|
<result property="patrolDeviceCode" column="patrol_device_code"/>
|
|
|
<result property="patrolPointId" column="patrol_point_id"/>
|
|
|
<result property="channelId" column="channel_id"/>
|
|
|
<result property="channelCode" column="channel_code"/>
|
|
|
<result property="channelType" column="channel_type"/>
|
|
|
<result property="coordinateType" column="coordinate_type"/>
|
|
|
<result property="stopTime" column="stop_time"/>
|
|
|
<result property="channelImg" column="channel_img"/>
|
|
|
<result property="description" column="description"/>
|
|
|
<result property="algSubtypeCode" column="alg_subtype_code"/>
|
|
|
<result property="isEnable" column="is_enable"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
<result property="algName" column="alg_name"/>
|
|
|
</resultMap>
|
|
|
<select id="selectAlgorithmTypeList" parameterType="String" resultMap="PatrolPresetPosResult">
|
|
|
select a.alg_subtype_code, c.alg_name
|
|
|
from patrol_preset_pos a
|
|
|
left join basedata_alg_subtype b on a.alg_subtype_code = b.alg_subtype_code
|
|
|
INNER join basedata_alg c on b.alg_id = c.alg_id
|
|
|
where a.patrol_point_id = #{lineId}
|
|
|
and a.alg_subtype_code is not null
|
|
|
</select>
|
|
|
<select id="selectAlgorithmType" parameterType="String" resultType="java.util.Map">
|
|
|
select b.alg_subtype_code, c.alg_name, a.alg_subtype_ids
|
|
|
from basedata_patrolpoint a
|
|
|
left join basedata_alg_subtype b on a.alg_subtype_ids = b.alg_subtype_id
|
|
|
left join basedata_alg c on b.alg_id = c.alg_id
|
|
|
where a.patrol_point_id = #{lineId} OR a.patrol_point_code LIKE concat('%',#{lineId})
|
|
|
</select>
|
|
|
<select id="selectAlgorithmInfo" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_alg_subtype b
|
|
|
INNER join basedata_alg c on b.alg_id = c.alg_id
|
|
|
|
|
|
where b.alg_subtype_code = #{code}
|
|
|
</select>
|
|
|
<select id="selectThresholdByPointId" parameterType="String" resultType="java.util.Map">
|
|
|
select a.*, b.alarm_threshold
|
|
|
from basedata_patrolpoint a
|
|
|
LEFT JOIN basedata_stdpatrol_point b on a.std_parol_point_id = b.std_patrol_point_id
|
|
|
where a.patrol_point_id = #{lineId}
|
|
|
</select>
|
|
|
<select id="selectAlgTypeDataType" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from sys_dict_data
|
|
|
where dict_type = 'defect_type'
|
|
|
and dict_value = #{type}
|
|
|
and remark is not null
|
|
|
</select>
|
|
|
<select id="selectAlgTypeByCode" parameterType="String" resultType="java.util.Map">
|
|
|
select a.*
|
|
|
from basedata_alg a
|
|
|
INNER JOIN basedata_alg_subtype b on a.alg_id = b.alg_id
|
|
|
where b.alg_subtype_code = #{algcode} limit 1
|
|
|
</select>
|
|
|
<select id="selectBasedataStation" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_station a
|
|
|
</select>
|
|
|
<select id="selectEvnData" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_mont_evndata a
|
|
|
INNER JOIN basedata_eqpbook b on a.eqp_book_id = b.eqp_book_id
|
|
|
where b.patrol_device_code = #{code}
|
|
|
</select>
|
|
|
<select id="selectDevInfoById" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_device a
|
|
|
where a.device_id = #{deviceId}
|
|
|
</select>
|
|
|
<select id="selectAreaByAudit" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_area a
|
|
|
where a.area_id = #{areaId}
|
|
|
and a.area_type = 'bayunit'
|
|
|
</select>
|
|
|
<select id="selectAreaInfo" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_area a
|
|
|
where a.area_id = #{areaId}
|
|
|
</select>
|
|
|
<select id="selectAreaInfoByParentId" parameterType="String" resultType="java.util.Map">
|
|
|
select *
|
|
|
from basedata_area a
|
|
|
where a.parent_id = #{parentId}
|
|
|
</select>
|
|
|
<select id="selectPatrolResultByLineId" parameterType="Long" resultMap="PatrolResultResult">
|
|
|
<include refid="selectPatrolResultVo"/>
|
|
|
where line_id = #{lineId}
|
|
|
</select>
|
|
|
<resultMap type="PatrolResultRef" id="PatrolResultRef">
|
|
|
<result property="lineId" column="line_id"/>
|
|
|
<result property="deviceId" column="device_id"/>
|
|
|
<result property="devType" column="dev_type"/>
|
|
|
<result property="time" column="time"/>
|
|
|
<result property="value" column="value"/>
|
|
|
<result property="threshold" column="threshold"/>
|
|
|
<result property="filePath" column="file_path"/>
|
|
|
<result property="description" column="description"/>
|
|
|
<result property="pointStatus" column="point_status"/>
|
|
|
<result property="valueUnit" column="value_unit"/>
|
|
|
<result property="resultContent" column="result_content"/>
|
|
|
</resultMap>
|
|
|
<select id="selectResultRefByLineId" parameterType="String" resultMap="PatrolResultRef">
|
|
|
select a.line_id,
|
|
|
a.device_id,
|
|
|
c.dev_type,
|
|
|
a.time,
|
|
|
a.value,
|
|
|
a.threshold,
|
|
|
a.file_path,
|
|
|
b.description,
|
|
|
b.point_status,
|
|
|
a.value_unit,
|
|
|
b.result_content
|
|
|
from patrol_result a
|
|
|
left join result_analysis b on a.line_id = b.business_id
|
|
|
left join patrol_task_info c on a.task_code = c.task_major_id
|
|
|
and a.device_id = c.device_id
|
|
|
and a.patrol_device_code = c.dev_no
|
|
|
where a.main_id = #{mainId}
|
|
|
</select>
|
|
|
<select id="selectBaseInfoByPointId" parameterType="String" resultType="java.util.Map">
|
|
|
select a.patrol_point_name, b.device_name, c.device_name as main_name, d.area_name as jg_name, e.area_name
|
|
|
from basedata_patrolpoint a
|
|
|
left JOIN basedata_device b on a.device_id = b.device_id and b.power_main_equ_flag = "no"
|
|
|
left JOIN basedata_device c on b.parent_id = c.device_id
|
|
|
LEFT JOIN basedata_area d on c.area_id = d.area_id and d.area_type = 'bayunit'
|
|
|
LEFT JOIN basedata_area e on c.area_id = e.area_id
|
|
|
where a.patrol_point_id = #{lineId}
|
|
|
</select>
|
|
|
|
|
|
<resultMap type="BasePointAreaInfo" id="BasePointAreaInfo">
|
|
|
<result property="patrolPointId" column="patrol_point_id"/>
|
|
|
<result property="patrolPointName" column="patrol_point_name"/>
|
|
|
<result property="deviceName" column="device_name"/>
|
|
|
<result property="mainName" column="main_name"/>
|
|
|
<result property="jgName" column="jg_name"/>
|
|
|
<result property="areaName" column="area_name"/>
|
|
|
</resultMap>
|
|
|
<select id="selectBaseInfoByMainId" parameterType="String" resultMap="BasePointAreaInfo">
|
|
|
select a.patrol_point_id,
|
|
|
a.patrol_point_name,
|
|
|
b.device_name,
|
|
|
c.device_name as main_name,
|
|
|
d.area_name as jg_name,
|
|
|
e.area_name
|
|
|
from patrol_result f
|
|
|
left join basedata_patrolpoint a on f.device_id = a.patrol_point_id
|
|
|
left join basedata_device b on a.device_id = b.device_id and b.power_main_equ_flag = "no"
|
|
|
left join basedata_device c on b.parent_id = c.device_id
|
|
|
left join basedata_area d on c.area_id = d.area_id and d.area_type = 'bayunit'
|
|
|
left join basedata_area e on c.area_id = e.area_id
|
|
|
where f.main_id = #{mainId}
|
|
|
</select>
|
|
|
<select id="selectAlgTypeByAlaName" parameterType="String" resultType="java.util.Map">
|
|
|
select a.*
|
|
|
from basedata_alg a
|
|
|
INNER JOIN basedata_alg_subtype b on a.alg_id = b.alg_id
|
|
|
where b.alg_subtype_code = #{type}
|
|
|
</select>
|
|
|
<select id="selectBaseByPointId" parameterType="String" resultType="java.util.Map">
|
|
|
select a.patrol_point_name, b.device_id, c.device_id as bujianId
|
|
|
from basedata_patrolpoint a
|
|
|
left JOIN basedata_device b on a.device_id = b.device_id and b.power_main_equ_flag = "no"
|
|
|
left JOIN basedata_device c on c.device_id = b.parent_id
|
|
|
|
|
|
where a.patrol_point_id = #{lineId}
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertPatrolResult" parameterType="PatrolResult" useGeneratedKeys="true" keyProperty="lineId">
|
|
|
insert into patrol_result
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="patrolDeviceName != null">patrol_device_name,</if>
|
|
|
<if test="patrolDeviceCode != null">patrol_device_code,</if>
|
|
|
<if test="taskName != null">task_name,</if>
|
|
|
<if test="taskCode != null">task_code,</if>
|
|
|
<if test="deviceName != null">device_name,</if>
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
<if test="valueType != null">value_type,</if>
|
|
|
<if test="value != null">value,</if>
|
|
|
<if test="valueUnit != null">value_unit,</if>
|
|
|
<if test="unit != null">unit,</if>
|
|
|
<if test="time != null">time,</if>
|
|
|
<if test="recognitionType != null">recognition_type,</if>
|
|
|
<if test="fileType != null">file_type,</if>
|
|
|
<if test="filePath != null">file_path,</if>
|
|
|
<if test="rectangle != null">rectangle,</if>
|
|
|
<if test="taskPatrolledId != null">task_patrolled_id,</if>
|
|
|
<if test="valid != null">valid,</if>
|
|
|
<if test="patrolStatus != null">patrol_status,</if>
|
|
|
<if test="checkPerson != null">check_person,</if>
|
|
|
<if test="checkTime != null">check_time,</if>
|
|
|
<if test="checkResult != null">check_result,</if>
|
|
|
<if test="materialId != null">material_id,</if>
|
|
|
<if test="dataType != null">data_type,</if>
|
|
|
<if test="threshold != null">threshold,</if>
|
|
|
<if test="taskId != null">task_id,</if>
|
|
|
<if test="mainId != null">main_id,</if>
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="patrolDeviceName != null">#{patrolDeviceName},</if>
|
|
|
<if test="patrolDeviceCode != null">#{patrolDeviceCode},</if>
|
|
|
<if test="taskName != null">#{taskName},</if>
|
|
|
<if test="taskCode != null">#{taskCode},</if>
|
|
|
<if test="deviceName != null">#{deviceName},</if>
|
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
|
<if test="valueType != null">#{valueType},</if>
|
|
|
<if test="value != null">#{value},</if>
|
|
|
<if test="valueUnit != null">#{valueUnit},</if>
|
|
|
<if test="unit != null">#{unit},</if>
|
|
|
<if test="time != null">#{time},</if>
|
|
|
<if test="recognitionType != null">#{recognitionType},</if>
|
|
|
<if test="fileType != null">#{fileType},</if>
|
|
|
<if test="filePath != null">#{filePath},</if>
|
|
|
<if test="rectangle != null">#{rectangle},</if>
|
|
|
<if test="taskPatrolledId != null">#{taskPatrolledId},</if>
|
|
|
<if test="valid != null">#{valid},</if>
|
|
|
<if test="patrolStatus != null">#{patrolStatus},</if>
|
|
|
<if test="checkPerson != null">#{checkPerson},</if>
|
|
|
<if test="checkTime != null">#{checkTime},</if>
|
|
|
<if test="checkResult != null">#{checkResult},</if>
|
|
|
<if test="materialId != null">#{materialId},</if>
|
|
|
<if test="dataType != null">#{dataType},</if>
|
|
|
<if test="threshold != null">#{threshold},</if>
|
|
|
<if test="taskId != null">#{taskId},</if>
|
|
|
<if test="mainId != null">#{mainId},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updatePatrolResult" parameterType="PatrolResult">
|
|
|
update patrol_result
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="patrolDeviceName != null">patrol_device_name = #{patrolDeviceName},</if>
|
|
|
<if test="patrolDeviceCode != null">patrol_device_code = #{patrolDeviceCode},</if>
|
|
|
<if test="taskName != null">task_name = #{taskName},</if>
|
|
|
<if test="taskCode != null">task_code = #{taskCode},</if>
|
|
|
<if test="deviceName != null">device_name = #{deviceName},</if>
|
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
|
<if test="valueType != null">value_type = #{valueType},</if>
|
|
|
<if test="value != null">value = #{value},</if>
|
|
|
<if test="valueUnit != null">value_unit = #{valueUnit},</if>
|
|
|
<if test="unit != null">unit = #{unit},</if>
|
|
|
<if test="time != null">time = #{time},</if>
|
|
|
<if test="recognitionType != null">recognition_type = #{recognitionType},</if>
|
|
|
<if test="fileType != null">file_type = #{fileType},</if>
|
|
|
<if test="filePath != null">file_path = #{filePath},</if>
|
|
|
<if test="rectangle != null">rectangle = #{rectangle},</if>
|
|
|
<if test="taskPatrolledId != null">task_patrolled_id = #{taskPatrolledId},</if>
|
|
|
<if test="valid != null">valid = #{valid},</if>
|
|
|
<if test="patrolStatus != null">patrol_status = #{patrolStatus},</if>
|
|
|
<if test="checkPerson != null">check_person = #{checkPerson},</if>
|
|
|
<if test="checkTime != null">check_time = #{checkTime},</if>
|
|
|
<if test="checkResult != null">check_result = #{checkResult},</if>
|
|
|
<if test="materialId != null">material_id = #{materialId},</if>
|
|
|
<if test="dataType != null">data_type = #{dataType},</if>
|
|
|
<if test="threshold != null">threshold = #{threshold},</if>
|
|
|
<if test="taskId != null">task_id = #{taskId},</if>
|
|
|
<if test="mainId != null">main_id = #{mainId},</if>
|
|
|
</trim>
|
|
|
where line_id = #{lineId}
|
|
|
</update>
|
|
|
|
|
|
<update id="updatePatrolResultByMainId" parameterType="String">
|
|
|
update patrol_result
|
|
|
set patrol_status = '1'
|
|
|
where main_id = #{mainId}
|
|
|
</update>
|
|
|
<delete id="deletePatrolResultByLineId" parameterType="Long">
|
|
|
delete
|
|
|
from patrol_result
|
|
|
where line_id = #{lineId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deletePatrolResultByLineIds" parameterType="String">
|
|
|
delete from patrol_result where line_id in
|
|
|
<foreach item="lineId" collection="array" open="(" separator="," close=")">
|
|
|
#{lineId}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
<update id="updatePatrolResultValue" parameterType="PatrolResult">
|
|
|
update patrol_result
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="value != null and value != ''">value = #{value},</if>
|
|
|
</trim>
|
|
|
where line_id = #{lineId}
|
|
|
</update>
|
|
|
<resultMap type="ResultValue" id="ResultValue">
|
|
|
<result property="areaName" column="area_name"/>
|
|
|
<result property="deviceName" column="device_name"/>
|
|
|
<result property="patrolDeviceName" column="patrol_device_name"/>
|
|
|
<result property="patrolPointName" column="patrol_point_name"/>
|
|
|
<result property="value" column="value"/>
|
|
|
<result property="lineId" column="line_id"/>
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
</resultMap>
|
|
|
<select id="selectOilResultValue" parameterType="PatrolResult" resultMap="ResultValue">
|
|
|
|
|
|
SELECT
|
|
|
a.patrol_point_id,
|
|
|
d.area_name,
|
|
|
d.patrol_device_name,
|
|
|
f.patrol_point_name,
|
|
|
CASE
|
|
|
WHEN e.`value` = 'check image' THEN
|
|
|
'0' ELSE e.`value`
|
|
|
END `value`,
|
|
|
h.dict_value line_id,
|
|
|
e.create_time,
|
|
|
a.channel_code
|
|
|
FROM
|
|
|
patrol_preset_pos a
|
|
|
LEFT JOIN patrol_result e ON a.patrol_point_id = e.device_id
|
|
|
RIGHT JOIN (
|
|
|
SELECT
|
|
|
MAX( h.line_id ) line_id
|
|
|
FROM
|
|
|
patrol_result h
|
|
|
<where>
|
|
|
<if test="createTime != null ">
|
|
|
DATE_FORMAT( h.create_time, '%y%m%d' ) = DATE_FORMAT( #{createTime}, '%y%m%d' )
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
h.device_id
|
|
|
) i ON e.line_id = i.line_id
|
|
|
RIGHT JOIN ( SELECT g.dict_value, g.dict_label FROM sys_dict_data g WHERE g.dict_type = 'oil_api' ) h ON
|
|
|
h.dict_label = a.patrol_point_id
|
|
|
LEFT JOIN basedata_eqpbook d ON a.eqp_book_id = d.eqp_book_id
|
|
|
LEFT JOIN basedata_patrolpoint f ON a.patrol_point_id = f.patrol_point_id
|
|
|
ORDER BY
|
|
|
d.area_name,
|
|
|
d.patrol_device_name
|
|
|
|
|
|
</select>
|
|
|
<select id="select6FsResultValue" parameterType="PatrolResult" resultMap="ResultValue">
|
|
|
|
|
|
SELECT
|
|
|
a.patrol_point_id,
|
|
|
d.area_name,
|
|
|
d.patrol_device_name,
|
|
|
f.patrol_point_name,
|
|
|
CASE
|
|
|
WHEN e.`value` = 'check image' THEN
|
|
|
'0' ELSE e.`value`
|
|
|
END `value`,
|
|
|
h.dict_value line_id,
|
|
|
e.create_time,
|
|
|
a.channel_code
|
|
|
FROM
|
|
|
patrol_preset_pos a
|
|
|
LEFT JOIN patrol_result e ON a.patrol_point_id = e.device_id
|
|
|
RIGHT JOIN (
|
|
|
SELECT
|
|
|
MAX( h.line_id ) line_id
|
|
|
FROM
|
|
|
patrol_result h
|
|
|
<where>
|
|
|
<if test="createTime != null ">
|
|
|
DATE_FORMAT( h.create_time, '%y%m%d' ) = DATE_FORMAT( #{createTime}, '%y%m%d' )
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
h.device_id
|
|
|
) i ON e.line_id = i.line_id
|
|
|
RIGHT JOIN ( SELECT g.dict_value, g.dict_label FROM sys_dict_data g WHERE g.dict_type = 'sf6_api' ) h ON
|
|
|
h.dict_label = a.patrol_point_id
|
|
|
LEFT JOIN basedata_eqpbook d ON a.eqp_book_id = d.eqp_book_id
|
|
|
LEFT JOIN basedata_patrolpoint f ON a.patrol_point_id = f.patrol_point_id
|
|
|
ORDER BY
|
|
|
d.area_name,
|
|
|
d.patrol_device_name
|
|
|
|
|
|
</select>
|
|
|
<select id="queryNumTypeResult" resultMap="PatrolResultResult">
|
|
|
select *
|
|
|
from patrol_result
|
|
|
where device_id = #{deviceId}
|
|
|
order by create_time desc
|
|
|
limit #{num}
|
|
|
|
|
|
</select>
|
|
|
<select id="queryDiffTimeResult" resultMap="PatrolResultResult">
|
|
|
select *
|
|
|
from patrol_result
|
|
|
where create_time between date_sub(now(), interval #{time} minute) and now()
|
|
|
and task_code = #{taskCode}
|
|
|
and value is not null
|
|
|
and value != ''
|
|
|
order by value *1 desc
|
|
|
-- 注释:这个*1的写法 是将字符串的数字转为数值排序
|
|
|
</select>
|
|
|
|
|
|
<sql id="selectStatisticsTaskConfigVo">
|
|
|
select id, type, task_code, threshold, msg
|
|
|
from statistics_task_config
|
|
|
</sql>
|
|
|
<resultMap type="com.inspect.statistics.domain.TaskStatisticsConfig" id="StatisticsTaskConfigResult">
|
|
|
<result property="id" column="id"/>
|
|
|
<result property="type" column="type"/>
|
|
|
<result property="taskCode" column="task_code"/>
|
|
|
<result property="threshold" column="threshold"/>
|
|
|
<result property="msg" column="msg"/>
|
|
|
</resultMap>
|
|
|
<select id="selectStatisticsTaskConfigList" parameterType="java.lang.String" resultMap="StatisticsTaskConfigResult">
|
|
|
<include refid="selectStatisticsTaskConfigVo"/>
|
|
|
where task_code = #{taskCode,jdbcType=VARCHAR}
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="queryTaskDeviceNum" parameterType="java.lang.String" resultType="java.lang.Integer">
|
|
|
select count(1) deviceNum
|
|
|
from patrol_task_info info
|
|
|
left join patrol_task task
|
|
|
on task.task_id = info.task_major_id
|
|
|
where task.task_code = #{taskCode}
|
|
|
</select>
|
|
|
<select id="queryOneTaskResult" parameterType="com.inspect.partrolresult.domain.PatrolResult"
|
|
|
resultMap="PatrolResultResult">
|
|
|
select *
|
|
|
from patrol_result
|
|
|
where task_code = #{taskCode}
|
|
|
and to_days(create_time) = to_days(#{createTime})
|
|
|
</select>
|
|
|
</mapper>
|