|
...
|
...
|
@@ -14,6 +14,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<result property="product_id" column="product_id" />
|
|
|
|
<result property="mqtt_username" column="mqtt_username" />
|
|
|
|
<result property="data_update_time" column="data_update_time" />
|
|
|
|
<association property="userTerminalGroupRelation" column="id" javaType="UserTerminalGroupRelation" resultMap="userTerminalGroupRelationResult" />
|
|
|
|
<association property="iotDevice" column="device_id" javaType="IotDevice" resultMap="iotDeviceResult" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap type="UserTerminalGroupRelation" id="userTerminalGroupRelationResult">
|
|
|
|
<result property="create_time" column="create_time" />
|
|
|
|
<result property="iot_terminal_group_id" column="iot_terminal_group_id" />
|
|
|
|
<result property="iot_terminal_group_name" column="iot_terminal_group_name" />
|
|
|
|
<result property="iot_terminal_id" column="iot_terminal_id" />
|
|
|
|
<result property="user_info_id" column="user_info_id" />
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<resultMap type="IotDevice" id="iotDeviceResult">
|
|
|
|
<result property="active_time" column="active_time" />
|
|
|
|
<result property="client_id" column="client_id" />
|
|
|
|
<result property="completion_auth" column="completion_auth" />
|
|
|
|
<result property="create_by" column="create_by" />
|
|
|
|
<result property="create_time" column="create_time" />
|
|
|
|
<result property="del_flag" column="del_flag" />
|
|
|
|
<result property="firmware_version" column="firmware_version" />
|
|
|
|
<result property="img_url" column="img_url" />
|
|
|
|
<result property="is_shadow" column="is_shadow" />
|
|
|
|
<result property="latitude" column="latitude" />
|
|
|
|
<result property="location_way" column="location_way" />
|
|
|
|
<result property="longitude" column="longitude" />
|
|
|
|
<result property="name" column="name" />
|
|
|
|
<result property="network_address" column="network_address" />
|
|
|
|
<result property="network_ip" column="network_ip" />
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
<result property="rssi" column="rssi" />
|
|
|
|
<result property="status" column="status" />
|
|
|
|
<result property="summary" column="summary" />
|
|
|
|
<result property="things_model_value" column="things_model_value" />
|
|
|
|
<result property="update_by" column="update_by" />
|
|
|
|
<result property="update_time" column="update_time" />
|
|
|
|
<result property="product_id" column="product_id" />
|
|
|
|
<result property="mqtt_username" column="mqtt_username" />
|
|
|
|
<result property="payload_type" column="payload_type" />
|
|
|
|
<result property="things_model_config" column="things_model_config" />
|
|
|
|
<result property="listen_service_ip" column="listen_service_ip" />
|
|
|
|
<result property="device_life" column="device_life" />
|
|
|
|
<result property="data_update_time" column="data_update_time" />
|
|
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectIotTerminalVo">
|
|
...
|
...
|
@@ -37,6 +80,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectIotTerminalListByUserId" parameterType="IotTerminal" resultMap="IotTerminalResult">
|
|
|
|
SELECT a.*,b.*,c.* FROM `iot_terminal` a LEFT JOIN `user_terminal_group_relation` b ON a.`id`=b.`iot_terminal_id` LEFT JOIN `iot_device` c ON c.client_id=a.`device_id`
|
|
|
|
<where>
|
|
|
|
<if test="device_id !=null and device_id != ''">
|
|
|
|
and a.device_id = #{device_id}
|
|
|
|
</if>
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
AND (a.`name` like concat('%', #{name}, '%') or a.`id` like concat('%', #{name}, '%') or a.device_id like concat('%', #{name}, '%'))
|
|
|
|
</if>
|
|
|
|
<if test="id != null and id != ''">
|
|
|
|
AND a.`id` like concat('%', #{id}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="product_id !=null and product_id != ''">
|
|
|
|
and a.product_id = #{product_id}
|
|
|
|
</if>
|
|
|
|
<if test="mqtt_username != null and mqtt_username != ''">
|
|
|
|
AND a.`mqtt_username` = #{mqtt_username}
|
|
|
|
</if>
|
|
|
|
and b.user_info_id = #{userTerminalGroupRelation.user_info_id}
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectIotTerminalById" parameterType="String" resultMap="IotTerminalResult">
|
|
|
|
<include refid="selectIotTerminalVo"/>
|
|
...
|
...
|
@@ -99,7 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
<select id="selectNotUserIotTerminalListByImei" parameterType="String" resultMap="IotTerminalResult">
|
|
|
|
SELECT a.* FROM `iot_terminal` a LEFT JOIN `user_terminal_group_relation` b ON a.`id`=b.`iot_terminal_id` WHERE b.user_info_id is not null AND a.`device_id`= #{device_id}
|
|
|
|
SELECT a.* FROM `iot_terminal` a LEFT JOIN `user_terminal_group_relation` b ON a.`id`=b.`iot_terminal_id` WHERE b.user_info_id is null AND a.`device_id`= #{device_id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|