多租户调整

This commit is contained in:
kerwincui
2022-06-05 00:18:29 +08:00
parent 3fea5132ce
commit 6e0becee7c
6 changed files with 27 additions and 9 deletions

View File

@@ -125,10 +125,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow ,
is_custom_location, active_time,network_address,longitude,latitude from iot_device
select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow ,
d.is_custom_location, d.active_time,d.network_address,d.longitude,latitude
from iot_device d
left join iot_device_user u on u.device_id = d.device_id
<where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userId != null "> and u.user_id = #{userId}</if>
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
</where>
</select>

View File

@@ -51,9 +51,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>
<select id="selectProductShortList" parameterType="Long" resultMap="ProductShortResult">
<select id="selectProductShortList" parameterType="com.ruoyi.iot.domain.Product" resultMap="ProductShortResult">
select product_id,product_name from iot_product
where tenant_id=#{userId} or is_sys = 1
<where>
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId}</if>
</where>
order by create_time desc
</select>