mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
分享设备列表接口以及sql修改
This commit is contained in:
@@ -45,7 +45,7 @@ public class DeviceController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<Device> list = new ArrayList<>();
|
||||
if(device.getUserName()==null || device.getUserName()=="" )
|
||||
if(device.getUserId() == null)
|
||||
{
|
||||
list = deviceService.selectDeviceList(device);
|
||||
}else {
|
||||
@@ -65,7 +65,7 @@ public class DeviceController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<DeviceShortOutput> list = new ArrayList<>();
|
||||
if(device.getUserName()==null || device.getUserName()=="" )
|
||||
if(device.getUserId() == null)
|
||||
{
|
||||
list = deviceService.selectDeviceShortList(device);
|
||||
}else {
|
||||
|
||||
@@ -167,10 +167,7 @@ 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}
|
||||
or device_id in (select device_id from iot_device_user where iot_device_user.user_name = #{userName})
|
||||
</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</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>
|
||||
@@ -180,24 +177,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceShortListAccurate" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
<include refid="selectDeviceShortVo"/>
|
||||
select device.device_id, device.device_name, device.product_id, device.product_name,
|
||||
device.user_id, device.user_name, device.tenant_id, device.tenant_name, device.serial_number,
|
||||
device.firmware_version, device.status,device.rssi,device.is_shadow ,device.is_custom_location,
|
||||
device.things_model_value, device.active_time,img_url
|
||||
|
||||
from iot_device_user device_user
|
||||
inner join iot_device device on device_user.device_id = device.device_id
|
||||
<where>
|
||||
<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>
|
||||
<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>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
<if test="userId != null and userId != ''"> and device_user.user_id = #{userId} </if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
order by device.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||
|
||||
Reference in New Issue
Block a user