Newer
Older
huludao / src / main / resources / mapper / CameraResourceMapper.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.dao.CameraResourceMapper">

    <update id="updateIsTop" parameterType="integer">
        update camera_resource set is_top = CASE is_top WHEN 0 THEN 1 ELSE 0 END WHERE id = #{id}
    </update>

    <update id="updateIsShow" parameterType="integer">
        update camera_resource set is_show = CASE is_show WHEN 0 THEN 1 ELSE 0 END WHERE id = #{id}
    </update>

    <resultMap id="oneMapInteraction" type="com.newfiber.api.pc.model.vo.OneMapInteraction">
        <result property="soleNumber" column="sole_number"/>
        <result property="soleName" column="sole_name"/>
        <result property="lon" column="lon"/>
        <result property="lat" column="lat"/>
        <result property="status" column="status"/>

    </resultMap>


    <select  id="getCameraCode" parameterType="string" resultType="string">
	SELECT index_code FROM `camera_resource` cr
    inner join camera_site_relevance csr on cr.index_code = csr.camera_code
    where csr.site_no = #{siteNo}
	</select>

    <update id="configIsHighSpot" parameterType="integer">
        update camera_resource set is_high_spot = CASE is_high_spot WHEN 0 THEN 1 ELSE 0 END WHERE id = #{id}
    </update>


    <select id="queryCameraStat" resultType="com.newfiber.api.pc.model.entity.CameraStat">
        select count(*) as total,(
            select count(1) from camera_resource where `status` = 0
            ) as noOnlineCOunt
        from camera_resource


    </select>


    <select id="queryRegionCount" resultType="com.newfiber.api.pc.model.vo.CameraRegionCountVo">
        select count(1) as regionCount,region_index_code as regionCode,`status`
        from camera_resource
        GROUP BY region_index_code,`status`
    </select>

    <select id="getCameraData" resultType="java.util.HashMap">
        select index_code as indexCode,`name` from camera_resource
        where region_index_code = #{indexCode}
    </select>

    <select id="selectCamreaData" resultMap="oneMapInteraction">
        select cr.index_code as sole_number,cr.`name` as sole_name,cr.x as lon,cr.y as lat,cr.`status` as status from camera_resource cr inner join (select region_index_code from region_station where parent_index_code = '634562b6-9fd5-49b4-b7b2-59f20a742603') rs on cr.region_index_code = rs.region_index_code
    </select>

    <select id="selectState" resultType="int">
        select count(id) from camera_resource
        where status =1
        and index_code in
        <foreach collection="indexCodes" index="index" item="item"
                 open="("  separator="," close=")">
            #{item}
        </foreach>
    </select>

</mapper>