Compare commits
15 Commits
f9d9dadf08
...
prod
Author | SHA1 | Date | |
---|---|---|---|
82399cffed | |||
5538ac96e5 | |||
b703f80355 | |||
b3b249ea07 | |||
aff424e73b | |||
dc513a858a | |||
df5ce7ddd9 | |||
2174dfdb4d | |||
2800b89e06 | |||
637e46c510 | |||
31c2158c8e | |||
c7c21dc358 | |||
a7e0803b00 | |||
55cacbd322 | |||
99ec6eaff0 |
@ -114,21 +114,4 @@ public class DeviceGroupController extends BaseController {
|
|||||||
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ spring.boot.admin.client:
|
|||||||
metadata:
|
metadata:
|
||||||
username: ${spring.boot.admin.client.username}
|
username: ${spring.boot.admin.client.username}
|
||||||
userpassword: ${spring.boot.admin.client.password}
|
userpassword: ${spring.boot.admin.client.password}
|
||||||
username: @monitor.username@
|
username: ${monitor.username}
|
||||||
password: @monitor.password@
|
password: ${monitor.password}
|
||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
|
@ -11,8 +11,8 @@ spring.boot.admin.client:
|
|||||||
metadata:
|
metadata:
|
||||||
username: ${spring.boot.admin.client.username}
|
username: ${spring.boot.admin.client.username}
|
||||||
userpassword: ${spring.boot.admin.client.password}
|
userpassword: ${spring.boot.admin.client.password}
|
||||||
username: @monitor.username@
|
username: ${monitor.username}
|
||||||
password: @monitor.password@
|
password: ${monitor.password}
|
||||||
|
|
||||||
--- # snail-job 配置
|
--- # snail-job 配置
|
||||||
snail-job:
|
snail-job:
|
||||||
|
@ -3,7 +3,6 @@ package com.fuyuanshen.equipment.service;
|
|||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,14 +56,4 @@ public interface IDeviceGroupService {
|
|||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
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);
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.fuyuanshen.equipment.service.impl;
|
package com.fuyuanshen.equipment.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
@ -12,8 +11,6 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
|||||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
import com.fuyuanshen.equipment.domain.Device;
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceTypeGrants;
|
import com.fuyuanshen.equipment.domain.DeviceTypeGrants;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -25,7 +22,6 @@ import com.fuyuanshen.equipment.mapper.DeviceGroupMapper;
|
|||||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -43,7 +39,6 @@ import java.util.stream.Collectors;
|
|||||||
public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
||||||
|
|
||||||
private final DeviceGroupMapper baseMapper;
|
private final DeviceGroupMapper baseMapper;
|
||||||
private final DeviceMapper deviceMapper;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +63,7 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
|||||||
public List<DeviceGroupVo> queryList(DeviceGroupBo bo) {
|
public List<DeviceGroupVo> queryList(DeviceGroupBo bo) {
|
||||||
Page<Device> page = new Page<>(bo.getPageNum(), bo.getPageSize());
|
Page<Device> page = new Page<>(bo.getPageNum(), bo.getPageSize());
|
||||||
// 1. 查询顶级分组(parent_id为null)
|
// 1. 查询顶级分组(parent_id为null)
|
||||||
IPage<DeviceGroup> rootGroups = baseMapper.selectRootGroups(bo, page);
|
IPage<DeviceGroup> rootGroups = baseMapper.selectRootGroups(bo, page);
|
||||||
List<DeviceGroup> records = rootGroups.getRecords();
|
List<DeviceGroup> records = rootGroups.getRecords();
|
||||||
|
|
||||||
// 2. 递归构建树形结构
|
// 2. 递归构建树形结构
|
||||||
@ -174,27 +169,4 @@ public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
|||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定设备分组
|
|
||||||
*
|
|
||||||
* @param groupId 分组id
|
|
||||||
* @param deviceId 设备id
|
|
||||||
* @return 是否绑定成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean bindingDevice(Long groupId, Long[] deviceId) {
|
|
||||||
|
|
||||||
if (deviceId != null && deviceId.length > 0) {
|
|
||||||
// 创建更新条件
|
|
||||||
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
|
|
||||||
updateWrapper.in("id", Arrays.asList(deviceId));
|
|
||||||
updateWrapper.set("group_id", groupId);
|
|
||||||
|
|
||||||
// 执行批量更新
|
|
||||||
deviceMapper.update(updateWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
16
pom.xml
16
pom.xml
@ -83,10 +83,10 @@
|
|||||||
<monitor.username>fys</monitor.username>
|
<monitor.username>fys</monitor.username>
|
||||||
<monitor.password>123456</monitor.password>
|
<monitor.password>123456</monitor.password>
|
||||||
</properties>
|
</properties>
|
||||||
<activation>
|
<!-- <activation> -->
|
||||||
<!-- 默认环境 -->
|
<!-- <!– 默认环境 –> -->
|
||||||
<activeByDefault>true</activeByDefault>
|
<!-- <activeByDefault>true</activeByDefault> -->
|
||||||
</activation>
|
<!-- </activation> -->
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>prod</id>
|
<id>prod</id>
|
||||||
@ -96,10 +96,10 @@
|
|||||||
<monitor.username>fys</monitor.username>
|
<monitor.username>fys</monitor.username>
|
||||||
<monitor.password>123456</monitor.password>
|
<monitor.password>123456</monitor.password>
|
||||||
</properties>
|
</properties>
|
||||||
<!-- <activation> -->
|
<activation>
|
||||||
<!-- <!– 默认环境 –> -->
|
<!-- 默认环境 -->
|
||||||
<!-- <activeByDefault>true</activeByDefault> -->
|
<activeByDefault>true</activeByDefault>
|
||||||
<!-- </activation> -->
|
</activation>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>jingquan</id>
|
<id>jingquan</id>
|
||||||
|
Reference in New Issue
Block a user