mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
客户管理优化
This commit is contained in:
parent
f32ab7d933
commit
9291fb145e
@ -3,6 +3,9 @@ package org.dromara.web.controller.show;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.service.IEqEquipmentService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -21,7 +24,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/device/userEquipment")
|
||||
@RequestMapping("/device/showUser")
|
||||
public class EqUserEquipmentController extends BaseController {
|
||||
|
||||
private final IEqEquipmentService eqEquipmentService;
|
||||
@ -29,10 +32,27 @@ public class EqUserEquipmentController extends BaseController {
|
||||
/**
|
||||
* 查询设备信息列表
|
||||
*/
|
||||
@SaCheckPermission("device:userEquipment:list")
|
||||
@GetMapping("/list")
|
||||
public IPage<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
return eqEquipmentService.queryEqUserEquipment(bo, pageQuery);
|
||||
public TableDataInfo<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
IPage<EqUserEquipmentVo> page = eqEquipmentService.queryEqUserEquipment(bo, pageQuery);
|
||||
TableDataInfo<EqUserEquipmentVo> result = new TableDataInfo<>();
|
||||
result.setTotal(page.getTotal());
|
||||
result.setRows(page.getRecords());
|
||||
result.setCode(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加设备
|
||||
* @param bo 传参用户id 分布id 设备编码
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bindDevice")
|
||||
public R<Boolean> bindDevice(@RequestBody EqAppHomeBo bo){
|
||||
String equipmentCode = bo.getEquipmentCode();
|
||||
if (equipmentCode == null) throw new ServiceException("设备编码不能为空");
|
||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");//分享用户要使用家庭主体的用户id
|
||||
return R.ok(eqEquipmentService.bindDevice(bo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,13 @@ public class EqUserEquipmentVo implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@ExcelProperty(value = "用户名称")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
|
||||
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
SELECT
|
||||
user_id,
|
||||
nick_name,
|
||||
user_name,
|
||||
COUNT(*) AS bind_num,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user