mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
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.dromara.web.service.IEqEquipmentService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -21,7 +24,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/device/userEquipment")
|
@RequestMapping("/device/showUser")
|
||||||
public class EqUserEquipmentController extends BaseController {
|
public class EqUserEquipmentController extends BaseController {
|
||||||
|
|
||||||
private final IEqEquipmentService eqEquipmentService;
|
private final IEqEquipmentService eqEquipmentService;
|
||||||
@ -29,10 +32,27 @@ public class EqUserEquipmentController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 查询设备信息列表
|
* 查询设备信息列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("device:userEquipment:list")
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public IPage<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
public TableDataInfo<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||||
return eqEquipmentService.queryEqUserEquipment(bo, 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
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
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 id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||||
SELECT
|
SELECT
|
||||||
|
user_id,
|
||||||
nick_name,
|
nick_name,
|
||||||
user_name,
|
user_name,
|
||||||
COUNT(*) AS bind_num,
|
COUNT(*) AS bind_num,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user