Compare commits
4 Commits
364574eeae
...
8a7565459b
Author | SHA1 | Date | |
---|---|---|---|
8a7565459b | |||
0bbac2b497 | |||
f9d9dadf08 | |||
e4df695f5e |
@ -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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,29 +1,18 @@
|
||||
package com.fuyuanshen.web.controller.device;
|
||||
|
||||
|
||||
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
|
||||
import com.fuyuanshen.app.domain.dto.AppRealTimeStatusDto;
|
||||
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
|
||||
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||
import com.fuyuanshen.web.service.WEBDeviceService;
|
||||
import com.fuyuanshen.web.service.device.DeviceBizService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
@ -68,6 +57,20 @@ public class WEBDeviceController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备用户详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "设备详情")
|
||||
@GetMapping(value = "/getDeviceUser/{id}")
|
||||
public R<List<AppPersonnelInfoRecords>> getDeviceUser(@PathVariable Long id) {
|
||||
List<AppPersonnelInfoRecords> device = deviceService.getDeviceUser(id);
|
||||
return R.ok(device);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.fuyuanshen.web.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
@ -38,4 +39,12 @@ public interface WEBDeviceService extends IService<Device> {
|
||||
*/
|
||||
WebDeviceVo getDevice(Long id);
|
||||
|
||||
/**
|
||||
* 设备用户详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<AppPersonnelInfoRecords> getDeviceUser(Long id);
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuyuanshen.app.domain.AppDeviceBindRecord;
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.app.domain.AppPersonnelInfoRecords;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
|
||||
import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||
@ -22,6 +24,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: WY
|
||||
@ -35,6 +39,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
||||
|
||||
private final AppDeviceBindRecordMapper appDeviceBindRecordMapper;
|
||||
private final AppPersonnelInfoRecordsMapper infoRecordsMapper;
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
private final AppDeviceShareMapper appDeviceShareMapper;
|
||||
@ -95,4 +100,19 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备用户详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AppPersonnelInfoRecords> getDeviceUser(Long id) {
|
||||
List<AppPersonnelInfoRecords> appPersonnelInfoRecords = infoRecordsMapper.selectList(
|
||||
new QueryWrapper<AppPersonnelInfoRecords>().eq("device_id", id)
|
||||
.orderByDesc("create_time"));
|
||||
return appPersonnelInfoRecords;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.equipment.service.impl;
|
||||
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
@ -11,6 +12,8 @@ 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 com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -22,6 +25,7 @@ import com.fuyuanshen.equipment.mapper.DeviceGroupMapper;
|
||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@ -39,6 +43,7 @@ import java.util.stream.Collectors;
|
||||
public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
||||
|
||||
private final DeviceGroupMapper baseMapper;
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
|
||||
/**
|
||||
@ -169,4 +174,29 @@ 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) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user