增加首页相关接口
This commit is contained in:
parent
5a9d927419
commit
5cb8fa26b2
@ -80,6 +80,13 @@ public class AlertMessageController {
|
|||||||
return success(BeanUtils.toBean(pageResult, AlertMessageRespVO.class));
|
return success(BeanUtils.toBean(pageResult, AlertMessageRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/statistics-summary")
|
||||||
|
@Operation(summary = "获取预警统计数据")
|
||||||
|
public CommonResult<AlertStatisticsVO> getAlertStatistics(@RequestParam Integer orgid) {
|
||||||
|
AlertStatisticsVO data = alertMessageService.getAlertStatistics(orgid);
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/statistics")
|
@GetMapping("/statistics")
|
||||||
@Operation(summary = "统计预警信息")
|
@Operation(summary = "统计预警信息")
|
||||||
public CommonResult<AlertMessageStatisticsRespVO> getAlertMessageStatistics(@Valid AlertMessageStatisticsReqVO statisticsReqVO) {
|
public CommonResult<AlertMessageStatisticsRespVO> getAlertMessageStatistics(@Valid AlertMessageStatisticsReqVO statisticsReqVO) {
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.alertmessage.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AlertStatisticsVO {
|
||||||
|
|
||||||
|
@Schema(description = "预警总数", required = true, example = "8")
|
||||||
|
private Integer alertTotal;
|
||||||
|
|
||||||
|
@Schema(description = "未处理预警数", required = true, example = "3")
|
||||||
|
private Integer alertUnhandled;
|
||||||
|
}
|
||||||
@ -77,7 +77,12 @@ public class DeviceController {
|
|||||||
DeviceDO device = deviceService.getDeviceId(devicecode);
|
DeviceDO device = deviceService.getDeviceId(devicecode);
|
||||||
return success(BeanUtils.toBean(device, DeviceRespVO.class));
|
return success(BeanUtils.toBean(device, DeviceRespVO.class));
|
||||||
}
|
}
|
||||||
|
@GetMapping("/getDeviceidCount")
|
||||||
|
@Operation(summary = "统计设备数量和在线离线 首页")
|
||||||
|
public CommonResult<DeviceStatistics> getDeviceStatistics(@RequestParam Integer orgid) {
|
||||||
|
DeviceStatistics statistics = deviceService.getDeviceStatistics(orgid);
|
||||||
|
return success(statistics);
|
||||||
|
}
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得设备分页")
|
@Operation(summary = "获得设备分页")
|
||||||
public CommonResult<PageResult<DeviceRespVO>> getDevicePage(@Valid DevicePageReqVO pageReqVO) {
|
public CommonResult<PageResult<DeviceRespVO>> getDevicePage(@Valid DevicePageReqVO pageReqVO) {
|
||||||
@ -114,4 +119,11 @@ public class DeviceController {
|
|||||||
return success(BeanUtils.toBean(pageResult, DeviceRespVO.class));
|
return success(BeanUtils.toBean(pageResult, DeviceRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/map-data")
|
||||||
|
@Operation(summary = "获取设备分布地图数据")
|
||||||
|
public CommonResult<DeviceMapVO> getDeviceMapData(@RequestParam Integer orgid) {
|
||||||
|
DeviceMapVO data = deviceService.getDeviceMapData(orgid);
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AlertStatistics {
|
||||||
|
private Integer total;
|
||||||
|
private Integer unhandled;
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceMapVO {
|
||||||
|
@Schema(description = "总设备数", required = true, example = "156")
|
||||||
|
private Integer totalCount;
|
||||||
|
|
||||||
|
@Schema(description = "在线设备数", required = true, example = "142")
|
||||||
|
private Integer onlineCount;
|
||||||
|
|
||||||
|
@Schema(description = "离线设备数", required = true, example = "14")
|
||||||
|
private Integer offlineCount;
|
||||||
|
|
||||||
|
@Schema(description = "预警总数", required = true, example = "8")
|
||||||
|
private Integer alertTotal;
|
||||||
|
|
||||||
|
@Schema(description = "未处理预警数", required = true, example = "3")
|
||||||
|
private Integer alertUnhandled;
|
||||||
|
|
||||||
|
@Schema(description = "地图数据", required = true)
|
||||||
|
private List<MapDataItem> mapData;
|
||||||
|
|
||||||
|
@Schema(description = "散点图数据", required = true)
|
||||||
|
private List<ScatterDataItem> scatterData;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceStatistics {
|
||||||
|
@Schema(description = "设备总数", required = true, example = "8")
|
||||||
|
private Integer totalCount;
|
||||||
|
|
||||||
|
@Schema(description = "在线设备数", required = true, example = "5")
|
||||||
|
private Integer onlineCount;
|
||||||
|
|
||||||
|
@Schema(description = "离线设备数", required = true, example = "3")
|
||||||
|
private Integer offlineCount;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MapDataItem {
|
||||||
|
@Schema(description = "省份名称", required = true, example = "辽宁省")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "设备数量", required = true, example = "45")
|
||||||
|
private Integer value;
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProvinceCoords {
|
||||||
|
private String provinceName;
|
||||||
|
private Double longitude;
|
||||||
|
private Double latitude;
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProvinceDeviceCount {
|
||||||
|
private String province;
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.device.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScatterDataItem {
|
||||||
|
@Schema(description = "省份名称", required = true, example = "辽宁省")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "坐标和数量 [经度, 纬度, 数量]", required = true, example = "[123.4315, 41.8057, 45]")
|
||||||
|
private double[] value;
|
||||||
|
|
||||||
|
@Schema(description = "设备数量", required = true, example = "45")
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@ -72,12 +72,16 @@ public class PersonController {
|
|||||||
}
|
}
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得用户基本信息")
|
@Operation(summary = "获得用户基本信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
||||||
public CommonResult<PersonRespVO> getPerson(@RequestParam("id") Integer id) {
|
public CommonResult<PersonRespVO> getPerson(@RequestParam("id") Integer id) {
|
||||||
PersonDO person = personService.getPerson(id);
|
PersonDO person = personService.getPerson(id);
|
||||||
return success(BeanUtils.toBean(person, PersonRespVO.class));
|
return success(BeanUtils.toBean(person, PersonRespVO.class));
|
||||||
}
|
}
|
||||||
|
@GetMapping("/member-growth-data")
|
||||||
|
@Operation(summary = "首页统计会员增长趋势")
|
||||||
|
public CommonResult<List<MemberGrowthVO>> getMemberGrowthData(@RequestParam Integer orgid) {
|
||||||
|
List<MemberGrowthVO> growthData = personService.getMemberGrowthData(orgid);
|
||||||
|
return success(growthData);
|
||||||
|
}
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得用户基本信息分页")
|
@Operation(summary = "获得用户基本信息分页")
|
||||||
public CommonResult<PageResult<PersonRespVO>> getPersonPage(@Valid PersonPageReqVO pageReqVO) {
|
public CommonResult<PageResult<PersonRespVO>> getPersonPage(@Valid PersonPageReqVO pageReqVO) {
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.person.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MemberGrowthVO {
|
||||||
|
|
||||||
|
@Schema(description = "日期")
|
||||||
|
private String date;
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@ -92,4 +92,14 @@ public interface AlertMessageMapper extends BaseMapperX<AlertMessageDO> {
|
|||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
@Param("endTime") String endTime);
|
@Param("endTime") String endTime);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警统计数据 首页
|
||||||
|
*/
|
||||||
|
@Select("SELECT " +
|
||||||
|
"COUNT(*) as alertTotal, " +
|
||||||
|
"SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) as alertUnhandled " +
|
||||||
|
"FROM tb_alert_message WHERE orgid = #{orgid}")
|
||||||
|
AlertStatisticsVO getAlertStatistics(@Param("orgid") Integer orgid);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.system.dal.dataobject.device.DeviceDO;
|
|||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.device.vo.*;
|
import cn.iocoder.yudao.module.system.controller.admin.device.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备 Mapper
|
* 设备 Mapper
|
||||||
@ -54,5 +56,36 @@ public interface DeviceMapper extends BaseMapperX<DeviceDO> {
|
|||||||
wrapper.orderByDesc(DeviceDO::getId);
|
wrapper.orderByDesc(DeviceDO::getId);
|
||||||
return selectPage(reqVO, wrapper);
|
return selectPage(reqVO, wrapper);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取设备基础统计
|
||||||
|
*/
|
||||||
|
@Select("SELECT " +
|
||||||
|
"COUNT(*) as totalCount, " +
|
||||||
|
"SUM(CASE WHEN devicestatus = 1 THEN 1 ELSE 0 END) as onlineCount, " +
|
||||||
|
"SUM(CASE WHEN devicestatus = 2 THEN 1 ELSE 0 END) as offlineCount " +
|
||||||
|
"FROM tb_device WHERE orgid = #{orgid}")
|
||||||
|
DeviceStatistics getDeviceStatistics(@Param("orgid") Integer orgid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取省份设备数量统计
|
||||||
|
*/
|
||||||
|
@Select("SELECT " +
|
||||||
|
"SUBSTRING_INDEX(location, '/', 1) as province, " +
|
||||||
|
"COUNT(*) as count " +
|
||||||
|
"FROM tb_device " +
|
||||||
|
"WHERE orgid = #{orgid} " +
|
||||||
|
"GROUP BY SUBSTRING_INDEX(location, '/', 1)")
|
||||||
|
List<ProvinceDeviceCount> getProvinceDeviceCount(@Param("orgid") Integer orgid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据省份名称获取经纬度
|
||||||
|
*/
|
||||||
|
@Select("SELECT province_name, longitude, latitude " +
|
||||||
|
"FROM province_coords " +
|
||||||
|
"WHERE province_name = #{provinceName}")
|
||||||
|
ProvinceCoords getByProvince(@Param("provinceName") String provinceName);
|
||||||
|
/*
|
||||||
|
* 首页查询设备数量统计
|
||||||
|
* */
|
||||||
|
DeviceStatistics getDevice_Statistics(@Param("orgid") Integer orgid);
|
||||||
}
|
}
|
||||||
@ -48,5 +48,9 @@ public interface PersonMapper extends BaseMapperX<PersonDO> {
|
|||||||
* 按天统计开通会员的人数
|
* 按天统计开通会员的人数
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> countVipByDay(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
List<Map<String, Object>> countVipByDay(@Param("startDate") String startDate, @Param("endDate") String endDate);
|
||||||
|
/*
|
||||||
|
* 首页统计 会员增长趋势 一周
|
||||||
|
* */
|
||||||
|
List<MemberGrowthVO> getMemberGrowthData(@Param("orgid") Integer orgid);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -33,6 +33,10 @@ public interface AlertMessageService {
|
|||||||
* 根据机构ID查询所有未读预警信息
|
* 根据机构ID查询所有未读预警信息
|
||||||
* */
|
* */
|
||||||
List<AlertMessageDO> getAlertMessageList(Integer deptid);
|
List<AlertMessageDO> getAlertMessageList(Integer deptid);
|
||||||
|
/*
|
||||||
|
* 预警信息统计 首页
|
||||||
|
* */
|
||||||
|
AlertStatisticsVO getAlertStatistics(Integer orgid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除预警信息
|
* 删除预警信息
|
||||||
|
|||||||
@ -59,6 +59,20 @@ public class AlertMessageServiceImpl implements AlertMessageService {
|
|||||||
// 执行查询
|
// 执行查询
|
||||||
return alertMessageMapper.selectList(queryWrapper);
|
return alertMessageMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public AlertStatisticsVO getAlertStatistics(Integer orgid) {
|
||||||
|
// 直接调用Mapper,一次查询获取所有数据
|
||||||
|
AlertStatisticsVO result = alertMessageMapper.getAlertStatistics(orgid);
|
||||||
|
|
||||||
|
// 处理null值,确保返回的数据不为null
|
||||||
|
if (result == null) {
|
||||||
|
result = new AlertStatisticsVO();
|
||||||
|
result.setAlertTotal(0);
|
||||||
|
result.setAlertUnhandled(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAlertMessage(Integer id) {
|
public void deleteAlertMessage(Integer id) {
|
||||||
|
|||||||
@ -59,6 +59,11 @@ public interface DeviceService {
|
|||||||
* @return 设备分页
|
* @return 设备分页
|
||||||
*/
|
*/
|
||||||
PageResult<DeviceDO> getDevicePage(DevicePageReqVO pageReqVO);
|
PageResult<DeviceDO> getDevicePage(DevicePageReqVO pageReqVO);
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* 首页 获取设备数量统计
|
||||||
|
* */
|
||||||
|
DeviceStatistics getDeviceStatistics(Integer orgid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备ID更新设备状态
|
* 根据设备ID更新设备状态
|
||||||
@ -75,5 +80,9 @@ public interface DeviceService {
|
|||||||
* @return 设备分页
|
* @return 设备分页
|
||||||
*/
|
*/
|
||||||
PageResult<DeviceDO> getDeviceNotBind(DevicePageReqVO pageReqVO);
|
PageResult<DeviceDO> getDeviceNotBind(DevicePageReqVO pageReqVO);
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* 首页查询设备地图分布接口
|
||||||
|
* */
|
||||||
|
DeviceMapVO getDeviceMapData(Integer orgid);
|
||||||
}
|
}
|
||||||
@ -12,6 +12,9 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.device.DeviceMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.device.DeviceMapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@ -80,7 +83,10 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
public PageResult<DeviceDO> getDevicePage(DevicePageReqVO pageReqVO) {
|
public PageResult<DeviceDO> getDevicePage(DevicePageReqVO pageReqVO) {
|
||||||
return deviceMapper.selectPage(pageReqVO);
|
return deviceMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public DeviceStatistics getDeviceStatistics(Integer orgid) {
|
||||||
|
return deviceMapper.getDevice_Statistics(orgid);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void updateDeviceStatus(Integer devicecode, Integer devicestatus) {
|
public void updateDeviceStatus(Integer devicecode, Integer devicestatus) {
|
||||||
// 校验设备是否存在
|
// 校验设备是否存在
|
||||||
@ -101,5 +107,45 @@ public class DeviceServiceImpl implements DeviceService {
|
|||||||
public PageResult<DeviceDO> getDeviceNotBind(DevicePageReqVO pageReqVO) {
|
public PageResult<DeviceDO> getDeviceNotBind(DevicePageReqVO pageReqVO) {
|
||||||
return deviceMapper.selectNotBindPage(pageReqVO);
|
return deviceMapper.selectNotBindPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public DeviceMapVO getDeviceMapData(Integer orgid) {
|
||||||
|
DeviceMapVO result = new DeviceMapVO();
|
||||||
|
|
||||||
|
// 1. 获取设备基础统计
|
||||||
|
DeviceStatistics stats = deviceMapper.getDeviceStatistics(orgid);
|
||||||
|
result.setTotalCount(stats.getTotalCount());
|
||||||
|
result.setOnlineCount(stats.getOnlineCount());
|
||||||
|
result.setOfflineCount(stats.getOfflineCount());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 3. 获取省份分布数据
|
||||||
|
List<ProvinceDeviceCount> provinceData = deviceMapper.getProvinceDeviceCount(orgid);
|
||||||
|
List<MapDataItem> mapData = new ArrayList<>();
|
||||||
|
List<ScatterDataItem> scatterData = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ProvinceDeviceCount item : provinceData) {
|
||||||
|
// 地图数据
|
||||||
|
MapDataItem mapItem = new MapDataItem();
|
||||||
|
mapItem.setName(item.getProvince());
|
||||||
|
mapItem.setValue(item.getCount());
|
||||||
|
mapData.add(mapItem);
|
||||||
|
|
||||||
|
// 散点图数据
|
||||||
|
ProvinceCoords coords = deviceMapper.getByProvince(item.getProvince());
|
||||||
|
if (coords != null) {
|
||||||
|
ScatterDataItem scatterItem = new ScatterDataItem();
|
||||||
|
scatterItem.setName(item.getProvince());
|
||||||
|
scatterItem.setValue(new double[]{coords.getLongitude(), coords.getLatitude(), item.getCount()});
|
||||||
|
scatterItem.setCount(item.getCount());
|
||||||
|
scatterData.add(scatterItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setMapData(mapData);
|
||||||
|
result.setScatterData(scatterData);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -28,6 +28,11 @@ public interface PersonService {
|
|||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updatePerson(@Valid PersonSaveReqVO updateReqVO);
|
void updatePerson(@Valid PersonSaveReqVO updateReqVO);
|
||||||
|
/*
|
||||||
|
* 首页统计会员增长趋势 一周
|
||||||
|
* */
|
||||||
|
List<MemberGrowthVO> getMemberGrowthData(Integer orgid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 根据主键ID 更新家庭成员 信息
|
* 根据主键ID 更新家庭成员 信息
|
||||||
* */
|
* */
|
||||||
|
|||||||
@ -48,6 +48,10 @@ public class PersonServiceImpl implements PersonService {
|
|||||||
personMapper.updateById(updateObj);
|
personMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public List<MemberGrowthVO> getMemberGrowthData(Integer orgid) {
|
||||||
|
return personMapper.getMemberGrowthData(orgid);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public Integer updatefamilyinfo(PersonUpfamilyInfoVO updateReqVO)
|
public Integer updatefamilyinfo(PersonUpfamilyInfoVO updateReqVO)
|
||||||
{
|
{
|
||||||
Integer maxfamilyid = generateNextFamilyId();
|
Integer maxfamilyid = generateNextFamilyId();
|
||||||
|
|||||||
@ -8,5 +8,12 @@
|
|||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
<select id="getDevice_Statistics" resultType="cn.iocoder.yudao.module.system.controller.admin.device.vo.DeviceStatistics">
|
||||||
|
SELECT
|
||||||
|
COUNT(*) AS totalCount,
|
||||||
|
SUM(CASE WHEN devicestatus = 1 THEN 1 ELSE 0 END) AS onlineCount,
|
||||||
|
SUM(CASE WHEN devicestatus = 2 THEN 1 ELSE 0 END) AS offlineCount
|
||||||
|
FROM tb_device
|
||||||
|
WHERE orgid = #{orgid}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -20,5 +20,40 @@
|
|||||||
GROUP BY DATE_FORMAT(vipStartTime, '%Y-%m-%d')
|
GROUP BY DATE_FORMAT(vipStartTime, '%Y-%m-%d')
|
||||||
ORDER BY date
|
ORDER BY date
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getMemberGrowthData" resultType="cn.iocoder.yudao.module.system.controller.admin.person.vo.MemberGrowthVO">
|
||||||
|
WITH date_series AS (
|
||||||
|
SELECT CURDATE() - INTERVAL 6 DAY AS date UNION ALL
|
||||||
|
SELECT CURDATE() - INTERVAL 5 DAY UNION ALL
|
||||||
|
SELECT CURDATE() - INTERVAL 4 DAY UNION ALL
|
||||||
|
SELECT CURDATE() - INTERVAL 3 DAY UNION ALL
|
||||||
|
SELECT CURDATE() - INTERVAL 2 DAY UNION ALL
|
||||||
|
SELECT CURDATE() - INTERVAL 1 DAY UNION ALL
|
||||||
|
SELECT CURDATE()
|
||||||
|
),
|
||||||
|
daily_stats AS (
|
||||||
|
SELECT
|
||||||
|
DATE(vipstarttime) AS vip_date,
|
||||||
|
COUNT(*) AS count
|
||||||
|
FROM tb_user
|
||||||
|
WHERE isvip = 1
|
||||||
|
AND orgid = #{orgid}
|
||||||
|
AND vipstarttime >= DATE_SUB(CURDATE(), INTERVAL 6 DAY)
|
||||||
|
AND vipstarttime < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
GROUP BY DATE(vipstarttime)
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
CASE DAYOFWEEK(ds.date)
|
||||||
|
WHEN 1 THEN '周日'
|
||||||
|
WHEN 2 THEN '周一'
|
||||||
|
WHEN 3 THEN '周二'
|
||||||
|
WHEN 4 THEN '周三'
|
||||||
|
WHEN 5 THEN '周四'
|
||||||
|
WHEN 6 THEN '周五'
|
||||||
|
WHEN 7 THEN '周六'
|
||||||
|
END AS date,
|
||||||
|
COALESCE(stats.count, 0) AS count
|
||||||
|
FROM date_series ds
|
||||||
|
LEFT JOIN daily_stats stats ON ds.date = stats.vip_date
|
||||||
|
ORDER BY ds.date
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user