| | |
| | | <result property="tenantName" column="tenant_name"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="DeviceAndDeviceOrderResult" type="com.ruoyi.iot.domain.Device"> |
| | | <result property="deviceId" column="device_id"/> |
| | | <result property="deviceName" column="device_name"/> |
| | | <result property="productId" column="product_id"/> |
| | | <result property="productName" column="product_name"/> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="userName" column="user_name"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="tenantName" column="tenant_name"/> |
| | | <result property="serialNumber" column="serial_number"/> |
| | | <result property="firmwareVersion" column="firmware_version"/> |
| | | <result property="status" column="status"/> |
| | | <result property="activeTime" column="active_time"/> |
| | | <result property="rssi" column="rssi"/> |
| | | <result property="isShadow" column="is_shadow"/> |
| | | <result property="locationWay" column="location_way"/> |
| | | <result property="thingsModelValue" column="things_model_value"/> |
| | | <result property="imgUrl" column="img_url"/> |
| | | <result property="assignTime" column="assign_time"/> |
| | | <result property="tDSP" column="tds_p"/> |
| | | <result property="tDSA" column="tds_a"/> |
| | | <result property="repairFlag" column="repair_flag"/> |
| | | <result property="installFlag" column="install_flag"/> |
| | | <collection property="deviceOrder" ofType="DeviceOrder" resultMap="DeviceOrderResult"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="DeviceOrderResult" type="DeviceOrder"> |
| | | <result property="userName" column="deusername"/> |
| | | <result property="userPhone" column="deuserphone"/> |
| | | </resultMap> |
| | | <sql id="selectDeviceVo"> |
| | | select device_id, |
| | | device_name, |
| | |
| | | <if test="groupId != null and groupId !=0 "> |
| | | left join iot_device_group g on g.device_id=d.device_id |
| | | </if> |
| | | |
| | | <where> |
| | | <if test="groupId != null and groupId !=0 "> |
| | | and g.group_id = #{groupId} |
| | |
| | | from iot_device |
| | | where serial_number = #{deviceNum} |
| | | </select> |
| | | <select id="selectCartridgeLifeList" resultMap="DeviceAndDeviceOrderResult"> |
| | | select |
| | | d.device_id, |
| | | d.device_name, |
| | | d.product_id, |
| | | d.product_name, |
| | | d.user_id, |
| | | d.user_name, |
| | | d.tenant_id, |
| | | su.nick_name tenant_name, |
| | | d.serial_number, |
| | | d.location_way, |
| | | d.things_model_value, |
| | | d.tds_p, |
| | | d.tds_a, |
| | | de.user_name as deusername, |
| | | de.user_phone as deuserphone |
| | | from iot_device d |
| | | inner join iot_device_order de on de.device_id = d.device_id |
| | | inner join sys_user su on su.user_id = d.tenant_id |
| | | <!-- <if test="groupId != null and groupId !=0 ">--> |
| | | <!-- left join iot_device_group g on g.device_id=d.device_id--> |
| | | <!-- </if>--> |
| | | where d.del_flag = '0' |
| | | <!-- <if test="groupId != null and groupId !=0 ">--> |
| | | <!-- and g.group_id = #{groupId}--> |
| | | <!-- </if>--> |
| | | <if test="tenantId != null and tenantId != 1"> |
| | | and d.tenant_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> |
| | | group by d.device_id,d.user_id |
| | | order by d.create_time desc |
| | | </select> |
| | | <!-- 根据tenantId去查询设备的物模型 --> |
| | | <select id="selectDeviceAll" resultMap="DeviceResult"> |
| | | select device_id, |
| | | device_name, |
| | | product_id, |
| | | product_name, |
| | | user_id, |
| | | user_name, |
| | | tenant_id, |
| | | serial_number, |
| | | firmware_version, |
| | | status, |
| | | rssi, |
| | | is_shadow, |
| | | location_way, |
| | | things_model_value, |
| | | assign_time, |
| | | active_time, |
| | | img_url, |
| | | tds_p, |
| | | tds_a, |
| | | repair_flag, |
| | | install_flag |
| | | from iot_device |
| | | where del_flag = '0' |
| | | </select> |
| | | <select id="selectDeviceById" resultType="com.ruoyi.iot.domain.Device"> |
| | | select d.device_id, |
| | | d.device_name, |
| | | d.product_id, |
| | | d.product_name, |
| | | d.user_id, |
| | | d.user_name, |
| | | d.tenant_id, |
| | | su.nick_name tenant_name, |
| | | d.serial_number, |
| | | d.location_way, |
| | | d.things_model_value, |
| | | d.tds_p, |
| | | d.tds_a, |
| | | de.user_name as deusername, |
| | | de.user_phone as deuserphone |
| | | from iot_device d |
| | | inner join iot_device_order de on de.device_id = d.device_id |
| | | inner join sys_user su on su.user_id = d.tenant_id |
| | | where device_id = #{deviceId} |
| | | and d.del_flag = '0' |
| | | </select> |
| | | |
| | | <delete id="deleteDeviceGroupByDeviceId" parameterType="com.ruoyi.iot.model.UserIdDeviceIdModel"> |
| | | delete from iot_device_group |