| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?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.AcDevInfoDao">
-
- <select id="getAcDevListByVO" resultType="AcDevInfoDTO">
- select
- a.id,
- a.acAddress,
- a.deviceName,
- a.type,
- a.networkIP,
- a.createtime as createTime,
- s.name as section
- <choose>
- <when test="version == 0">
- ,gl.chinese_name as area
- </when>
- <when test="version == 1">
- ,gl.english_name as area
- </when>
- <otherwise>
- ,gl.ru_name as area
- </otherwise>
- </choose>
- from ac_dev_info a
- left join section s on a.sectionid = s.id
- left join global_location gl on s.pid = gl.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="areaId != null and areaId != 0">
- and a.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and a.sectionid = #{sectionId}
- </if>
- <if test="keyword != null and keyword != ''">
- and (a.deviceName like '%${keyword}%' or a.acAddress like '%${keyword}%')
- </if>
- order by a.updatetime desc
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getAcDevTotal" resultType="Integer">
- select
- count(*)
- from ac_dev_info a
- left join section s on a.sectionid = s.id
- left join global_location gl on s.pid = gl.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and a.sectionid in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="areaId != null and areaId != 0">
- and a.areaid = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and a.sectionid = #{sectionId}
- </if>
- </select>
- <delete id="deleteAcDevData">
- delete
- from ac_dev_info
- where id in
- <foreach collection="ids" item="item" open="(" separator="," close=")">
- #{ids}
- </foreach>
- </delete>
- <insert id="addAcDevData" parameterType="AcDevInfoDTO" useGeneratedKeys="true" keyProperty="id">
- insert into ac_dev_info(deviceName,
- acAddress,
- type,
- <if test="networkIP != null and networkIP != ''">
- networkIP,
- </if>
- areaid,
- sectionid,
- latitude,
- longitude,
- createtime,
- updatetime)
- values (#{deviceName},
- #{acAddress},
- #{type},
- <if test="networkIP != null and networkIP != ''">
- #{networkIP},
- </if>
- #{areaId},
- #{sectionId},
- #{latitude},
- #{longitude},
- #{createTime},
- #{updateTime})
- </insert>
- <update id="updateAcDevData" parameterType="AcDevInfoDTO">
- update
- ac_dev_info a
- set
- a.deviceName = #{deviceName},
- a.acAddress = #{acAddress},
- a.type = #{type},
- <if test="networkIP != null and networkIP != ''">
- a.networkIP = #{networkIP},
- </if>
- a.areaid = #{areaId},
- a.sectionid = #{sectionId},
- a.longitude = #{longitude},
- a.latitude = #{latitude},
- a.updatetime = #{updateTime}
- where
- a.id = #{id}
- </update>
- <select id="checkAcDevData" resultType="Integer">
- select
- count(*)
- from ac_dev_info a
- where 1=1
- <if test="sectionId != null and sectionId != 0">
- and a.sectionid = #{sectionId}
- </if>
- <if test="deviceName != null and deviceName != ''">
- and a.deviceName = #{deviceName}
- </if>
- <if test="acAddress != null and acAddress != ''">
- and a.acAddress = #{acAddress}
- </if>
- <if test="id != null and id != ''">
- and a.id != #{id}
- </if>
- </select>
- <select id="getOneById" parameterType="Integer" resultType="AcDevInfoDTO">
- select id,acAddress,type,networkIP,access_token as accessToken,refresh_token as refreshToken,updatetime as updateTime
- from ac_dev_info where id = #{id}
- </select>
- <update id="updateByAcDevData" parameterType="AcDevInfoDTO">
- update
- ac_dev_info
- set
- access_token = #{accessToken},refresh_token = #{refreshToken},updatetime = #{updateTime}
- where
- id = #{id}
- </update>
- </mapper>
|