forked from dyf/fys-Multi-tenant
WEB端解绑设备
This commit is contained in:
@ -38,6 +38,7 @@ public class WEBDeviceController extends BaseController {
|
|||||||
private final WEBDeviceService deviceService;
|
private final WEBDeviceService deviceService;
|
||||||
private final DeviceBizService appDeviceService;
|
private final DeviceBizService appDeviceService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
@ -52,14 +53,12 @@ public class WEBDeviceController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备列表
|
* 查询设备列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
||||||
return appDeviceService.queryAppDeviceList(bo,pageQuery);
|
return appDeviceService.queryAppDeviceList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,6 +89,7 @@ public class WEBDeviceController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重命名设备
|
* 重命名设备
|
||||||
|
*
|
||||||
* @param reNameDTO
|
* @param reNameDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package com.fuyuanshen.web.service.impl;
|
package com.fuyuanshen.web.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fuyuanshen.app.domain.AppDeviceBindRecord;
|
||||||
|
import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
|
||||||
import com.fuyuanshen.equipment.domain.Device;
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
||||||
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||||
import com.fuyuanshen.web.service.WEBDeviceService;
|
import com.fuyuanshen.web.service.WEBDeviceService;
|
||||||
@ -10,6 +15,7 @@ import com.fuyuanshen.web.service.device.DeviceBizService;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:
|
* @Description:
|
||||||
@ -25,6 +31,10 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
|||||||
|
|
||||||
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
||||||
|
|
||||||
|
private final AppDeviceBindRecordMapper appDeviceBindRecordMapper;
|
||||||
|
|
||||||
|
private final DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WEB端解绑设备
|
* WEB端解绑设备
|
||||||
@ -33,6 +43,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public int webUnBindDevice(Long id, Long userId) {
|
public int webUnBindDevice(Long id, Long userId) {
|
||||||
// 设备端解绑 0:设备端解绑 1:web端解绑
|
// 设备端解绑 0:设备端解绑 1:web端解绑
|
||||||
int type = 1;
|
int type = 1;
|
||||||
@ -44,7 +55,18 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
|||||||
id = deviceAssignments.getDeviceId();
|
id = deviceAssignments.getDeviceId();
|
||||||
type = 0;
|
type = 0;
|
||||||
}
|
}
|
||||||
return appDeviceService.unBindDevice(id, userId, type);
|
|
||||||
|
QueryWrapper<AppDeviceBindRecord> deviceId = new QueryWrapper<AppDeviceBindRecord>().eq("device_id", id);
|
||||||
|
|
||||||
|
// appDeviceService.unBindDevice(id, userId, type);
|
||||||
|
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
|
||||||
|
deviceUpdateWrapper.eq("id", id)
|
||||||
|
.set("binding_user_id", null)
|
||||||
|
.set("binding_status", BindingStatusEnum.UNBOUND.getCode())
|
||||||
|
.set("binding_time", null);
|
||||||
|
deviceMapper.update(null, deviceUpdateWrapper);
|
||||||
|
|
||||||
|
return appDeviceBindRecordMapper.delete(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user