<?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.ard.work.point.well.mapper.ArdWellGuideCameraMapper">
|
|
<resultMap type="ArdWellGuideCamera" id="ArdWellGuideCameraResult">
|
<result property="id" column="id"/>
|
<result property="cameraId" column="camera_id"/>
|
<result property="chanNo" column="chan_no"/>
|
<result property="p" column="p"/>
|
<result property="t" column="t"/>
|
<result property="z" column="z"/>
|
<result property="wellId" column="well_id"/>
|
<result property="cameraName" column="camera_name"/>
|
<result property="chanName" column="chan_name"/>
|
</resultMap>
|
|
<sql id="selectArdWellGuideCameraVo">
|
SELECT
|
a.id,
|
a.camera_id,
|
a.chan_no,
|
a.p,
|
a.t,
|
a.z,
|
a.well_id,
|
b.name as camera_name,
|
c.name as chan_name
|
FROM
|
ard_well_guide_camera a
|
LEFT JOIN ard_camera b ON a.camera_id = b.id COLLATE utf8mb4_general_ci
|
LEFT JOIN ard_channel c ON a.camera_id = c.device_id COLLATE utf8mb4_general_ci
|
AND a.chan_no = c.chan_no COLLATE utf8mb4_general_ci
|
</sql>
|
|
<select id="selectArdWellGuideCameraList" parameterType="ArdWellGuideCamera" resultMap="ArdWellGuideCameraResult">
|
<include refid="selectArdWellGuideCameraVo"/>
|
<where>
|
<if test="cameraId != null and cameraId != ''">and a.camera_id = #{cameraId}</if>
|
<if test="chanNo != null and chanNo != ''">and a.chan_no = #{chanNo}</if>
|
<if test="p != null ">and a.p = #{p}</if>
|
<if test="t != null ">and a.t = #{t}</if>
|
<if test="z != null ">and a.z = #{z}</if>
|
<if test="wellId != null and wellId != ''">and a.well_id = #{wellId}</if>
|
</where>
|
</select>
|
|
<select id="selectArdWellGuideCameraById" parameterType="String" resultMap="ArdWellGuideCameraResult">
|
<include refid="selectArdWellGuideCameraVo"/>
|
where a.id = #{id}
|
</select>
|
|
<insert id="insertArdWellGuideCamera" parameterType="ArdWellGuideCamera">
|
insert into ard_well_guide_camera
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="cameraId != null">camera_id,</if>
|
<if test="chanNo != null">chan_no,</if>
|
<if test="p != null">p,</if>
|
<if test="t != null">t,</if>
|
<if test="z != null">z,</if>
|
<if test="wellId != null">well_id,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="cameraId != null">#{cameraId},</if>
|
<if test="chanNo != null">#{chanNo},</if>
|
<if test="p != null">#{p},</if>
|
<if test="t != null">#{t},</if>
|
<if test="z != null">#{z},</if>
|
<if test="wellId != null">#{wellId},</if>
|
</trim>
|
</insert>
|
|
<update id="updateArdWellGuideCamera" parameterType="ArdWellGuideCamera">
|
update ard_well_guide_camera
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="cameraId != null">camera_id = #{cameraId},</if>
|
<if test="chanNo != null">chan_no = #{chanNo},</if>
|
<if test="p != null">p = #{p},</if>
|
<if test="t != null">t = #{t},</if>
|
<if test="z != null">z = #{z},</if>
|
<if test="wellId != null">well_id = #{wellId},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteArdWellGuideCameraById" parameterType="String">
|
delete
|
from ard_well_guide_camera
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteArdWellGuideCameraByIds" parameterType="String">
|
delete from ard_well_guide_camera where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="checkGuideCameraUnique" resultMap="ArdWellGuideCameraResult">
|
select *
|
from ard_well_guide_camera
|
where camera_id = #{cameraId}
|
and chan_no = #{chanNo}
|
and well_id = #{wellId} limit 1
|
</select>
|
</mapper>
|