|
|
@@ -1,203 +1,107 @@
|
|
|
<?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">
|
|
|
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.yunfeiyun.agmp.iotm.device.mapper.IotDeviceMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="IotDevice" id="IotDeviceResult">
|
|
|
- <result property="id" column="id"/>
|
|
|
- <result property="devBid" column="devBid"/>
|
|
|
- <result property="cId" column="cId"/>
|
|
|
- <result property="devtypeBid" column="devtypeBid"/>
|
|
|
- <result property="firmBid" column="firmBid"/>
|
|
|
- <result property="devCode" column="devCode"/>
|
|
|
- <result property="devVersion" column="devVersion"/>
|
|
|
- <result property="devStatus" column="devStatus"/>
|
|
|
- <result property="devProvince" column="devProvince"/>
|
|
|
- <result property="devCity" column="devCity"/>
|
|
|
- <result property="devDistrict" column="devDistrict"/>
|
|
|
- <result property="devLng" column="devLng"/>
|
|
|
- <result property="devLat" column="devLat"/>
|
|
|
- <result property="devProvincealign" column="devProvincealign"/>
|
|
|
- <result property="devCityalign" column="devCityalign"/>
|
|
|
- <result property="devDistrictalign" column="devDistrictalign"/>
|
|
|
- <result property="devLngalign" column="devLngalign"/>
|
|
|
- <result property="devLatalign" column="devLatalign"/>
|
|
|
- <result property="devPositionstatus" column="devPositionstatus"/>
|
|
|
- <result property="devPositiontype" column="devPositiontype"/>
|
|
|
- <result property="devTag" column="devTag"/>
|
|
|
- <result property="devRecogtype" column="devRecogtype"/>
|
|
|
- <result property="devNetworktype" column="devNetworktype"/>
|
|
|
- <result property="devOnlinedate" column="devOnlinedate"/>
|
|
|
- <result property="devOfflinedate" column="devOfflinedate"/>
|
|
|
- <result property="devSubtype" column="devSubtype"/>
|
|
|
- <result property="devCreator" column="devCreator"/>
|
|
|
- <result property="devModifier" column="devModifier"/>
|
|
|
- <result property="devUpdateddate" column="devUpdateddate"/>
|
|
|
- <result property="devModifieddate" column="devModifieddate"/>
|
|
|
- <result property="devCreateddate" column="devCreateddate"/>
|
|
|
- <result property="devDelstatus" column="devDelstatus"/>
|
|
|
- <result property="devName" column="devName"/>
|
|
|
- <result property="devContacts" column="devContacts"/>
|
|
|
- <result property="devTel" column="devTel"/>
|
|
|
- <result property="devOriginalid" column="devOriginalid"/>
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="devBid" column="devBid" />
|
|
|
+ <result property="tid" column="tid" />
|
|
|
+ <result property="devtypeBid" column="devtypeBid" />
|
|
|
+ <result property="firmBid" column="firmBid" />
|
|
|
+ <result property="devclassBid" column="devclassBid" />
|
|
|
+ <result property="devconnBid" column="devconnBid" />
|
|
|
+ <result property="devCode" column="devCode" />
|
|
|
+ <result property="devName" column="devName" />
|
|
|
+ <result property="devVersion" column="devVersion" />
|
|
|
+ <result property="devStatus" column="devStatus" />
|
|
|
+ <result property="devProvince" column="devProvince" />
|
|
|
+ <result property="devCity" column="devCity" />
|
|
|
+ <result property="devDistrict" column="devDistrict" />
|
|
|
+ <result property="devLng" column="devLng" />
|
|
|
+ <result property="devLat" column="devLat" />
|
|
|
+ <result property="devPositionstatus" column="devPositionstatus" />
|
|
|
+ <result property="devPositiontype" column="devPositiontype" />
|
|
|
+ <result property="devTag" column="devTag" />
|
|
|
+ <result property="devRecogtype" column="devRecogtype" />
|
|
|
+ <result property="devNetworktype" column="devNetworktype" />
|
|
|
+ <result property="devOfflinedate" column="devOfflinedate" />
|
|
|
+ <result property="devProvincealign" column="devProvincealign" />
|
|
|
+ <result property="devCityalign" column="devCityalign" />
|
|
|
+ <result property="devDistrictalign" column="devDistrictalign" />
|
|
|
+ <result property="devLngalign" column="devLngalign" />
|
|
|
+ <result property="devLatalign" column="devLatalign" />
|
|
|
+ <result property="devContacts" column="devContacts" />
|
|
|
+ <result property="devTel" column="devTel" />
|
|
|
+ <result property="devCreator" column="devCreator" />
|
|
|
+ <result property="devModifier" column="devModifier" />
|
|
|
+ <result property="devUpdateddate" column="devUpdateddate" />
|
|
|
+ <result property="devModifieddate" column="devModifieddate" />
|
|
|
+ <result property="devCreateddate" column="devCreateddate" />
|
|
|
+ <result property="devDelstatus" column="devDelstatus" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectIotDeviceVo">
|
|
|
- select d.devBid, d.cId, d.devtypeBid, d.firmBid, d.devCode, d.devVersion, d.devStatus, d.devProvince, d.devCity,
|
|
|
- d.devDistrict, d.devLng, d.devLat, d.devProvincealign, d.devCityalign, d.devDistrictalign, d.devLngalign,
|
|
|
- d.devLatalign, d.devPositionstatus, d.devPositiontype, d.devTag, d.devRecogtype, d.devNetworktype, d.devOfflinedate,
|
|
|
- d.devCreator, d.devModifier, d.devUpdateddate, d.devModifieddate, d.devCreateddate, d.devDelstatus,d.extInfo,
|
|
|
- d.devName, f.firmName,f.firmTel devTel,f.firmDesc devContacts,
|
|
|
- d.devOnlinedate, d.devSubtype,d.devOriginalid,d.devHostingstatus
|
|
|
- ,FmsBlock.blockId,FmsBlock.blockName,FmsBlock.landId,FmsLand.landName,e.devtypePid
|
|
|
- ,e.devtypeName
|
|
|
- from IotDevice d
|
|
|
- left join TmnLand on d.devBid = TmnLand.tmnId
|
|
|
- LEFT JOIN FmsLand on TmnLand.landId=FmsLand.landId
|
|
|
- left join TmnBlock on d.devBid = TmnBlock.tmnId AND TmnBlock.blockId IN ( SELECT fb.blockId FROM FmsBlock AS fb )
|
|
|
- left join FmsBlock on FmsBlock.blockId = TmnBlock.blockId
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
- left join IotFirm f on d.firmBid = f.firmBid
|
|
|
+ select id, devBid, tid, devtypeBid, firmBid, devclassBid, devconnBid, devCode, devName, devVersion, devStatus, devProvince, devCity, devDistrict, devLng, devLat, devPositionstatus, devPositiontype, devTag, devRecogtype, devNetworktype, devOfflinedate, devProvincealign, devCityalign, devDistrictalign, devLngalign, devLatalign, devContacts, devTel, devCreator, devModifier, devUpdateddate, devModifieddate, devCreateddate, devDelstatus from IotDevice
|
|
|
</sql>
|
|
|
|
|
|
- <!-- 注意:这里保持前端查询列表类型字段不变,devtypeBid 但是实际查询的是类型的Pid-->
|
|
|
- <select id="selectIotDeviceList" parameterType="IotDeviceListReqVo" resultType="IotDeviceListResVo">
|
|
|
+ <select id="selectIotDeviceList" parameterType="IotDevice" resultMap="IotDeviceResult">
|
|
|
<include refid="selectIotDeviceVo"/>
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devBid != null and devBid != ''">and d.devBid = #{devBid}</if>
|
|
|
- <if test="cId != null and cId != ''">and d.cId = #{cId}</if>
|
|
|
- <if test="devtypeBids != null and devtypeBids != ''">and e.devtypePid in (${devtypeBids})</if>
|
|
|
- <if test="devtypeBid != null and devtypeBid != ''">and e.devtypePid = #{devtypeBid}</if>
|
|
|
- <if test="firmBid != null and firmBid != ''">and d.firmBid = #{firmBid}</if>
|
|
|
- <if test="devSubtype != null and devSubtype != ''">and d.devSubtype = #{devSubtype}</if>
|
|
|
- <if test="devTel != null and devTel != ''">and d.devTel like concat('%', #{devTel}, '%')</if>
|
|
|
- <if test="devName != null and devName != ''">and d.devName like concat('%', #{devName}, '%')</if>
|
|
|
- <if test="devCode != null and devCode != ''">and d.devCode like concat('%', #{devCode}, '%')</if>
|
|
|
- <if test="devStatus != null and devStatus != ''">and d.devStatus = #{devStatus}</if>
|
|
|
- <if test="devHostingstatus != null and devHostingstatus != ''">and d.devHostingstatus =
|
|
|
- #{devHostingstatus}
|
|
|
- </if>
|
|
|
- <if test="landId != null and landId != ''">and FmsBlock.landId = #{landId}</if>
|
|
|
- <if test="blockId != null and blockId != ''">and FmsBlock.blockId = #{blockId}</if>
|
|
|
- <if test="noQueryTypePids != null and noQueryTypePids != ''">
|
|
|
- and e.devtypePid not in
|
|
|
- <foreach collection="noQueryTypePids" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="noQueryTypeBids != null and noQueryTypeBids != ''">
|
|
|
- and d.devtypeBid not in
|
|
|
- <foreach collection="noQueryTypeBids" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="devtypeBidList != null and devtypeBidList.size() != 0">
|
|
|
- and d.devtypeBid in
|
|
|
- <foreach collection="devtypeBidList" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="blockIds != null and blockIds.size() != 0">
|
|
|
- and FmsBlock.blockId in
|
|
|
- <foreach collection="blockIds" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="devtypePidList != null and devtypePidList.size() != 0">
|
|
|
- and e.devtypePid in
|
|
|
- <foreach collection="devtypePidList" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY d.devBid
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceByDevBid" parameterType="String" resultType="IotDeviceResVo">
|
|
|
+ <where>
|
|
|
+ <if test="devBid != null and devBid != ''"> and devBid = #{devBid}</if>
|
|
|
+ <if test="tid != null and tid != ''"> and tid = #{tid}</if>
|
|
|
+ <if test="devtypeBid != null and devtypeBid != ''"> and devtypeBid = #{devtypeBid}</if>
|
|
|
+ <if test="firmBid != null and firmBid != ''"> and firmBid = #{firmBid}</if>
|
|
|
+ <if test="devclassBid != null and devclassBid != ''"> and devclassBid = #{devclassBid}</if>
|
|
|
+ <if test="devconnBid != null and devconnBid != ''"> and devconnBid = #{devconnBid}</if>
|
|
|
+ <if test="devCode != null and devCode != ''"> and devCode = #{devCode}</if>
|
|
|
+ <if test="devName != null and devName != ''"> and devName like concat('%', #{devName}, '%')</if>
|
|
|
+ <if test="devVersion != null and devVersion != ''"> and devVersion = #{devVersion}</if>
|
|
|
+ <if test="devStatus != null and devStatus != ''"> and devStatus = #{devStatus}</if>
|
|
|
+ <if test="devProvince != null and devProvince != ''"> and devProvince = #{devProvince}</if>
|
|
|
+ <if test="devCity != null and devCity != ''"> and devCity = #{devCity}</if>
|
|
|
+ <if test="devDistrict != null and devDistrict != ''"> and devDistrict = #{devDistrict}</if>
|
|
|
+ <if test="devLng != null "> and devLng = #{devLng}</if>
|
|
|
+ <if test="devLat != null "> and devLat = #{devLat}</if>
|
|
|
+ <if test="devPositionstatus != null and devPositionstatus != ''"> and devPositionstatus = #{devPositionstatus}</if>
|
|
|
+ <if test="devPositiontype != null and devPositiontype != ''"> and devPositiontype = #{devPositiontype}</if>
|
|
|
+ <if test="devTag != null and devTag != ''"> and devTag = #{devTag}</if>
|
|
|
+ <if test="devRecogtype != null and devRecogtype != ''"> and devRecogtype = #{devRecogtype}</if>
|
|
|
+ <if test="devNetworktype != null and devNetworktype != ''"> and devNetworktype = #{devNetworktype}</if>
|
|
|
+ <if test="devOfflinedate != null and devOfflinedate != ''"> and devOfflinedate = #{devOfflinedate}</if>
|
|
|
+ <if test="devProvincealign != null and devProvincealign != ''"> and devProvincealign = #{devProvincealign}</if>
|
|
|
+ <if test="devCityalign != null and devCityalign != ''"> and devCityalign = #{devCityalign}</if>
|
|
|
+ <if test="devDistrictalign != null and devDistrictalign != ''"> and devDistrictalign = #{devDistrictalign}</if>
|
|
|
+ <if test="devLngalign != null "> and devLngalign = #{devLngalign}</if>
|
|
|
+ <if test="devLatalign != null "> and devLatalign = #{devLatalign}</if>
|
|
|
+ <if test="devContacts != null and devContacts != ''"> and devContacts = #{devContacts}</if>
|
|
|
+ <if test="devTel != null and devTel != ''"> and devTel = #{devTel}</if>
|
|
|
+ <if test="devCreator != null and devCreator != ''"> and devCreator = #{devCreator}</if>
|
|
|
+ <if test="devModifier != null and devModifier != ''"> and devModifier = #{devModifier}</if>
|
|
|
+ <if test="devUpdateddate != null and devUpdateddate != ''"> and devUpdateddate = #{devUpdateddate}</if>
|
|
|
+ <if test="devModifieddate != null and devModifieddate != ''"> and devModifieddate = #{devModifieddate}</if>
|
|
|
+ <if test="devCreateddate != null and devCreateddate != ''"> and devCreateddate = #{devCreateddate}</if>
|
|
|
+ <if test="devDelstatus != null and devDelstatus != ''"> and devDelstatus = #{devDelstatus}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectIotDeviceById" parameterType="Long" resultMap="IotDeviceResult">
|
|
|
<include refid="selectIotDeviceVo"/>
|
|
|
- where devBid = #{devBid}
|
|
|
- GROUP BY d.devBid
|
|
|
- ORDER BY TmnBlock.tmnblockAssigndate limit 1
|
|
|
+ where id = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
- <select id="selectTmnLandByDevBid" parameterType="String" resultType="map">
|
|
|
- select tl.*, l.landName from TmnLand tl left join FmsLand l on tl.landId = l.landId
|
|
|
- where tmnId = #{devBid} order by tl.tmnlandAssigndate desc limit 1
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectTmnBlockByDevBid" parameterType="String" resultType="map">
|
|
|
- select tb.*, b.blockName from TmnBlock tb left join FmsBlock b on tb.blockId = b.blockId
|
|
|
- where tmnId = #{devBid} order by tb.tmnblockAssigndate desc limit 1
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceByDevBids" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- <include refid="selectIotDeviceVo"/>
|
|
|
- <where>
|
|
|
- devBid in
|
|
|
- <foreach collection="array" item="item" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- GROUP BY d.devBid
|
|
|
- </select>
|
|
|
- <select id="findOneByBizId" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select * from IotDevice where devBid = #{devBid}
|
|
|
-
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceAndConfigResVoList"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.service.IotDeviceAndConfigResVo">
|
|
|
- SELECT
|
|
|
- idv.*,
|
|
|
- idvc.devcfgContext
|
|
|
- FROM
|
|
|
- IotDevice idv
|
|
|
- LEFT JOIN IotDeviceconfig idvc ON idv.devBid = idvc.devBid
|
|
|
- LEFT join IotDevicetype e on idv.devtypeBid=e.devtypeBid
|
|
|
- LEFT JOIN TmnLand tl on tl.tmnId = idv.devBid
|
|
|
- LEFT JOIN TmnBlock tb on tb.tmnId = idv.devBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devBid != null and devBid != ''">and idv.devBid = #{devBid}</if>
|
|
|
- <if test="cId != null and cId != ''">and idv.cId = #{cId}</if>
|
|
|
- <if test="devtypeBid != null and devtypeBid != ''">and e.devtypePid = #{devtypeBid}</if>
|
|
|
- <if test="firmBid != null and firmBid != ''">and idv.firmBid = #{firmBid}</if>
|
|
|
- <if test="devSubtype != null and devSubtype != ''">and idv.devSubtype = #{devSubtype}</if>
|
|
|
- <if test="devTel != null and devTel != ''">and idv.devTel like concat('%', #{devTel}, '%')</if>
|
|
|
- <if test="devName != null and devName != ''">and idv.devName like concat('%', #{devName}, '%')</if>
|
|
|
- <if test="devCode != null and devCode != ''">and idv.devCode like concat('%', #{devCode}, '%')</if>
|
|
|
- <if test="devStatus != null and devStatus != ''">and idv.devStatus = #{devStatus}</if>
|
|
|
- <if test="devHostingstatus != null and devHostingstatus != ''">and idv.devHostingstatus =
|
|
|
- #{devHostingstatus}
|
|
|
- </if>
|
|
|
- <if test="devtypeBids !=null and devtypeBids.size() != 0 " >
|
|
|
- and idv.devtypeBid in
|
|
|
- <foreach collection="devtypeBids" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="devQuery != null and devQuery != ''">
|
|
|
- and (idv.devName like concat('%',#{devQuery},'%') or idv.devCode like concat('%',#{devQuery},'%') )
|
|
|
- </if>
|
|
|
- <if test="blockId != null and blockId != ''">
|
|
|
- and tb.blockId = #{blockId}
|
|
|
- </if>
|
|
|
- <if test="landId != null and landId != ''">
|
|
|
- and tl.landId = #{landId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- group by idv.devBid
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 联系人和联系电话用厂家的信息,这里不再使用 张宁-->
|
|
|
+
|
|
|
<insert id="insertIotDevice" parameterType="IotDevice" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into IotDevice
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="devBid != null">devBid,</if>
|
|
|
- <if test="cId != null">cId,</if>
|
|
|
+ <if test="tid != null">tid,</if>
|
|
|
<if test="devtypeBid != null and devtypeBid != ''">devtypeBid,</if>
|
|
|
<if test="firmBid != null">firmBid,</if>
|
|
|
+ <if test="devclassBid != null">devclassBid,</if>
|
|
|
+ <if test="devconnBid != null">devconnBid,</if>
|
|
|
<if test="devCode != null">devCode,</if>
|
|
|
+ <if test="devName != null">devName,</if>
|
|
|
<if test="devVersion != null">devVersion,</if>
|
|
|
<if test="devStatus != null">devStatus,</if>
|
|
|
<if test="devProvince != null">devProvince,</if>
|
|
|
@@ -205,34 +109,35 @@
|
|
|
<if test="devDistrict != null">devDistrict,</if>
|
|
|
<if test="devLng != null">devLng,</if>
|
|
|
<if test="devLat != null">devLat,</if>
|
|
|
- <if test="devProvincealign != null">devProvincealign,</if>
|
|
|
- <if test="devCityalign != null">devCityalign,</if>
|
|
|
- <if test="devDistrictalign != null">devDistrictalign,</if>
|
|
|
- <if test="devLngalign != null">devLngalign,</if>
|
|
|
- <if test="devLatalign != null">devLatalign,</if>
|
|
|
<if test="devPositionstatus != null">devPositionstatus,</if>
|
|
|
<if test="devPositiontype != null">devPositiontype,</if>
|
|
|
<if test="devTag != null">devTag,</if>
|
|
|
<if test="devRecogtype != null">devRecogtype,</if>
|
|
|
<if test="devNetworktype != null">devNetworktype,</if>
|
|
|
- <if test="devOnlinedate != null">devOnlinedate,</if>
|
|
|
<if test="devOfflinedate != null">devOfflinedate,</if>
|
|
|
- <if test="devSubtype != null">devSubtype,</if>
|
|
|
+ <if test="devProvincealign != null">devProvincealign,</if>
|
|
|
+ <if test="devCityalign != null">devCityalign,</if>
|
|
|
+ <if test="devDistrictalign != null">devDistrictalign,</if>
|
|
|
+ <if test="devLngalign != null">devLngalign,</if>
|
|
|
+ <if test="devLatalign != null">devLatalign,</if>
|
|
|
+ <if test="devContacts != null">devContacts,</if>
|
|
|
+ <if test="devTel != null">devTel,</if>
|
|
|
<if test="devCreator != null">devCreator,</if>
|
|
|
<if test="devModifier != null">devModifier,</if>
|
|
|
<if test="devUpdateddate != null">devUpdateddate,</if>
|
|
|
<if test="devModifieddate != null">devModifieddate,</if>
|
|
|
<if test="devCreateddate != null">devCreateddate,</if>
|
|
|
<if test="devDelstatus != null">devDelstatus,</if>
|
|
|
- <if test="devName != null">devName,</if>
|
|
|
-
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="devBid != null">#{devBid},</if>
|
|
|
- <if test="cId != null">#{cId},</if>
|
|
|
+ <if test="tid != null">#{tid},</if>
|
|
|
<if test="devtypeBid != null and devtypeBid != ''">#{devtypeBid},</if>
|
|
|
<if test="firmBid != null">#{firmBid},</if>
|
|
|
+ <if test="devclassBid != null">#{devclassBid},</if>
|
|
|
+ <if test="devconnBid != null">#{devconnBid},</if>
|
|
|
<if test="devCode != null">#{devCode},</if>
|
|
|
+ <if test="devName != null">#{devName},</if>
|
|
|
<if test="devVersion != null">#{devVersion},</if>
|
|
|
<if test="devStatus != null">#{devStatus},</if>
|
|
|
<if test="devProvince != null">#{devProvince},</if>
|
|
|
@@ -240,114 +145,39 @@
|
|
|
<if test="devDistrict != null">#{devDistrict},</if>
|
|
|
<if test="devLng != null">#{devLng},</if>
|
|
|
<if test="devLat != null">#{devLat},</if>
|
|
|
- <if test="devProvincealign != null">#{devProvincealign},</if>
|
|
|
- <if test="devCityalign != null">#{devCityalign},</if>
|
|
|
- <if test="devDistrictalign != null">#{devDistrictalign},</if>
|
|
|
- <if test="devLngalign != null">#{devLngalign},</if>
|
|
|
- <if test="devLatalign != null">#{devLatalign},</if>
|
|
|
<if test="devPositionstatus != null">#{devPositionstatus},</if>
|
|
|
<if test="devPositiontype != null">#{devPositiontype},</if>
|
|
|
<if test="devTag != null">#{devTag},</if>
|
|
|
<if test="devRecogtype != null">#{devRecogtype},</if>
|
|
|
<if test="devNetworktype != null">#{devNetworktype},</if>
|
|
|
- <if test="devOnlinedate != null">#{devOnlinedate},</if>
|
|
|
<if test="devOfflinedate != null">#{devOfflinedate},</if>
|
|
|
- <if test="devSubtype != null">#{devSubtype},</if>
|
|
|
+ <if test="devProvincealign != null">#{devProvincealign},</if>
|
|
|
+ <if test="devCityalign != null">#{devCityalign},</if>
|
|
|
+ <if test="devDistrictalign != null">#{devDistrictalign},</if>
|
|
|
+ <if test="devLngalign != null">#{devLngalign},</if>
|
|
|
+ <if test="devLatalign != null">#{devLatalign},</if>
|
|
|
+ <if test="devContacts != null">#{devContacts},</if>
|
|
|
+ <if test="devTel != null">#{devTel},</if>
|
|
|
<if test="devCreator != null">#{devCreator},</if>
|
|
|
<if test="devModifier != null">#{devModifier},</if>
|
|
|
<if test="devUpdateddate != null">#{devUpdateddate},</if>
|
|
|
<if test="devModifieddate != null">#{devModifieddate},</if>
|
|
|
<if test="devCreateddate != null">#{devCreateddate},</if>
|
|
|
<if test="devDelstatus != null">#{devDelstatus},</if>
|
|
|
- <if test="devName != null">#{devName},</if>
|
|
|
-
|
|
|
- </trim>
|
|
|
- </insert>
|
|
|
-
|
|
|
- <insert id="insertIotDeviceBatch" parameterType="IotDevice" useGeneratedKeys="true" keyProperty="id">
|
|
|
- insert into IotDevice
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- devBid,
|
|
|
- cId,
|
|
|
- devtypeBid,
|
|
|
- firmBid,
|
|
|
- devCode,
|
|
|
- devVersion,
|
|
|
- devStatus,
|
|
|
- devProvince,
|
|
|
- devCity,
|
|
|
- devDistrict,
|
|
|
- devLng,
|
|
|
- devLat,
|
|
|
- devProvincealign,
|
|
|
- devCityalign,
|
|
|
- devDistrictalign,
|
|
|
- devLngalign,
|
|
|
- devLatalign,
|
|
|
- devPositionstatus,
|
|
|
- devPositiontype,
|
|
|
- devTag,
|
|
|
- devRecogtype,
|
|
|
- devNetworktype,
|
|
|
- devOnlinedate,
|
|
|
- devOfflinedate,
|
|
|
- devSubtype,
|
|
|
- devCreator,
|
|
|
- devModifier,
|
|
|
- devUpdateddate,
|
|
|
- devModifieddate,
|
|
|
- devCreateddate,
|
|
|
- devDelstatus,
|
|
|
- devName,
|
|
|
- extInfo,
|
|
|
- </trim>
|
|
|
- values
|
|
|
- <foreach item="data" collection="list" separator=",">
|
|
|
- (
|
|
|
- #{data.devBid},
|
|
|
- #{data.cId},
|
|
|
- #{data.devtypeBid},
|
|
|
- #{data.firmBid},
|
|
|
- #{data.devCode},
|
|
|
- #{data.devVersion},
|
|
|
- #{data.devStatus},
|
|
|
- #{data.devProvince},
|
|
|
- #{data.devCity},
|
|
|
- #{data.devDistrict},
|
|
|
- #{data.devLng},
|
|
|
- #{data.devLat},
|
|
|
- #{data.devProvincealign},
|
|
|
- #{data.devCityalign},
|
|
|
- #{data.devDistrictalign},
|
|
|
- #{data.devLngalign},
|
|
|
- #{data.devLatalign},
|
|
|
- #{data.devPositionstatus},
|
|
|
- #{data.devPositiontype},
|
|
|
- #{data.devTag},
|
|
|
- #{data.devRecogtype},
|
|
|
- #{data.devNetworktype},
|
|
|
- #{data.devOnlinedate},
|
|
|
- #{data.devOfflinedate},
|
|
|
- #{data.devSubtype},
|
|
|
- #{data.devCreator},
|
|
|
- #{data.devModifier},
|
|
|
- #{data.devUpdateddate},
|
|
|
- #{data.devModifieddate},
|
|
|
- #{data.devCreateddate},
|
|
|
- #{data.devDelstatus},
|
|
|
- #{data.devName},
|
|
|
- #{data.extInfo}
|
|
|
- )
|
|
|
- </foreach>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateIotDevice" parameterType="IotDevice">
|
|
|
update IotDevice
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="cId != null">cId = #{cId},</if>
|
|
|
+ <if test="devBid != null">devBid = #{devBid},</if>
|
|
|
+ <if test="tid != null">tid = #{tid},</if>
|
|
|
<if test="devtypeBid != null and devtypeBid != ''">devtypeBid = #{devtypeBid},</if>
|
|
|
<if test="firmBid != null">firmBid = #{firmBid},</if>
|
|
|
+ <if test="devclassBid != null">devclassBid = #{devclassBid},</if>
|
|
|
+ <if test="devconnBid != null">devconnBid = #{devconnBid},</if>
|
|
|
<if test="devCode != null">devCode = #{devCode},</if>
|
|
|
+ <if test="devName != null">devName = #{devName},</if>
|
|
|
<if test="devVersion != null">devVersion = #{devVersion},</if>
|
|
|
<if test="devStatus != null">devStatus = #{devStatus},</if>
|
|
|
<if test="devProvince != null">devProvince = #{devProvince},</if>
|
|
|
@@ -355,448 +185,37 @@
|
|
|
<if test="devDistrict != null">devDistrict = #{devDistrict},</if>
|
|
|
<if test="devLng != null">devLng = #{devLng},</if>
|
|
|
<if test="devLat != null">devLat = #{devLat},</if>
|
|
|
- <if test="devProvincealign != null">devProvincealign = #{devProvincealign},</if>
|
|
|
- <if test="devCityalign != null">devCityalign = #{devCityalign},</if>
|
|
|
- <if test="devDistrictalign != null">devDistrictalign = #{devDistrictalign},</if>
|
|
|
- <if test="devLngalign != null">devLngalign = #{devLngalign},</if>
|
|
|
- <if test="devLatalign != null">devLatalign = #{devLatalign},</if>
|
|
|
<if test="devPositionstatus != null">devPositionstatus = #{devPositionstatus},</if>
|
|
|
<if test="devPositiontype != null">devPositiontype = #{devPositiontype},</if>
|
|
|
<if test="devTag != null">devTag = #{devTag},</if>
|
|
|
<if test="devRecogtype != null">devRecogtype = #{devRecogtype},</if>
|
|
|
<if test="devNetworktype != null">devNetworktype = #{devNetworktype},</if>
|
|
|
- <if test="devOnlinedate != null">devOnlinedate = #{devOnlinedate},</if>
|
|
|
<if test="devOfflinedate != null">devOfflinedate = #{devOfflinedate},</if>
|
|
|
- <if test="devSubtype != null">devSubtype = #{devSubtype},</if>
|
|
|
+ <if test="devProvincealign != null">devProvincealign = #{devProvincealign},</if>
|
|
|
+ <if test="devCityalign != null">devCityalign = #{devCityalign},</if>
|
|
|
+ <if test="devDistrictalign != null">devDistrictalign = #{devDistrictalign},</if>
|
|
|
+ <if test="devLngalign != null">devLngalign = #{devLngalign},</if>
|
|
|
+ <if test="devLatalign != null">devLatalign = #{devLatalign},</if>
|
|
|
+ <if test="devContacts != null">devContacts = #{devContacts},</if>
|
|
|
+ <if test="devTel != null">devTel = #{devTel},</if>
|
|
|
<if test="devCreator != null">devCreator = #{devCreator},</if>
|
|
|
<if test="devModifier != null">devModifier = #{devModifier},</if>
|
|
|
<if test="devUpdateddate != null">devUpdateddate = #{devUpdateddate},</if>
|
|
|
<if test="devModifieddate != null">devModifieddate = #{devModifieddate},</if>
|
|
|
<if test="devCreateddate != null">devCreateddate = #{devCreateddate},</if>
|
|
|
- <if test="devName != null">devName = #{devName},</if>
|
|
|
- <if test="devHostingstatus != null">devHostingstatus = #{devHostingstatus},</if>
|
|
|
- <if test="extInfo != null">extInfo = #{extInfo},</if>
|
|
|
+ <if test="devDelstatus != null">devDelstatus = #{devDelstatus},</if>
|
|
|
</trim>
|
|
|
- where devBid = #{devBid}
|
|
|
+ where id = #{id}
|
|
|
</update>
|
|
|
|
|
|
+ <delete id="deleteIotDeviceById" parameterType="Long">
|
|
|
+ delete from IotDevice where id = #{id}
|
|
|
+ </delete>
|
|
|
|
|
|
- <delete id="deleteIotDeviceByDevBids" parameterType="String">
|
|
|
- update IotDevice set devDelstatus = '1' where devBid in
|
|
|
- <foreach item="devBid" collection="array" open="(" separator="," close=")">
|
|
|
- #{devBid}
|
|
|
+ <delete id="deleteIotDeviceByIds" parameterType="String">
|
|
|
+ delete from IotDevice where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListBatchBySubTopic" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select d.devBid, d.cId, d.devtypeBid, d.firmBid, d.devCode, d.devVersion, d.devStatus, d.devProvince, d.devCity,
|
|
|
- d.devDistrict, d.devLng, d.devLat, d.devProvincealign, d.devCityalign, d.devDistrictalign, d.devLngalign,
|
|
|
- d.devLatalign, d.devPositionstatus, d.devPositiontype, d.devTag, d.devRecogtype, d.devNetworktype,
|
|
|
- d.devOfflinedate,
|
|
|
- d.devCreator, d.devModifier, d.devUpdateddate, d.devModifieddate, d.devCreateddate, d.devDelstatus,d.extInfo,
|
|
|
- d.devName, d.devContacts, d.devTel, d.devOnlinedate, d.devSubtype,d.devOriginalid,d.devHostingstatus
|
|
|
- from IotDevice d
|
|
|
- <where>
|
|
|
- d.devCode in
|
|
|
- <foreach collection="array" item="devCode" open="(" close=")" separator=",">
|
|
|
- #{devCode}
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByFirmCode" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select * from IotDevice where firmBid=#{firmId} and devCode=#{code} and devtypeBid= #{devtypeBid} and devDelstatus='0'
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByDevtypeBids" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select * from IotDevice
|
|
|
- <where>
|
|
|
- devDelstatus='0'
|
|
|
- and devtypeBid in
|
|
|
- <foreach collection="array" item="devtypeBid" open="(" close=")" separator=",">
|
|
|
- #{devtypeBid}
|
|
|
- </foreach>
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceByDevCodeAndType"
|
|
|
- resultType="com.yunfeiyun.agmp.iot.common.domain.resvo.IotDeviceResVo">
|
|
|
-
|
|
|
-SELECT e.*, c.landId,
|
|
|
- c.landName from (
|
|
|
-
|
|
|
-SELECT a.* ,b.landId
|
|
|
-FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- IotDevice
|
|
|
- WHERE
|
|
|
- devCode =#{devCode}
|
|
|
- AND devtypeBid =#{ctDevtype}
|
|
|
- AND devDelstatus = '0'
|
|
|
- ) a
|
|
|
-LEFT JOIN TmnLand b ON a.devBid = b.tmnId
|
|
|
-
|
|
|
-) e LEFT JOIN FmsLand c ON c.landId = e.landId
|
|
|
-limit 1
|
|
|
-
|
|
|
- </select>
|
|
|
- <select id="selectIotSfDeviceList"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- select d.devBid, d.cId, d.devtypeBid, d.firmBid, d.devCode, d.devVersion, d.devStatus, d.devProvince, d.devCity,
|
|
|
- d.devDistrict, d.devLng, d.devLat, d.devProvincealign, d.devCityalign, d.devDistrictalign, d.devLngalign,
|
|
|
- d.devLatalign, d.devPositionstatus, d.devPositiontype, d.devTag, d.devRecogtype, d.devNetworktype,
|
|
|
- d.devOfflinedate,
|
|
|
- d.devCreator, d.devModifier, d.devUpdateddate, d.devModifieddate, d.devCreateddate, d.devDelstatus,d.extInfo,
|
|
|
- d.devName, f.firmName,f.firmTel devTel,f.firmDesc devContacts,
|
|
|
- d.devOnlinedate, d.devSubtype,d.devOriginalid,d.devHostingstatus
|
|
|
- ,FmsLand.landId,FmsLand.landName
|
|
|
- from IotDevice d
|
|
|
- left join IotFirm f on d.firmBid = f.firmBid
|
|
|
- left join TmnLand on d.devBid = TmnLand.tmnId
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
- LEFT JOIN FmsLand on TmnLand.landId=FmsLand.landId
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devBid != null and devBid != ''">and d.devBid = #{devBid}</if>
|
|
|
- <if test="cId != null and cId != ''">and d.cId = #{cId}</if>
|
|
|
- <if test="devtypeBids != null and devtypeBids != ''">and d.devtypeBid in (${devtypeBids})</if>
|
|
|
- <if test="devtypeBid != null and devtypeBid != ''">and e.devtypePid = #{devtypeBid}</if>
|
|
|
- <if test="firmBid != null and firmBid != ''">and d.firmBid = #{firmBid}</if>
|
|
|
- <if test="devSubtype != null and devSubtype != ''">and d.devSubtype = #{devSubtype}</if>
|
|
|
- <if test="devTel != null and devTel != ''">and d.devTel like concat('%', #{devTel}, '%')</if>
|
|
|
- <if test="devName != null and devName != ''">and d.devName like concat('%', #{devName}, '%')</if>
|
|
|
- <if test="devCode != null and devCode != ''">and d.devCode like concat('%', #{devCode}, '%')</if>
|
|
|
- <if test="devStatus != null and devStatus != ''">and d.devStatus = #{devStatus}</if>
|
|
|
- <if test="landId != null and landId != ''">and FmsBlock.landId = #{landId}</if>
|
|
|
- <if test="blockId != null and blockId != ''">and FmsBlock.blockId = #{blockId}</if>
|
|
|
- <if test="devtypeBid != null and devtypeBid != ''">and e.devtypePid=#{devtypeBid}</if>
|
|
|
- </where>
|
|
|
- GROUP BY d.devBid
|
|
|
-
|
|
|
-
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceListByLandId"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- SELECT d.*,c.tmnId from IotDevice d
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
- left join (
|
|
|
- SELECT tmnId from TmnLand where landId=#{landId}
|
|
|
- ) c on c.tmnId=d.devBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePid != null and devTypePid != ''">
|
|
|
- and e.devtypePid = #{devTypePid}
|
|
|
- </if>
|
|
|
- and c.tmnId is not null
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByBlockId"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
-
|
|
|
- SELECT d.*,c.tmnId from IotDevice d
|
|
|
-
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
-
|
|
|
- left join (
|
|
|
- SELECT tmnId from TmnBlock where blockId=#{blockId}
|
|
|
- ) c on c.tmnId=d.devBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePid != null and devTypePid != ''">
|
|
|
- and e.devtypePid = #{devTypePid}
|
|
|
- </if>
|
|
|
- and c.tmnId is not null
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-<!-- 查询已经绑定的设备,可能绑在基地/地块 -->
|
|
|
- <select id="selectIotDeviceListByDevTypePid"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
-
|
|
|
- SELECT
|
|
|
- d.*
|
|
|
- FROM
|
|
|
- IotDevice d
|
|
|
- LEFT JOIN IotDevicetype e ON d.devtypeBid = e.devtypeBid
|
|
|
- LEFT JOIN (SELECT tmnId FROM TmnBlock) c ON c.tmnId = d.devBid
|
|
|
- LEFT JOIN (SELECT tmnId FROM TmnLand) e ON e.tmnId = d.devBid
|
|
|
-
|
|
|
- WHERE
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePid != null and devTypePid != ''">
|
|
|
- and e.devtypePid = #{devTypePid}
|
|
|
- </if>
|
|
|
- AND (c.tmnId IS NOT NULL
|
|
|
- or e.tmnId IS NOT NULL)
|
|
|
-
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
-
|
|
|
- </select>
|
|
|
- <select id="findIotDeviceAndTypeInfoResVoByBizId"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceAndTypeInfoResVo">
|
|
|
- select idv.*,idt.devtypePid,idt.devtypeName from IotDevice idv LEFT JOIN IotDevicetype idt on idv.devtypeBid = idt.devtypeBid
|
|
|
- <where>
|
|
|
- idv.devBid = #{devBid}
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByFirmdevBids" resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select *
|
|
|
- from IotDevice as d
|
|
|
- LEFT JOIN IotFirmdev AS fd ON fd.firmBid = d.firmBid AND fd.devtypeBid = d.devtypeBid
|
|
|
- <where>
|
|
|
- d.devDelstatus='0' and fd.firmdevBid in
|
|
|
- <foreach collection="array" item="firmdevBid" open="(" close=")" separator=",">
|
|
|
- #{firmdevBid}
|
|
|
- </foreach>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByDevtypeBidsWithLand" resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- select IotDevice.id,IotDevice.devBid,IotDevice.devtypeBid
|
|
|
- ,IotDevice.firmBid,IotDevice.devCode,IotDevice.devStatus
|
|
|
- ,IotDevice.devOnlinedate,IotDevice.devDelstatus,IotDevice.devName
|
|
|
- ,IotDevice.devContacts,IotDevice.devTel,IotDevice.devSubtype,IotDevice.devHostingstatus,
|
|
|
- FmsLand.landId,FmsLand.landName,IF(devLng ,devLng,FmsLand.landLongitude) as devLng,IF(devLat ,devLat,FmsLand.landLatitude) as devLat
|
|
|
- ,IotDevicetype.devtypePid
|
|
|
- from IotDevice
|
|
|
- left join TmnLand on TmnLand.TmnId = IotDevice.devBid
|
|
|
- left join FmsLand on FmsLand.landId = TmnLand.landId
|
|
|
- left join IotDevicetype on IotDevicetype.devtypeBid = IotDevice.devtypeBid
|
|
|
- <where>
|
|
|
- devDelstatus='0'
|
|
|
- <if test="devTypeBids != null and devTypeBids.length > 0">
|
|
|
- and IotDevice.devtypeBid in
|
|
|
- <foreach collection="devTypeBids" item="devtypeBid" open="(" close=")" separator=",">
|
|
|
- #{devtypeBid}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="landId != null and landId != ''">
|
|
|
- and FmsLand.landId = #{landId}
|
|
|
- </if>
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectIotDeviceListByDevtypeBidsWithBlock" resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- select IotDevice.id,IotDevice.devBid,IotDevice.devtypeBid
|
|
|
- ,IotDevice.firmBid,IotDevice.devCode,IotDevice.devStatus
|
|
|
- ,IotDevice.devOnlinedate,IotDevice.devDelstatus,IotDevice.devName
|
|
|
- ,IotDevice.devContacts,IotDevice.devTel,IotDevice.devSubtype,IotDevice.devHostingstatus,
|
|
|
- FmsBlock.blockId,FmsBlock.blockName
|
|
|
- ,IF(devLng ,devLng,FmsLand.landLongitude) as devLng,IF(devLat ,devLat,FmsLand.landLatitude) as devLat
|
|
|
- ,FmsLand.landId,FmsLand.landName
|
|
|
- ,IotDevicetype.devtypePid
|
|
|
- from IotDevice
|
|
|
- left join TmnBlock on TmnBlock.TmnId = IotDevice.devBid
|
|
|
- left join FmsBlock on FmsBlock.blockId = TmnBlock.blockId
|
|
|
- left join FmsLand on FmsLand.landId = FmsBlock.landId
|
|
|
- left join IotDevicetype on IotDevicetype.devtypeBid = IotDevice.devtypeBid
|
|
|
- <where>
|
|
|
- devDelstatus='0'
|
|
|
- <if test="devTypeBids != null and devTypeBids.length > 0">
|
|
|
- and IotDevice.devtypeBid in
|
|
|
- <foreach collection="devTypeBids" item="devtypeBid" open="(" close=")" separator=",">
|
|
|
- #{devtypeBid}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="blockId != null and blockId != ''">
|
|
|
- and FmsBlock.blockId = #{blockId}
|
|
|
- </if>
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceTypeSum" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- devtypePid ,
|
|
|
- count(devtypePid) as typeSum
|
|
|
- FROM
|
|
|
- IotDevice idv LEFT JOIN IotDevicetype idt ON idv.devTypeBid = idt.devTypeBid
|
|
|
- LEFT JOIN TmnBlock tb on tb.tmnId = idv.devBid
|
|
|
- LEFT JOIN FmsBlock fb on fb.blockId = tb.blockId
|
|
|
- where tb.tmnId is not null
|
|
|
- <where>
|
|
|
- <if test="landId != null and landId != ''">
|
|
|
- and fb.landId = #{landId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY devtypePid
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 注意:这里保持前端查询列表类型字段不变,devtypeBid 但是实际查询的是类型的Pid-->
|
|
|
- <select id="selectCangLiWsmjIotDeviceList" parameterType="IotDeviceCangLiWsmjListReqVo" resultType="IotDeviceListResVo">
|
|
|
- <include refid="selectIotDeviceVo"/>
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- and ((e.devtypePid = #{devtypeBidByKzg} and d.devSubtype = #{devSubtype} ) or (e.devtypePid = #{devtypeBidByZnkg}))
|
|
|
- <if test="devCode != null and devCode != ''">and d.devCode like concat('%', #{devCode}, '%')</if>
|
|
|
- <if test="landId != null and landId != ''">and FmsBlock.landId = #{landId}</if>
|
|
|
- <if test="blockId != null and blockId != ''">and FmsBlock.blockId = #{blockId}</if>
|
|
|
- </where>
|
|
|
- GROUP BY d.devBid
|
|
|
- </select>
|
|
|
- <select id="selectBlockBindDevices" resultType="com.yunfeiyun.agmp.iot.common.domain.resvo.IotDeviceWithConfigResVo">
|
|
|
- select id.*,idc.devcfgContext
|
|
|
- from IotDevice id
|
|
|
- LEFT JOIN IotDeviceconfig idc on idc.devBid = id.devBid
|
|
|
- LEFT JOIN TmnBlock tb on id.devBid = tb.tmnId
|
|
|
- <where>
|
|
|
- <if test="blockId != null and blockId !=''">
|
|
|
- and tb.blockId = #{blockId}
|
|
|
- </if>
|
|
|
- <if test="devTypeBids != null and devTypeBids.size() != 0">
|
|
|
- and id.devtypeBid in
|
|
|
- <foreach collection="devTypeBids" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
- <select id="findIotDeviceByDevCodeAndDevTypeBid"
|
|
|
- resultType="com.yunfeiyun.agmp.iot.common.domain.IotDevice">
|
|
|
- select * from IotDevice
|
|
|
- where devCode = #{devCode} and devtypeBid = #{devtypeBid}
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceStatusSum" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
- d.devStatus,
|
|
|
- sum(d.devStatus) as devStatusSum
|
|
|
- FROM
|
|
|
- IotDevice d
|
|
|
- LEFT JOIN TmnLand ON d.devBid = TmnLand.tmnId
|
|
|
- LEFT JOIN FmsLand ON TmnLand.landId = FmsLand.landId
|
|
|
- LEFT JOIN TmnBlock ON d.devBid = TmnBlock.tmnId
|
|
|
- AND TmnBlock.blockId IN ( SELECT fb.blockId FROM FmsBlock AS fb )
|
|
|
- LEFT JOIN FmsBlock ON FmsBlock.blockId = TmnBlock.blockId
|
|
|
- LEFT JOIN IotDevicetype e ON d.devtypeBid = e.devtypeBid
|
|
|
- LEFT JOIN IotFirm f ON d.firmBid = f.firmBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devBid != null and devBid != ''">and d.devBid = #{devBid}</if>
|
|
|
- <if test="cId != null and cId != ''">and d.cId = #{cId}</if>
|
|
|
- <if test="devtypeBids != null and devtypeBids != ''">and e.devtypePid in (${devtypeBids})</if>
|
|
|
- <if test="devtypeBid != null and devtypeBid != ''">and e.devtypePid = #{devtypeBid}</if>
|
|
|
- <if test="firmBid != null and firmBid != ''">and d.firmBid = #{firmBid}</if>
|
|
|
- <if test="devSubtype != null and devSubtype != ''">and d.devSubtype = #{devSubtype}</if>
|
|
|
- <if test="devTel != null and devTel != ''">and d.devTel like concat('%', #{devTel}, '%')</if>
|
|
|
- <if test="devName != null and devName != ''">and d.devName like concat('%', #{devName}, '%')</if>
|
|
|
- <if test="devCode != null and devCode != ''">and d.devCode like concat('%', #{devCode}, '%')</if>
|
|
|
- <if test="devStatus != null and devStatus != ''">and d.devStatus = #{devStatus}</if>
|
|
|
- <if test="devHostingstatus != null and devHostingstatus != ''">and d.devHostingstatus =
|
|
|
- #{devHostingstatus}
|
|
|
- </if>
|
|
|
- <if test="landId != null and landId != ''">and FmsBlock.landId = #{landId}</if>
|
|
|
- <if test="blockId != null and blockId != ''">and FmsBlock.blockId = #{blockId}</if>
|
|
|
- <if test="noQueryTypePids != null and noQueryTypePids != ''">
|
|
|
- and e.devtypePid not in
|
|
|
- <foreach collection="noQueryTypePids" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="noQueryTypeBids != null and noQueryTypeBids != ''">
|
|
|
- and d.devtypeBid not in
|
|
|
- <foreach collection="noQueryTypeBids" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="devtypeBidList != null and devtypeBidList.size() != 0">
|
|
|
- and d.devtypeBid in
|
|
|
- <foreach collection="devtypeBidList" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="blockIds != null and blockIds.size() != 0">
|
|
|
- and FmsBlock.blockId in
|
|
|
- <foreach collection="blockIds" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="devtypePidList != null and devtypePidList.size() != 0">
|
|
|
- and e.devtypePid in
|
|
|
- <foreach collection="devtypePidList" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY d.devStatus
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceListByDevTypePids"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- SELECT
|
|
|
- d.*
|
|
|
- FROM
|
|
|
- IotDevice d
|
|
|
- LEFT JOIN IotDevicetype e ON d.devtypeBid = e.devtypeBid
|
|
|
- LEFT JOIN (SELECT tmnId FROM TmnBlock) c ON c.tmnId = d.devBid
|
|
|
- LEFT JOIN (SELECT tmnId FROM TmnLand) e ON e.tmnId = d.devBid
|
|
|
- WHERE
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePids != null and devTypePids.size() != 0">
|
|
|
- and e.devtypePid in
|
|
|
- <foreach collection="devTypePids" item="item" open="(" separator="," close=")" index="index">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- AND (c.tmnId IS NOT NULL
|
|
|
- or e.tmnId IS NOT NULL)
|
|
|
-
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceListByLandIdAndPids"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- SELECT d.*,c.tmnId from IotDevice d
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
- left join (
|
|
|
- SELECT tmnId from TmnLand where landId=#{landId}
|
|
|
- ) c on c.tmnId=d.devBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePids != null and devTypePids.size() != 0">
|
|
|
- and e.devtypePid in
|
|
|
- <foreach collection="devTypePids" index="index" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- and c.tmnId is not null
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
- </where>
|
|
|
- </select>
|
|
|
- <select id="selectIotDeviceListByBlockIdAndPids"
|
|
|
- resultType="com.yunfeiyun.agmp.iotm.device.domain.resvo.IotDeviceListResVo">
|
|
|
- SELECT d.*,c.tmnId from IotDevice d
|
|
|
-
|
|
|
- LEFT join IotDevicetype e on d.devtypeBid=e.devtypeBid
|
|
|
-
|
|
|
- left join (
|
|
|
- SELECT tmnId from TmnBlock where blockId=#{blockId}
|
|
|
- ) c on c.tmnId=d.devBid
|
|
|
- <where>
|
|
|
- devDelstatus = '0'
|
|
|
- <if test="devTypePids != null and devTypePids.size() != 0">
|
|
|
- and e.devtypePid in
|
|
|
- <foreach collection="devTypePids" index="index" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- and c.tmnId is not null
|
|
|
- GROUP BY
|
|
|
- d.devBid
|
|
|
-
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
-</mapper>
|
|
|
+</mapper>
|