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
e60614d2f3
commit
0510a11e0b
@ -0,0 +1,39 @@
|
||||
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.web.service.IEqEquipmentService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
import org.dromara.web.domain.bo.EqUserEquipmentBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备信息
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/device/userEquipment")
|
||||
public class EqUserEquipmentController extends BaseController {
|
||||
|
||||
private final IEqEquipmentService eqEquipmentService;
|
||||
|
||||
/**
|
||||
* 查询设备信息列表
|
||||
*/
|
||||
@SaCheckPermission("device:userEquipment:list")
|
||||
@GetMapping("/list")
|
||||
public IPage<EqUserEquipmentVo> list(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
return eqEquipmentService.queryEqUserEquipment(bo, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package org.dromara.web.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备信息对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
public class EqUserEquipment implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 绑定设备(个)
|
||||
*/
|
||||
@TableId(value = "bind_num")
|
||||
private Integer bindNum;
|
||||
|
||||
/**
|
||||
* 在线设备(个)
|
||||
*/
|
||||
private Integer onlineNum;
|
||||
|
||||
/**
|
||||
* 离线设备(个)
|
||||
*/
|
||||
private Integer offlineNum;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package org.dromara.web.domain.bo;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 设备信息业务对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EqUserEquipmentBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package org.dromara.web.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备信息视图对象 eq_user_equipment
|
||||
*
|
||||
* @author zzc
|
||||
* @date 2024-08-13
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EqUserEquipmentVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@ExcelProperty(value = "客户名称")
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 绑定账号
|
||||
*/
|
||||
@ExcelProperty(value = "绑定账号")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 绑定设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "绑定设备(个)")
|
||||
private Integer bindNum;
|
||||
|
||||
/**
|
||||
* 在线设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "在线设备(个)")
|
||||
private Integer onlineNum;
|
||||
|
||||
/**
|
||||
* 离线设备(个)
|
||||
*/
|
||||
@ExcelProperty(value = "离线设备(个)")
|
||||
private Integer offlineNum;
|
||||
|
||||
|
||||
}
|
||||
@ -1,8 +1,13 @@
|
||||
package org.dromara.web.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.dromara.web.domain.EqEquipment;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备信息Mapper接口
|
||||
@ -12,4 +17,5 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface EqEquipmentMapper extends BaseMapperPlus<EqEquipment, EqEquipmentVo> {
|
||||
|
||||
IPage<EqUserEquipmentVo> selectEquipmentVoPage(Page<EqEquipment> page, String nickName);
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package org.dromara.web.service;
|
||||
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceCmdBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceSetBo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.dromara.web.domain.bo.*;
|
||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentStatusVo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -95,4 +94,6 @@ public interface IEqEquipmentService {
|
||||
* @return
|
||||
*/
|
||||
boolean updateByBos(List<EqAppHomeBo> bos);
|
||||
|
||||
IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.web.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -15,13 +17,11 @@ import org.dromara.web.device.*;
|
||||
import org.dromara.web.device.iot.DeviceDto;
|
||||
import org.dromara.web.device.iot.DeviceMsgDto;
|
||||
import org.dromara.web.device.iot.DeviceServerMsgDto;
|
||||
import org.dromara.web.domain.bo.EqAppHomeBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceCmdBo;
|
||||
import org.dromara.web.domain.bo.EqDeviceSetBo;
|
||||
import org.dromara.web.domain.bo.*;
|
||||
import org.dromara.web.domain.vo.EqEquipmentDetailVo;
|
||||
import org.dromara.web.domain.vo.EqUserEquipmentVo;
|
||||
import org.dromara.web.service.IotService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.web.domain.bo.EqEquipmentBo;
|
||||
import org.dromara.web.domain.vo.EqEquipmentVo;
|
||||
import org.dromara.web.domain.EqEquipment;
|
||||
import org.dromara.web.mapper.EqEquipmentMapper;
|
||||
@ -277,6 +277,13 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
||||
}
|
||||
return baseMapper.updateBatchById(eqEquipments);
|
||||
}
|
||||
@Override
|
||||
public IPage<EqUserEquipmentVo> queryEqUserEquipment(EqUserEquipmentBo bo, PageQuery pageQuery) {
|
||||
Page<EqEquipment> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
|
||||
// 调用Mapper中的新方法
|
||||
IPage<EqUserEquipmentVo> voPage = baseMapper.selectEquipmentVoPage(page, bo.getNickName());
|
||||
return voPage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -4,4 +4,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.web.mapper.EqEquipmentMapper">
|
||||
|
||||
|
||||
<select id="selectEquipmentVoPage" resultType="org.dromara.web.domain.vo.EqUserEquipmentVo">
|
||||
SELECT
|
||||
nick_name,
|
||||
user_name,
|
||||
COUNT(*) AS bind_num,
|
||||
SUM(line_status = 1) AS online_num,
|
||||
SUM(line_status = 0) AS offline_num
|
||||
FROM eq_equipment
|
||||
<where>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
AND nick_name like
|
||||
CONCAT('%', #{nickName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY user_name, nick_name
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user