提交修改
This commit is contained in:
@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="remark" column="remark" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.domain.Scene" id="AlertSceneResult">
|
||||
@@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAlertVo">
|
||||
select alert_id, alert_name, alert_level, status, notify, create_by, create_time, update_by, update_time, remark, tenant_id, tenant_name from iot_alert
|
||||
select alert_id, alert_name, alert_level, status, notify, create_by, create_time, update_by, update_time, remark, tenant_id, tenant_name,serial_number from iot_alert
|
||||
</sql>
|
||||
|
||||
<select id="selectScenesByAlertId" parameterType="Long" resultMap="AlertSceneResult">
|
||||
@@ -53,16 +54,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join iot_scene s on a.scene_id = s.scene_id
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteSceneByAlertId" parameterType="Long">
|
||||
delete from iot_scene where scene_id in (select scene_id from iot_alert_scene where alert_id = #{alertId})
|
||||
</delete>
|
||||
|
||||
<select id="selectAlertList" parameterType="Alert" resultMap="AlertResult">
|
||||
<include refid="selectAlertVo"/>
|
||||
select p.alert_id, p.alert_name, p.alert_level, p.status, p.notify, p.create_by, p.create_time,
|
||||
p.update_by, p.update_time, p.remark, p.tenant_id, p.tenant_name,p.serial_number from iot_alert p
|
||||
<where>
|
||||
<if test="alertName != null and alertName != ''"> and alert_name like concat('%', #{alertName}, '%')</if>
|
||||
<if test="alertLevel != null "> and alert_level = #{alertLevel}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="notify != null and notify != ''"> and notify = #{notify}</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="alertName != null and alertName != ''"> and p.alert_name like concat('%', #{alertName}, '%')</if>
|
||||
<if test="alertLevel != null "> and p.alert_level = #{alertLevel}</if>
|
||||
<if test="status != null "> and p.status = #{status}</if>
|
||||
<if test="notify != null and notify != ''"> and p.notify = #{notify}</if>
|
||||
<if test="tenantId != null "> and p.tenant_id = #{tenantId}</if>
|
||||
<!-- <if test="deptId != null ">-->
|
||||
<!-- and ( p.tenant_id = #{tenantId}-->
|
||||
<!-- or (p.tenant_id in (-->
|
||||
<!-- SELECT de.dept_user_id-->
|
||||
<!-- FROM sys_dept de-->
|
||||
<!-- WHERE FIND_IN_SET( de.dept_id,(-->
|
||||
<!-- SELECT d.ancestors-->
|
||||
<!-- FROM sys_dept d-->
|
||||
<!-- WHERE d.dept_id = #{deptId} )-->
|
||||
<!-- )-->
|
||||
<!-- )-->
|
||||
<!-- )-->
|
||||
<!-- )-->
|
||||
<!-- </if>-->
|
||||
<if test="serialNumber != null and serialNumber != ''">and p.serial_number = #{serialNumber}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
order by p.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAlertByAlertId" parameterType="Long" resultMap="AlertResult">
|
||||
@@ -110,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="alertName != null and alertName != ''">#{alertName},</if>
|
||||
@@ -123,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -138,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
||||
</trim>
|
||||
where alert_id = #{alertId}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?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.xinda.iot.mapper.SpDeviceMapper">
|
||||
|
||||
<resultMap type="CamDevice" id="CamDeviceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sipId" column="sip_id" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCamDeviceVo">
|
||||
select id, sip_id, device_id, create_by, create_time, update_by, update_time, del_flag from iot_sip_device
|
||||
</sql>
|
||||
|
||||
<select id="selectCamDeviceList" parameterType="CamDevice" resultMap="CamDeviceResult">
|
||||
<include refid="selectCamDeviceVo"/>
|
||||
<where>
|
||||
<if test="sipId != null "> and sip_id = #{sipId}</if>
|
||||
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCamDeviceById" parameterType="Long" resultMap="CamDeviceResult">
|
||||
<include refid="selectCamDeviceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCamDevice" parameterType="CamDevice" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into iot_sip_device
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sipId != null">sip_id,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sipId != null">#{sipId},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCamDevice" parameterType="CamDevice">
|
||||
update iot_sip_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sipId != null">sip_id = #{sipId},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCamDeviceById" parameterType="Long">
|
||||
delete from iot_sip_device where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteCamDeviceBySipId" parameterType="Long">
|
||||
delete from iot_sip_device where sip_id = #{sipId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCamDeviceByIds" parameterType="String">
|
||||
delete from iot_sip_device where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -37,6 +37,14 @@
|
||||
<result property="guid" column="guid"/>
|
||||
<result property="groupId" column="group_id"/>
|
||||
<result property="agenciesId" column="agencies_id"/>
|
||||
<result property="icWay" column="ic_way"/>
|
||||
<result property="iccid" column="iccid"/>
|
||||
<result property="volt" column="volt"/>
|
||||
<result property="sd" column="sd"/>
|
||||
<result property="pd" column="pd"/>
|
||||
<result property="imei" column="imei"/>
|
||||
<result property="gwId" column="gw_id"/>
|
||||
<result property="gwName" column="gw_name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
||||
@@ -67,6 +75,14 @@
|
||||
<result property="guid" column="guid"/>
|
||||
<result property="groupId" column="group_id"/>
|
||||
<result property="agenciesId" column="agencies_id"/>
|
||||
<result property="icWay" column="ic_way"/>
|
||||
<result property="iccid" column="iccid"/>
|
||||
<result property="volt" column="volt"/>
|
||||
<result property="sd" column="sd"/>
|
||||
<result property="pd" column="pd"/>
|
||||
<result property="imei" column="imei"/>
|
||||
<result property="gwId" column="gw_id"/>
|
||||
<result property="gwName" column="gw_name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
||||
@@ -87,6 +103,14 @@
|
||||
<result property="latitude" column="latitude"/>
|
||||
<result property="isOwner" column="is_owner"/>
|
||||
<result property="subDeviceCount" column="sub_device_count"/>
|
||||
<result property="icWay" column="ic_way"/>
|
||||
<result property="iccid" column="iccid"/>
|
||||
<result property="volt" column="volt"/>
|
||||
<result property="sd" column="sd"/>
|
||||
<result property="pd" column="pd"/>
|
||||
<result property="imei" column="imei"/>
|
||||
<result property="gwId" column="gw_id"/>
|
||||
<result property="gwName" column="gw_name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.model.UserAndTenant" id="UserAndTenantResult">
|
||||
@@ -192,7 +216,13 @@
|
||||
img_url,
|
||||
summary,
|
||||
remark,
|
||||
slave_id,group_id,agencies_id
|
||||
slave_id,
|
||||
group_id,
|
||||
agencies_id,
|
||||
ic_way,
|
||||
iccid,
|
||||
volt,
|
||||
sd,pd,imei, gw_id, gw_name
|
||||
from iot_device
|
||||
</sql>
|
||||
|
||||
@@ -213,7 +243,12 @@
|
||||
things_model_value,
|
||||
active_time,
|
||||
img_url,
|
||||
slave_id,group_id,agencies_id
|
||||
slave_id,
|
||||
group_id,
|
||||
agencies_id,
|
||||
ic_way,
|
||||
iccid,
|
||||
volt,sd,pd,imei, gw_id, gw_name
|
||||
from iot_device
|
||||
</sql>
|
||||
|
||||
@@ -230,7 +265,9 @@
|
||||
rssi,
|
||||
location_way,
|
||||
things_model_value,
|
||||
active_time,group_id,agencies_id
|
||||
active_time,
|
||||
group_id,
|
||||
agencies_id
|
||||
from iot_device
|
||||
</sql>
|
||||
|
||||
@@ -263,6 +300,8 @@
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||
and active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||
</if>
|
||||
<if test="gwId != null "> and gw_id = #{gwId}</if>
|
||||
<if test="gwName != null and gwName != ''"> and gw_name like concat('%', #{gwName}, '%')</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@@ -305,8 +344,8 @@
|
||||
<select id="selectDeviceListByGroup" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version,
|
||||
d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
from iot_device d
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude, d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
|
||||
from iot_device d,sd,pd
|
||||
<where>
|
||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||
@@ -340,7 +379,7 @@
|
||||
<select id="selectAllDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||
select d.device_id, d.device_name, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<where>
|
||||
@@ -354,6 +393,7 @@
|
||||
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
|
||||
and d.tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
|
||||
</if>
|
||||
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
|
||||
</where>
|
||||
group by d.device_id,d.tenant_id
|
||||
</select>
|
||||
@@ -398,7 +438,7 @@
|
||||
<select id="selectDeviceGShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url)
|
||||
as img_url,
|
||||
case
|
||||
@@ -429,7 +469,7 @@
|
||||
<if test="agenciesId == null">and d.agencies_id IS NULL</if>
|
||||
<if test="agenciesId != null">and d.agencies_id = #{agenciesId}</if>
|
||||
<!-- <if test="groupIdExclude != null">and d.group_id != #{groupIdExclude}</if>-->
|
||||
|
||||
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
|
||||
<if test="deptId != null and deptId != 0 and showChild != null and showChild ">
|
||||
and
|
||||
( d.tenant_id in (SELECT u.user_id FROM sys_user u
|
||||
@@ -500,7 +540,7 @@
|
||||
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
case
|
||||
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
|
||||
@@ -522,24 +562,115 @@
|
||||
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
||||
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and
|
||||
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
|
||||
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
|
||||
)
|
||||
</if>
|
||||
<!-- <if test="deptId != null and deptId != 0 and showChild != null and !showChild">-->
|
||||
<!-- and (-->
|
||||
<!-- d.agencies_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})-->
|
||||
<!-- or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})-->
|
||||
<!-- )-->
|
||||
<!-- </if>-->
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
</where>
|
||||
group by d.device_id,d.tenant_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceShortGwList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
case
|
||||
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
|
||||
<where>
|
||||
p.device_type != 3
|
||||
and d.del_flag = '0'
|
||||
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
|
||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
|
||||
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
||||
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and
|
||||
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
|
||||
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
|
||||
)
|
||||
</if>
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
</where>
|
||||
group by d.device_id,d.tenant_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceShortTreeList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
case
|
||||
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
|
||||
else 1
|
||||
end as is_owner,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
|
||||
<where>
|
||||
and d.del_flag = '0'
|
||||
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
and (p.device_type == 2 or p.device_type == 1 )
|
||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
|
||||
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
||||
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and
|
||||
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
|
||||
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
|
||||
)
|
||||
</if>
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
</where>
|
||||
group by d.device_id,d.tenant_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectCamDeviceListByDeviceId" parameterType="Long" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport,p.guid
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
<where>
|
||||
and d.del_flag = '0'
|
||||
and
|
||||
( d.device_id in ( select sd.sip_id from iot_sip_device sd where sd.device_id = #{deviceId} )
|
||||
)
|
||||
</where>
|
||||
group by d.device_id,d.tenant_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||
select d.device_id,
|
||||
d.device_name,
|
||||
@@ -568,7 +699,10 @@
|
||||
d.remark,
|
||||
p.guid,
|
||||
d.group_id,
|
||||
d.agencies_id
|
||||
d.agencies_id,
|
||||
d.ic_way,
|
||||
d.iccid,
|
||||
d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
|
||||
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id = d.product_id
|
||||
@@ -749,6 +883,14 @@
|
||||
<if test="slaveId != null">slave_id,</if>
|
||||
<if test="groupId != null">group_id,</if>
|
||||
<if test="agenciesId != null">agencies_id,</if>
|
||||
<if test="icWay != null">ic_way,</if>
|
||||
<if test="iccid != null">iccid,</if>
|
||||
<if test="volt != null">volt,</if>
|
||||
<if test="sd != null">sd,</if>
|
||||
<if test="pd != null">pd,</if>
|
||||
<if test="imei != null">imei,</if>
|
||||
<if test="gwId != null">gw_id,</if>
|
||||
<if test="gwName != null">gw_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
@@ -781,13 +923,21 @@
|
||||
<if test="slaveId != null">#{slaveId},</if>
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
<if test="agenciesId != null">#{agenciesId},</if>
|
||||
<if test="icWay != null">#{icWay},</if>
|
||||
<if test="iccid != null">#{iccid},</if>
|
||||
<if test="volt != null">#{volt},</if>
|
||||
<if test="sd != null">#{sd},</if>
|
||||
<if test="pd != null">#{pd},</if>
|
||||
<if test="imei != null">#{imei},</if>
|
||||
<if test="gwId != null">#{gwId},</if>
|
||||
<if test="gwName != null">#{gwName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true"
|
||||
keyProperty="deviceId">
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||
firmware_version, rssi, is_shadow, location_way, create_by, create_time)
|
||||
firmware_version, rssi, is_shadow, location_way, create_by, create_time,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name)
|
||||
values
|
||||
<foreach collection="deviceList" item="device" separator=",">
|
||||
(#{device.deviceName},
|
||||
@@ -801,7 +951,15 @@
|
||||
#{device.isShadow},
|
||||
#{device.locationWay},
|
||||
#{device.createBy},
|
||||
sysdate())
|
||||
sysdate(),
|
||||
#{device.icWay},
|
||||
#{device.iccid},
|
||||
#{device.volt}),
|
||||
#{device.sd}),
|
||||
#{device.pd}),
|
||||
#{device.imei}),
|
||||
#{device.gwId}),
|
||||
#{device.geName})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -838,6 +996,14 @@
|
||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||
<if test="groupId != null">group_id = #{groupId},</if>
|
||||
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
|
||||
<if test="icWay != null">ic_way = #{icWay},</if>
|
||||
<if test="iccid != null">iccid = #{iccid},</if>
|
||||
<if test="volt != null">volt = #{volt},</if>
|
||||
<if test="pd != null">pd = #{pd},</if>
|
||||
<if test="sd != null">sd = #{sd},</if>
|
||||
<if test="imei != null">imei = #{imei},</if>
|
||||
<if test="gwId != null">gw_id = #{gwId},</if>
|
||||
<if test="gwName != null">gw_name = #{gwName},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
@@ -852,8 +1018,14 @@
|
||||
<if test="latitude != null">latitude = #{latitude},</if>
|
||||
<if test="activeTime != null">active_time = #{activeTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP}</if>
|
||||
|
||||
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="icWay != null">ic_way = #{icWay},</if>
|
||||
<if test="iccid != null">iccid = #{iccid},</if>
|
||||
<if test="volt != null">volt = #{volt},</if>
|
||||
<if test="rssi != null">rssi = #{rssi},</if>
|
||||
<if test="pd != null">pd = #{pd},</if>
|
||||
<if test="sd != null">sd = #{sd},</if>
|
||||
<if test="imei != null">imei = #{imei}</if>
|
||||
</trim>
|
||||
where serial_number = #{serialNumber} or gw_dev_code = #{serialNumber}
|
||||
</update>
|
||||
@@ -905,6 +1077,14 @@
|
||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||
<if test="groupId != null">group_id = #{groupId},</if>
|
||||
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
|
||||
<if test="icWay != null">ic_way = #{icWay},</if>
|
||||
<if test="iccid != null">iccid = #{iccid},</if>
|
||||
<if test="volt != null">volt = #{volt},</if>
|
||||
<if test="pd != null">pd = #{pd},</if>
|
||||
<if test="sd != null">sd = #{sd},</if>
|
||||
<if test="imei != null">imei = #{imei},</if>
|
||||
<if test="gwId != null">gw_id = #{gwId},</if>
|
||||
<if test="gwName != null">gw_name = #{gwName},</if>
|
||||
</trim>
|
||||
where serial_number = #{serialNumber}
|
||||
</update>
|
||||
@@ -1060,7 +1240,7 @@
|
||||
<select id="listTerminalUser" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
d.things_model_value, d.active_time,d.create_time,d.img_url,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
p.protocol_code,p.transport, u.is_owner
|
||||
@@ -1132,8 +1312,7 @@
|
||||
|
||||
<select id="listTerminalUserByGroup" resultType="com.xinda.iot.domain.Device">
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version,
|
||||
d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
d.status,d.rssi,d.is_shadow ,d.location_way, d.active_time,d.network_address,d.longitude,d.latitude, d.ic_way,d.iccid,d.voltd.sd,d.pd,d.imei, d.gw_id, d.gw_name,
|
||||
from (
|
||||
select device_id, 1 AS is_owner
|
||||
from iot_device_user
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<?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.xinda.iot.mapper.DocMapper">
|
||||
|
||||
<resultMap type="Doc" id="DocResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="fileName" column="file_name" />
|
||||
<result property="resourceUrl" column="resource_url" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDocVo">
|
||||
select d.id, d.dept_id, d.dept_name, d.file_name, d.resource_url, d.tenant_id, d.tenant_name, d.create_by, d.create_time, d.update_by, d.update_time from iot_doc d
|
||||
</sql>
|
||||
|
||||
<select id="selectDocList" parameterType="Doc" resultMap="DocResult">
|
||||
<include refid="selectDocVo"/>
|
||||
<where>
|
||||
<!-- <if test="deptId != null "> and dept_id = #{deptId}</if>-->
|
||||
<if test="deptId != null and deptId != 0 ">
|
||||
and
|
||||
( d.dept_id in (SELECT de.dept_id FROM sys_dept de
|
||||
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
|
||||
)
|
||||
</if>
|
||||
<if test="deptName != null and deptName != ''"> and d.dept_name like concat('%', #{deptName}, '%')</if>
|
||||
<if test="fileName != null and fileName != ''"> and d.file_name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="resourceUrl != null and resourceUrl != ''"> and d.resource_url = #{resourceUrl}</if>
|
||||
<!-- <if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>-->
|
||||
<if test="tenantName != null and tenantName != ''"> and d.tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDocById" parameterType="Long" resultMap="DocResult">
|
||||
<include refid="selectDocVo"/>
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDoc" parameterType="Doc" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into iot_doc
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="deptName != null">dept_name,</if>
|
||||
<if test="fileName != null">file_name,</if>
|
||||
<if test="resourceUrl != null">resource_url,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null">tenant_name,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="deptName != null">#{deptName},</if>
|
||||
<if test="fileName != null">#{fileName},</if>
|
||||
<if test="resourceUrl != null">#{resourceUrl},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null">#{tenantName},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDoc" parameterType="Doc">
|
||||
update iot_doc
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="deptName != null">dept_name = #{deptName},</if>
|
||||
<if test="fileName != null">file_name = #{fileName},</if>
|
||||
<if test="resourceUrl != null">resource_url = #{resourceUrl},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null">tenant_name = #{tenantName},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDocById" parameterType="Long">
|
||||
delete from iot_doc where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDocByIds" parameterType="String">
|
||||
delete from iot_doc where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -55,7 +55,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
end as is_owner,
|
||||
p.location_way from iot_product p
|
||||
<where>
|
||||
<!-- <if test="deptId != null and showSenior and !isAdmin">-->
|
||||
<if test="deptId != null and showSenior ">
|
||||
and ( p.tenant_id = #{tenantId}
|
||||
or (p.tenant_id in (
|
||||
SELECT de.dept_user_id
|
||||
FROM sys_dept de
|
||||
WHERE FIND_IN_SET( de.dept_id,(
|
||||
SELECT d.ancestors
|
||||
FROM sys_dept d
|
||||
WHERE d.dept_id = #{deptId} )
|
||||
)
|
||||
)
|
||||
and p.is_sys = 0
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="deptId != null and !showSenior ">
|
||||
and ( p.tenant_id = #{tenantId}
|
||||
or (p.tenant_id in (
|
||||
SELECT de.dept_user_id
|
||||
FROM sys_dept de
|
||||
WHERE de.dept_id = #{deptId} )
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<!-- <if test="deptId != null">-->
|
||||
<!-- and ( p.tenant_id = #{tenantId}-->
|
||||
<!-- or (p.tenant_id in (-->
|
||||
<!-- SELECT de.dept_user_id-->
|
||||
@@ -74,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- and p.tenant_id = #{tenantId}-->
|
||||
<!-- </if>-->
|
||||
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="productNameExclude != null and productNameExclude != ''"> and p.product_name != #{productNameExclude}</if>
|
||||
<!-- <if test="productNameExclude != null and productNameExclude != ''"> and p.product_name != #{productNameExclude}</if>-->
|
||||
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="modelName != null and modelName != ''"> and p.model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="proName != null and proName != ''"> and p.pro_name like concat('%', #{proName}, '%')</if>
|
||||
@@ -347,6 +371,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where p.product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectScadaIdByGuid" resultType="Long">
|
||||
select id
|
||||
from scada
|
||||
where guid = #{guid}
|
||||
</select>
|
||||
|
||||
<select id="selectListScadaIdByGuidS" resultType="com.xinda.iot.domain.Product">
|
||||
select id scadaId, guid
|
||||
from scada
|
||||
|
||||
Reference in New Issue
Block a user