| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 | <?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.welampiot.dao.TranshInfoDao">    <select id="getTotalBySectionList" resultType="Integer">        select count(t.id) as total from transh_info t        <if test="sectionList != null and !sectionList.isEmpty()">            where t.sectionid in            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                #{dto}            </foreach>        </if>    </select>    <select id="getOnlineTotalBySectionList" resultType="Integer">        select count(t.id) as onlineTotal from transh_info t        where t.online = 1        <if test="sectionList != null and !sectionList.isEmpty()">            and t.sectionid in            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                #{dto}            </foreach>        </if>    </select>    <select id="getAlarmTotalBySectionList" resultType="Integer">        select count(t.id) as alarmTotal from transh_info t        where t.online = 1 and (t.full = 1 or t.state = 1)        <if test="sectionList != null and !sectionList.isEmpty()">            and t.sectionid in            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                #{dto}            </foreach>        </if>    </select>    <select id="getNormalTotalBySectionList" resultType="Integer">        select count(t.id) as normalTotal from transh_info t        where t.full = 0 and t.state = 0 and t.online = 1        <if test="sectionList != null and !sectionList.isEmpty()">            and t.sectionid in            <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                #{dto}            </foreach>        </if>    </select>    <select id="getTranshListByDTO" resultType="TranshInfoDTO">        select t.id,t.name,t.areaid as areaId,t.sectionid as sectionId,t.address,               t.online,t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.state,t.angle,               t.longitude,t.latitude,t.batt as batT,t.temperature,t.updateTime,               t.createTime,t.full,t.deviceId,s.name as section,               g.english_name englishName,g.ru_name ruName,g.chinese_name chineseName,               p.chinese_name as chCity,p.english_name as enCity,p.ru_name as ruCity,s.timezone        from transh_info t left join section s on t.sectionid = s.id            left join global_location g on t.areaid = g.id            left join global_location p on g.pid = p.id        where 1=1 <if test="sectionList != null and !sectionList.isEmpty()">                    and t.sectionid in                    <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                        #{dto}                    </foreach>            </if>            <if test="keywords != null and keywords != ''">                and (t.name like '%${keywords}%' or t.address like '%${keywords}%')            </if>            order by convert(t.name using gbk) asc,t.id desc            <if test="page >= 0 and count > 0">                limit #{page},#{count}            </if>    </select>    <select id="getHistoryListByDTO" resultType="TranshInfoDTO">        select t.rssi,t.rsrp as rsRp,t.snr,t.distance,t.angle,t.state,t.batt as batT,               t.temperature,t.online,t.full,t.updateTime,s.timezone        from transh_info t left join section s on t.sectionid = s.id        where t.id = #{id}            <if test="sectionList != null and !sectionList.isEmpty()">                and t.sectionid in                <foreach collection="sectionList" item="dto" open="(" separator="," close=")">                    #{dto}                </foreach>            </if>            <if test="page >= 0 and count > 0">                limit #{page},#{count}            </if>    </select>    <select id="findByDTO" resultType="Integer">        select count(*)        from transh_info t        where 1=1            <if test="sectionId != null">                and t.sectionid = #{sectionId}            </if>            <if test="name != null">                and t.name = #{name}            </if>            <if test="address != null">                and t.address = #{address}            </if>    </select>    <select id="checkDataByDTO" resultType="Integer" parameterType="com.welampiot.dto.TranshInfoDTO">        select count(*) from transh_info t        where 1=1            <if test="sectionId != null">                and t.sectionid = #{sectionId}            </if>            <if test="name != null">                and t.name = #{name}            </if>            <if test="address != null">                and t.address = #{address}            </if>            <if test="id != null">                and t.id != #{id}            </if>        limit 1    </select>    <insert id="addTranshDataByDTO" parameterType="com.welampiot.dto.TranshInfoDTO" useGeneratedKeys="true" keyProperty="id">        insert into transh_info(areaid, sectionid, address, name, longitude, latitude)        values            (#{areaId}, #{sectionId}, #{address}, #{name}, #{longitude}, #{latitude})    </insert>    <update id="updateTranshDataByTranshId" parameterType="com.welampiot.dto.TranshInfoDTO">        update transh_info        set            areaid = #{areaId},            sectionid = #{sectionId},            name = #{name},            address = #{address},            longitude = #{longitude},            latitude = #{latitude}        where id = #{id}    </update>    <delete id="deleteTrashDevById">        delete from transh_info where id = #{id}    </delete>    <delete id="deleteTrashDevLogById">        delete from transh_info_log where transh_id = #{id}    </delete></mapper>
 |