mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 17:05:55 +08:00
分享单个或全部设备功能实现,用户设备列表接口调整,新增别人分享给自己的设备
This commit is contained in:
@@ -129,10 +129,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceListAccurate" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
|
||||
<include refid="selectDeviceVo"/>
|
||||
<where>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName} </if>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
@@ -166,7 +167,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="userId != null ">
|
||||
and user_id = #{userId}
|
||||
or device_id in (select device_id from iot_device_user where iot_device_user.user_name = #{userName})
|
||||
</if>
|
||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
@@ -183,7 +187,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
and user_name = #{userName}
|
||||
or device_id in (select device_id from iot_device_user where iot_device_user.user_name = #{userName})
|
||||
</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name=#{tenantName}</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||
|
||||
@@ -36,10 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectDeviceUserVo"/>
|
||||
where device_id = #{deviceId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceUser" parameterType="com.ruoyi.iot.domain.DeviceUser" useGeneratedKeys="true" keyProperty="deviceId">
|
||||
|
||||
<select id="selectDeviceUserByDeviceIdAndUserId" resultMap="DeviceUserResult">
|
||||
<include refid="selectDeviceUserVo"/>
|
||||
where device_id = #{deviceId} and user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceUser" parameterType="com.ruoyi.iot.domain.DeviceUser" keyProperty="deviceId">
|
||||
insert into iot_device_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
@@ -55,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
@@ -71,6 +78,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertDeviceUserList" parameterType="java.util.ArrayList">
|
||||
insert into iot_device_user
|
||||
(device_id, user_id, device_name, user_name, is_owner,tenant_id,tenant_name,phonenumber, create_time) values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.deviceId},#{item.userId},#{item.deviceName}, #{item.userName}, #{item.isOwner}, #{item.tenantId},#{item.tenantName},#{item.phonenumber}, #{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceUser" parameterType="com.ruoyi.iot.domain.DeviceUser">
|
||||
update iot_device_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
@@ -88,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
where device_id = #{deviceId} and user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceUserByDeviceId" parameterType="Long">
|
||||
@@ -101,4 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDeviceUser">
|
||||
delete from iot_device_user where device_id = #{deviceId} and is_owner !=1 and user_id = #{userId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user