Newer
Older
huludao / src / main / resources / mapper / CameraInfoDao.xml
<?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.newfiber.api.pc.camera.dao.CameraInfoDao">
    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.newfiber.api.pc.camera.dto.CameraInfo" id="cameraInfoMap" >
        <result property="id" column="id"/>
        <result property="deviceCode" column="device_code"/>
        <result property="deviceName" column="device_name"/>
        <result property="siteId" column="site_id"/>
        <result property="channelId" column="channel_id"/>
        <result property="streamId" column="stream_id"/>
        <result property="statusOnline" column="status_online"/>
        <result property="cameraType" column="camera_type"/>
<!--        <result property="siteName" column="site_name"/>-->
<!--        <result property="pointx" column="pointx"/>-->
<!--        <result property="pointy" column="pointy"/>-->
    </resultMap>
<!--    <resultMap type="com.newfiber.baishigang.main.project.camera.dto.CameraInfo" id="BasecameraInfoMap" >-->
<!--        <result property="id" column="id"/>-->
<!--        <result property="deviceCode" column="device_code"/>-->
<!--        <result property="deviceName" column="device_name"/>-->
<!--        <result property="siteId" column="site_id"/>-->
<!--        <result property="channelId" column="channel_id"/>-->
<!--        <result property="streamId" column="stream_id"/>-->
<!--        <result property="statusOnline" column="status_online"/>-->
<!--    </resultMap>-->

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">


                            c.id as id,
                            device_code as deviceCode,
                            device_name as deviceName,
                            site_id as siteId,
                            channel_id as channelId,
                            stream_id as streamId,
                            status_online as statusOnline,
                            s.site_name as siteName,
                            s.pointx as pointx,
                            s.pointy as pointy,
                            camera_type as cameraType


    </sql>

    <!-- 获取摄像头表列表   left join site_info s
        on  s.id=c.site_id     <include refid="Base_Column_List"/>-->
    <select id="queryList" resultType="com.newfiber.api.pc.camera.dto.CameraInfo">
        select
        *
        from camera_info c
        <where>
            c.del_flag = 0
            <if test="deviceName != null">
                and c.device_name like concat('%',#{deviceName},'%')
            </if>
        </where>
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
            <otherwise>
                order by id desc
            </otherwise>
        </choose>
    </select>
</mapper>