查询分享用户数
This commit is contained in:
@ -8,9 +8,11 @@ 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;
|
||||
@ -38,7 +40,6 @@ public class WEBDeviceController extends BaseController {
|
||||
private final WEBDeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
@ -53,6 +54,19 @@ public class WEBDeviceController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "设备详情")
|
||||
@GetMapping(value = "/detail/{id}")
|
||||
public R<WebDeviceVo> getDevice(@PathVariable Long id) {
|
||||
WebDeviceVo device = deviceService.getDevice(id);
|
||||
return R.ok(device);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@ -29,4 +30,12 @@ public interface WEBDeviceService extends IService<Device> {
|
||||
*/
|
||||
int webUnBindDevice(Long id, Long userId);
|
||||
|
||||
/**
|
||||
* WEB端设备详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
WebDeviceVo getDevice(Long id);
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
package com.fuyuanshen.web.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.fuyuanshen.app.domain.AppDeviceBindRecord;
|
||||
import com.fuyuanshen.app.domain.AppDeviceShare;
|
||||
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
|
||||
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
|
||||
import com.fuyuanshen.equipment.domain.Device;
|
||||
import com.fuyuanshen.equipment.domain.DeviceAssignments;
|
||||
import com.fuyuanshen.equipment.domain.vo.WebDeviceVo;
|
||||
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||
@ -27,13 +32,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@RequiredArgsConstructor
|
||||
public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements WEBDeviceService {
|
||||
|
||||
private final DeviceBizService appDeviceService;
|
||||
|
||||
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
|
||||
|
||||
private final AppDeviceBindRecordMapper appDeviceBindRecordMapper;
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
private final AppDeviceShareMapper appDeviceShareMapper;
|
||||
|
||||
|
||||
/**
|
||||
@ -70,4 +74,25 @@ public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impl
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* WEB端设备详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WebDeviceVo getDevice(Long id) {
|
||||
Device device = deviceMapper.selectById(id);
|
||||
if (device != null) {
|
||||
WebDeviceVo webDeviceVo = new WebDeviceVo();
|
||||
BeanUtil.copyProperties(device, webDeviceVo);
|
||||
// 查询分享用户数
|
||||
Long count = appDeviceShareMapper.selectCount(new QueryWrapper<AppDeviceShare>().eq("device_id", id));
|
||||
webDeviceVo.setShareUsersNumber(Math.toIntExact(count));
|
||||
return webDeviceVo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -92,4 +92,9 @@ public class WebDeviceVo implements Serializable {
|
||||
*/
|
||||
private String detailPageUrl;
|
||||
|
||||
/**
|
||||
* 分享用户数量
|
||||
*/
|
||||
private Integer shareUsersNumber;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user