forked from dyf/fys-Multi-tenant
绑定设备分组
This commit is contained in:
@ -114,4 +114,21 @@ public class DeviceGroupController extends BaseController {
|
||||
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绑定设备分组
|
||||
*
|
||||
* @param groupId 分组id
|
||||
* @param deviceId 设备id
|
||||
*/
|
||||
@Operation(summary = "绑定设备分组")
|
||||
// @SaCheckPermission("fys-equipment:group:remove")
|
||||
@Log(title = "绑定设备分组", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/groupId/{deviceId}")
|
||||
public R<Void> bindingDevice(@NotEmpty(message = "分组id 不能为空") @PathVariable Long groupId,
|
||||
@NotEmpty(message = "设备id 不能为空") @PathVariable Long[] deviceId) {
|
||||
return toAjax(deviceGroupService.bindingDevice(groupId, deviceId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.fuyuanshen.equipment.service;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -56,4 +57,14 @@ public interface IDeviceGroupService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 绑定设备分组
|
||||
*
|
||||
* @param groupId 分组id
|
||||
* @param deviceId 设备id
|
||||
* @return 是否绑定成功
|
||||
*/
|
||||
Boolean bindingDevice(@NotEmpty(message = "分组id 不能为空") Long groupId, @NotEmpty(message = "设备id 不能为空") Long[] deviceId);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceTypeGrants;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -63,7 +64,7 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
||||
public List<DeviceGroupVo> queryList(DeviceGroupBo bo) {
|
||||
Page<Device> page = new Page<>(bo.getPageNum(), bo.getPageSize());
|
||||
// 1. 查询顶级分组(parent_id为null)
|
||||
IPage<DeviceGroup> rootGroups = baseMapper.selectRootGroups(bo, page);
|
||||
IPage<DeviceGroup> rootGroups = baseMapper.selectRootGroups(bo, page);
|
||||
List<DeviceGroup> records = rootGroups.getRecords();
|
||||
|
||||
// 2. 递归构建树形结构
|
||||
@ -169,4 +170,19 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定设备分组
|
||||
*
|
||||
* @param groupId 分组id
|
||||
* @param deviceId 设备id
|
||||
* @return 是否绑定成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindingDevice(Long groupId, Long[] deviceId) {
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user