select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number, gw_dev_code, firmware_version, status, rssi, is_shadow, is_simulate, location_way, things_model_value, network_address, network_ip, longitude, latitude, active_time, create_time, update_time, img_url, summary, imei, iccid, remark, slave_id, project_id, project_name from iot_device select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, status, rssi, is_shadow, is_simulate, location_way, things_model_value, active_time, imei, iccid, img_url, slave_id, project_id, project_name from iot_device select device_id, device_name, product_id, serial_number, tenant_id, tenant_name, status, is_shadow, is_simulate, rssi, location_way, things_model_value, active_time from iot_device update iot_device set things_model_value=#{stringValue} where device_id = #{deviceId} from iot_device d left join iot_product p on p.product_id=d.product_id left join iot_device_group g on g.device_id=d.device_id and d.gw_dev_code is null and (p.device_type is null or p.device_type != 4) and g.group_id = #{groupId} and d.device_name like concat('%', #{deviceName}, '%') and d.product_id = #{productId} and p.device_type = #{deviceType} and p.device_type in #{deviceTypeItem} and d.product_name like concat('%', #{productName}, '%') and d.serial_number = #{serialNumber} and d.gw_dev_code = #{gwDevCode} and d.status = #{status} and d.is_simulate = #{isSimulate} and d.project_id = #{projectId} and ( d.tenant_id in (SELECT u.user_id FROM sys_user u join sys_dept de on u.dept_id = de.dept_id WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId}) or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId}) ) and ( d.tenant_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}) ) group by d.device_id,d.tenant_id order by d.create_time desc insert into iot_device device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, status, rssi, is_shadow, location_way, things_model_value, network_address, network_ip, longitude, latitude, active_time, del_flag, create_by, create_time, update_by, update_time, remark, img_url, summary, gw_dev_code, is_simulate, slave_id, project_id, #{deviceName}, #{productId}, #{productName}, #{tenantId}, #{tenantName}, #{serialNumber}, #{firmwareVersion}, #{status}, #{rssi}, #{isShadow}, #{locationWay}, #{thingsModelValue}, #{networkAddress}, #{networkIp}, #{longitude}, #{latitude}, #{activeTime}, #{delFlag}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark}, #{imgUrl}, #{summary}, #{gwDevCode}, #{isSimulate}, #{slaveId}, #{projectId}, 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) values (#{device.deviceName}, #{device.productId}, #{device.productName}, #{device.tenantId}, #{device.tenantName}, #{device.serialNumber}, #{device.firmwareVersion}, #{device.rssi}, #{device.isShadow}, #{device.locationWay}, #{device.createBy}, sysdate()) update iot_device device_name = #{deviceName}, product_id = #{productId}, product_name = #{productName}, tenant_id = #{tenantId}, tenant_name = #{tenantName}, serial_number = #{serialNumber}, gw_dev_code = #{gwDevCode}, firmware_version = #{firmwareVersion}, status = #{status}, rssi = #{rssi}, is_shadow = #{isShadow}, is_simulate = #{isSimulate}, location_way = #{locationWay}, things_model_value = #{thingsModelValue}, network_address = #{networkAddress}, network_ip = #{networkIp}, longitude = #{longitude}, latitude = #{latitude}, active_time = #{activeTime}, del_flag = #{delFlag}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, img_url = #{imgUrl}, summary = #{summary}, imei = #{imei}, iccid = #{iccid}, slave_id = #{slaveId}, baseline_device_id = #{baselineDeviceId}, project_id = #{projectId}, where device_id = #{deviceId} update iot_device status = #{status}, network_address = #{networkAddress}, network_ip = #{networkIp}, longitude = #{longitude}, latitude = #{latitude}, active_time = #{activeTime}, update_time = #{updateTime,jdbcType=TIMESTAMP} where serial_number = #{serialNumber} or gw_dev_code = #{serialNumber} update iot_device set firmware_version = #{firmwareVersion,jdbcType=DECIMAL} where serial_number = #{serialNumber,jdbcType=VARCHAR} -- 设备状态(1-未激活,2-禁用,3-在线,4-离线) update iot_device set status=4 where serial_number = #{serialNumber} and status = 3 update iot_device device_name = #{deviceName}, product_id = #{productId}, product_name = #{productName}, tenant_id = #{tenantId}, tenant_name = #{tenantName}, serial_number = #{serialNumber}, firmware_version = #{firmwareVersion}, status = #{status}, rssi = #{rssi}, is_shadow = #{isShadow}, is_simulate = #{isSimulate}, location_way = #{locationWay}, things_model_value = #{thingsModelValue}, network_address = #{networkAddress}, network_ip = #{networkIp}, longitude = #{longitude}, latitude = #{latitude}, active_time = #{activeTime}, del_flag = #{delFlag}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, img_url = #{imgUrl}, summary = #{summary}, gw_dev_code = #{gwDevCode}, imei = #{imei}, iccid = #{iccid}, where serial_number = #{serialNumber} delete from iot_device where device_id = #{deviceId} delete from iot_device where device_id in #{deviceId} delete from iot_device_group and device_id = #{deviceId} and group_id in(select group_id from iot_group where user_id = #{userId}) update iot_device d set d.status = 3, d.update_time = now() where d.serial_number in #{item} update iot_device d set d.status = 4, d.update_time = now() where d.serial_number in #{item} update iot_device set status = 4 where status = 3 update iot_device set tenant_id = #{tenantId}, tenant_name = #{tenantName} ,project_id = null where device_id in #{deviceId} update iot_device set tenant_id = #{tenantId}, tenant_name = #{tenantName}, update_time = now() where device_id = #{deviceId} update iot_device set project_id = #{projectId} where device_id in #{id} update iot_device set project_id = null where project_id = #{projectId} and device_id not in #{id} update iot_device set project_id = null where project_id in #{id}