mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 08:25:53 +08:00
分组中添加设备
This commit is contained in:
@@ -48,7 +48,19 @@ public class DeviceController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备简短列表
|
||||
* 查询分组可添加设备
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/listByGroup")
|
||||
@ApiOperation("查询分组可添加设备分页列表")
|
||||
public TableDataInfo listByGroup(Device device)
|
||||
{
|
||||
startPage();
|
||||
return getDataTable(deviceService.selectDeviceListByGroup(device));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备简短列表,主页列表数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/shortList")
|
||||
|
||||
@@ -102,9 +102,20 @@ public class Device extends BaseEntity
|
||||
/** 设备摘要 **/
|
||||
private String summary;
|
||||
|
||||
/** 分组ID,用于分组查询 **/
|
||||
private Long groupId;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return summary;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,14 @@ public interface DeviceMapper
|
||||
*/
|
||||
public List<Device> selectDeviceList(Device device);
|
||||
|
||||
/**
|
||||
* 查询分组可添加设备分页列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<Device> selectDeviceListByGroup(Device device);
|
||||
|
||||
/**
|
||||
* 查询设备简短列表
|
||||
*
|
||||
|
||||
@@ -71,6 +71,14 @@ public interface IDeviceService
|
||||
*/
|
||||
public List<Device> selectDeviceList(Device device);
|
||||
|
||||
/**
|
||||
* 查询分组可添加设备分页列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<Device> selectDeviceListByGroup(Device device);
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*
|
||||
|
||||
@@ -230,6 +230,20 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
return deviceMapper.selectDeviceList(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分组可添加设备分页列表(分组用户与设备用户匹配)
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备
|
||||
*/
|
||||
@Override
|
||||
public List<Device> selectDeviceListByGroup(Device device) {
|
||||
if(device.getUserId()==null || device.getUserId()==0){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return deviceMapper.selectDeviceListByGroup(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*
|
||||
|
||||
@@ -126,6 +126,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceListByGroup" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
|
||||
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.location_way, 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 u.user_id = #{userId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="networkAddress != null and networkAddress != ''"> and d.network_address like concat('%', #{networkAddress}, '%')</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>
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||
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.location_way, d.active_time,d.network_address,d.longitude,latitude
|
||||
@@ -147,14 +165,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name,
|
||||
d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow ,d.location_way,
|
||||
d.things_model_value, d.active_time,img_url
|
||||
d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow ,d.location_way,
|
||||
d.things_model_value, d.active_time,d.img_url,g.group_id,u.user_id
|
||||
from iot_device d
|
||||
left join iot_device_user u on u.device_id = d.device_id
|
||||
left join iot_device_group g on g.device_id=d.device_id
|
||||
<where>
|
||||
<if test="userId != null "> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
|
||||
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
|
||||
<if test="userId != null and userId != 0"> and u.user_id = #{userId}</if>
|
||||
<if test="tenantId != null and tenantId != 0"> and d.tenant_id = #{tenantId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
||||
|
||||
Reference in New Issue
Block a user