磁盘表分表,增加磁盘名称存储CRUD
This commit is contained in:
+6
@@ -1,6 +1,7 @@
|
||||
package com.tongran.system.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.system.domain.EpsInitialTrafficData;
|
||||
import com.tongran.system.domain.InitialSwitchInfoDetails;
|
||||
import com.tongran.system.service.EpsInitialTrafficDataService;
|
||||
@@ -24,6 +25,11 @@ public class CalculateController extends BaseController {
|
||||
@Autowired
|
||||
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
|
||||
|
||||
@GetMapping("/createTables")
|
||||
public AjaxResult createTables(Long plusMonth){
|
||||
epsInitialTrafficDataService.createNextMonthTables(plusMonth);
|
||||
return success();
|
||||
}
|
||||
@GetMapping("/calculate95BandwidthDaily")
|
||||
public void calculate95BandwidthDaily(String day){
|
||||
// 获取昨天的日期范围(北京时间)
|
||||
|
||||
+2
@@ -72,4 +72,6 @@ public interface EpsInitialTrafficDataMapper {
|
||||
void createOtherMsgTable(String tableName);
|
||||
|
||||
void createSwitchOpMdTable(String tableName);
|
||||
|
||||
void createDiskInfo(String tableName);
|
||||
}
|
||||
|
||||
+6
@@ -19,6 +19,12 @@ public interface EpsInitialTrafficDataService {
|
||||
* 每月25日0点自动执行
|
||||
*/
|
||||
void createNextMonthTables();
|
||||
|
||||
/**
|
||||
* 创建分表
|
||||
* @param plusMonth 下几个月
|
||||
*/
|
||||
void createNextMonthTables(Long plusMonth);
|
||||
/**
|
||||
* 保存单条流量数据
|
||||
* @param data 流量数据
|
||||
|
||||
+28
@@ -74,8 +74,31 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
createOtherMsgTable(year, month);
|
||||
// 创建交换机光模块表
|
||||
createSwitchOpMdTable(year, month);
|
||||
// 创建磁盘信息表
|
||||
createDiskInfo(year, month);
|
||||
}
|
||||
public void createNextMonthTables(Long plusMonth) {
|
||||
LocalDate nextMonth = LocalDate.now().plusMonths(plusMonth);
|
||||
int year = nextMonth.getYear();
|
||||
int month = nextMonth.getMonthValue();
|
||||
|
||||
// 创建流量详情表
|
||||
createTrafficDetailsTable(year, month);
|
||||
// 创建流量初始表
|
||||
createTrafficStatsTable(year, month);
|
||||
// 创建mtr探测丢包结果表
|
||||
createMtrProbeResultTable(year, month);
|
||||
// 创建交换机流量初始表
|
||||
createSwitchInfoTable(year, month);
|
||||
// 创建交换机流量业务表
|
||||
createSwitchInfoDetailsTable(year, month);
|
||||
// 创建服务器其他信息表
|
||||
createOtherMsgTable(year, month);
|
||||
// 创建交换机光模块表
|
||||
createSwitchOpMdTable(year, month);
|
||||
// 创建磁盘信息表
|
||||
createDiskInfo(year, month);
|
||||
}
|
||||
private void createTrafficDetailsTable(int year, int month) {
|
||||
createRangeTables(year, month, "eps_traffic_details", (tableName) -> {
|
||||
epsInitialTrafficDataMapper.createEpsTrafficTable(tableName);
|
||||
@@ -114,6 +137,11 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
epsInitialTrafficDataMapper.createSwitchOpMdTable(tableName);
|
||||
});
|
||||
}
|
||||
private void createDiskInfo(int year, int month) {
|
||||
createRangeTables(year, month, "initial_disk_info", (tableName) -> {
|
||||
epsInitialTrafficDataMapper.createDiskInfo(tableName);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+23
@@ -201,6 +201,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
UNIQUE KEY uk_client_fiber_time (client_id, create_time, fiber_port_name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='光模块信息表';
|
||||
</update>
|
||||
<update id="createDiskInfo">
|
||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`client_id` varchar(255) NOT NULL COMMENT '客户端ID',
|
||||
`name` varchar(100) NOT NULL COMMENT '磁盘名称(如sda、sdb等)',
|
||||
`serial` varchar(100) COMMENT '磁盘序列号',
|
||||
`total` bigint(20) COMMENT '磁盘总大小(GB)',
|
||||
`write_speed` bigint(20) COMMENT '磁盘写入速率(字节/秒)',
|
||||
`read_speed` bigint(20) COMMENT '磁盘读取速率(字节/秒)',
|
||||
`write_times` bigint(20) COMMENT '磁盘写入次数',
|
||||
`read_times` bigint(20) COMMENT '磁盘读取次数',
|
||||
`write_bytes` bigint(20) COMMENT '磁盘写入总字节数',
|
||||
`read_bytes` bigint(20) COMMENT '磁盘读取总字节数',
|
||||
`create_by` varchar(50) COMMENT '创建人',
|
||||
`update_by` varchar(50) COMMENT '更新人',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`type` varchar(255) COMMENT '磁盘类型',
|
||||
`used_space` bigint(20) COMMENT '已用空间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY uk_client_disk_time (`client_id`, `name`, `create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='磁盘监控信息表';
|
||||
</update>
|
||||
<!-- 单条插入语句 -->
|
||||
<insert id="insert">
|
||||
INSERT INTO ${tableName} (
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.AllDiskName;
|
||||
import com.tongran.rocketmq.service.IAllDiskNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 磁盘名称存储Controller
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/allDiskName")
|
||||
public class AllDiskNameController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAllDiskNameService allDiskNameService;
|
||||
|
||||
/**
|
||||
* 查询磁盘名称存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AllDiskName allDiskName)
|
||||
{
|
||||
startPage();
|
||||
List<AllDiskName> list = allDiskNameService.selectAllDiskNameList(allDiskName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出磁盘名称存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:export")
|
||||
@Log(title = "磁盘名称存储", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AllDiskName allDiskName)
|
||||
{
|
||||
List<AllDiskName> list = allDiskNameService.selectAllDiskNameList(allDiskName);
|
||||
ExcelUtil<AllDiskName> util = new ExcelUtil<AllDiskName>(AllDiskName.class);
|
||||
util.exportExcel(response, list, "磁盘名称存储数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取磁盘名称存储详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(allDiskNameService.selectAllDiskNameById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增磁盘名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:add")
|
||||
@Log(title = "磁盘名称存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AllDiskName allDiskName)
|
||||
{
|
||||
return toAjax(allDiskNameService.insertAllDiskName(allDiskName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改磁盘名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:edit")
|
||||
@Log(title = "磁盘名称存储", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AllDiskName allDiskName)
|
||||
{
|
||||
return toAjax(allDiskNameService.updateAllDiskName(allDiskName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除磁盘名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDiskName:remove")
|
||||
@Log(title = "磁盘名称存储", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(allDiskNameService.deleteAllDiskNameByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 磁盘名称存储对象 all_disk_name
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-14
|
||||
*/
|
||||
public class AllDiskName extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 磁盘名称 */
|
||||
@Excel(name = "磁盘名称")
|
||||
private String name;
|
||||
|
||||
/** 磁盘状态(0:丢失,1:存在) */
|
||||
@Excel(name = "磁盘状态(0:丢失,1:存在)")
|
||||
private Integer status;
|
||||
|
||||
/** 读取IOPS */
|
||||
@Excel(name = "读取IOPS")
|
||||
private String readIops;
|
||||
|
||||
/** 写入IOPS */
|
||||
@Excel(name = "写入IOPS")
|
||||
private String writeIops;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setReadIops(String readIops)
|
||||
{
|
||||
this.readIops = readIops;
|
||||
}
|
||||
|
||||
public String getReadIops()
|
||||
{
|
||||
return readIops;
|
||||
}
|
||||
|
||||
public void setWriteIops(String writeIops)
|
||||
{
|
||||
this.writeIops = writeIops;
|
||||
}
|
||||
|
||||
public String getWriteIops()
|
||||
{
|
||||
return writeIops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("clientId", getClientId())
|
||||
.append("name", getName())
|
||||
.append("status", getStatus())
|
||||
.append("readIops", getReadIops())
|
||||
.append("writeIops", getWriteIops())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 磁盘监控信息对象 initial_disk_info
|
||||
*
|
||||
@@ -69,5 +71,18 @@ public class InitialDiskInfo extends BaseEntity
|
||||
private String readBytesStr;
|
||||
/** 换算后的写入次数 */
|
||||
private String writeBytesStr;
|
||||
/** 磁盘类型 */
|
||||
private String type;
|
||||
/** 已用空间 */
|
||||
private Long usedSpace;
|
||||
/** 读IOPS */
|
||||
private Long readIops;
|
||||
/** 写IOPS */
|
||||
private Long writeIops;
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
/** 批量插入列表 */
|
||||
private List<InitialDiskInfo> list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ public class DeviceMessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始磁盘数据入库
|
||||
initialDiskInfoService.batchInsertInitialDiskInfo(disks);
|
||||
initialDiskInfoService.batchInsertInitialDiskInfo(disks, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("磁盘data数据为空");
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ public class MessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始磁盘数据入库
|
||||
initialDiskInfoService.batchInsertInitialDiskInfo(disks);
|
||||
initialDiskInfoService.batchInsertInitialDiskInfo(disks, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("磁盘data数据为空");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllDiskName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 磁盘名称存储Mapper接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-14
|
||||
*/
|
||||
public interface AllDiskNameMapper
|
||||
{
|
||||
/**
|
||||
* 查询磁盘名称存储
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 磁盘名称存储
|
||||
*/
|
||||
public AllDiskName selectAllDiskNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询磁盘名称存储列表
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 磁盘名称存储集合
|
||||
*/
|
||||
public List<AllDiskName> selectAllDiskNameList(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 新增磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllDiskName(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 修改磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllDiskName(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 删除磁盘名称存储
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDiskNameById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除磁盘名称存储
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDiskNameByIds(Long[] ids);
|
||||
|
||||
int batchInsertAllDistName(List<AllDiskName> dataList);
|
||||
}
|
||||
+4
-3
@@ -1,7 +1,6 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialDiskInfo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -65,10 +64,10 @@ public interface InitialDiskInfoMapper
|
||||
/**
|
||||
* 批量新增磁盘监控信息
|
||||
*
|
||||
* @param list 磁盘监控信息集合
|
||||
* @param initialDiskInfo 磁盘监控信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialDiskInfo(@Param("list") List<InitialDiskInfo> list);
|
||||
public int batchInsertInitialDiskInfo(InitialDiskInfo initialDiskInfo);
|
||||
|
||||
/**
|
||||
* 获取磁盘设备基础信息
|
||||
@@ -83,4 +82,6 @@ public interface InitialDiskInfoMapper
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllDistName(InitialDiskInfo initialDiskInfo);
|
||||
|
||||
List<InitialDiskInfo> selectInitialDiskInfoListByCondition(InitialDiskInfo condition);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllDiskName;
|
||||
import com.tongran.rocketmq.domain.InitialDiskInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 磁盘名称存储Service接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-14
|
||||
*/
|
||||
public interface IAllDiskNameService
|
||||
{
|
||||
/**
|
||||
* 查询磁盘名称存储
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 磁盘名称存储
|
||||
*/
|
||||
public AllDiskName selectAllDiskNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询磁盘名称存储列表
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 磁盘名称存储集合
|
||||
*/
|
||||
public List<AllDiskName> selectAllDiskNameList(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 新增磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllDiskName(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 修改磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllDiskName(AllDiskName allDiskName);
|
||||
|
||||
/**
|
||||
* 批量删除磁盘名称存储
|
||||
*
|
||||
* @param ids 需要删除的磁盘名称存储主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDiskNameByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除磁盘名称存储信息
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDiskNameById(Long id);
|
||||
|
||||
int batchInsertAllDistName(List<InitialDiskInfo> dataList);
|
||||
}
|
||||
+3
-1
@@ -2,6 +2,7 @@ package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialDiskInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -64,9 +65,10 @@ public interface IInitialDiskInfoService
|
||||
* 批量新增磁盘监控信息
|
||||
*
|
||||
* @param list 磁盘监控信息集合
|
||||
* @param createTime 采集时间
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialDiskInfo(List<InitialDiskInfo> list);
|
||||
public int batchInsertInitialDiskInfo(List<InitialDiskInfo> list, Date createTime);
|
||||
/**
|
||||
* 磁盘设备/dev/sda基础信息
|
||||
* @param initialDiskInfo
|
||||
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.AllDiskName;
|
||||
import com.tongran.rocketmq.domain.InitialDiskInfo;
|
||||
import com.tongran.rocketmq.mapper.AllDiskNameMapper;
|
||||
import com.tongran.rocketmq.service.IAllDiskNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 磁盘名称存储Service业务层处理
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-14
|
||||
*/
|
||||
@Service
|
||||
public class AllDiskNameServiceImpl implements IAllDiskNameService
|
||||
{
|
||||
@Autowired
|
||||
private AllDiskNameMapper allDiskNameMapper;
|
||||
|
||||
/**
|
||||
* 查询磁盘名称存储
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 磁盘名称存储
|
||||
*/
|
||||
@Override
|
||||
public AllDiskName selectAllDiskNameById(Long id)
|
||||
{
|
||||
return allDiskNameMapper.selectAllDiskNameById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询磁盘名称存储列表
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 磁盘名称存储
|
||||
*/
|
||||
@Override
|
||||
public List<AllDiskName> selectAllDiskNameList(AllDiskName allDiskName)
|
||||
{
|
||||
return allDiskNameMapper.selectAllDiskNameList(allDiskName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAllDiskName(AllDiskName allDiskName)
|
||||
{
|
||||
allDiskName.setCreateTime(DateUtils.getNowDate());
|
||||
return allDiskNameMapper.insertAllDiskName(allDiskName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改磁盘名称存储
|
||||
*
|
||||
* @param allDiskName 磁盘名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAllDiskName(AllDiskName allDiskName)
|
||||
{
|
||||
allDiskName.setUpdateTime(DateUtils.getNowDate());
|
||||
return allDiskNameMapper.updateAllDiskName(allDiskName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除磁盘名称存储
|
||||
*
|
||||
* @param ids 需要删除的磁盘名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllDiskNameByIds(Long[] ids)
|
||||
{
|
||||
return allDiskNameMapper.deleteAllDiskNameByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除磁盘名称存储信息
|
||||
*
|
||||
* @param id 磁盘名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllDiskNameById(Long id)
|
||||
{
|
||||
return allDiskNameMapper.deleteAllDiskNameById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsertAllDistName(List<InitialDiskInfo> dataList) {
|
||||
if(dataList == null){
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
List<AllDiskName> nameList = new ArrayList<>();
|
||||
for (InitialDiskInfo initialDiskInfo : dataList) {
|
||||
AllDiskName allDiskName = new AllDiskName();
|
||||
allDiskName.setClientId(initialDiskInfo.getClientId());
|
||||
allDiskName.setName(initialDiskInfo.getName());
|
||||
allDiskName.setStatus(1);
|
||||
allDiskName.setCreateTime(initialDiskInfo.getCreateTime());
|
||||
allDiskName.setUpdateTime(DateUtils.getNowDate());
|
||||
nameList.add(allDiskName);
|
||||
}
|
||||
allDiskNameMapper.batchInsertAllDistName(nameList);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+72
-12
@@ -2,20 +2,22 @@ package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.EchartsDataUtils;
|
||||
import com.tongran.common.core.utils.TableSubUtil;
|
||||
import com.tongran.common.core.utils.UnitChangeUtil;
|
||||
import com.tongran.rocketmq.domain.InitialDiskInfo;
|
||||
import com.tongran.rocketmq.mapper.InitialDiskInfoMapper;
|
||||
import com.tongran.rocketmq.service.IAllDiskNameService;
|
||||
import com.tongran.rocketmq.service.IInitialDiskInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 磁盘监控信息Service业务层处理
|
||||
@@ -29,6 +31,9 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
{
|
||||
@Autowired
|
||||
private InitialDiskInfoMapper initialDiskInfoMapper;
|
||||
@Autowired
|
||||
private IAllDiskNameService allDiskNameService;
|
||||
private final static String TABLE_PREFIX = "initial_disk_info";
|
||||
|
||||
/**
|
||||
* 查询磁盘监控信息
|
||||
@@ -111,13 +116,44 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||
public int batchInsertInitialDiskInfo(List<InitialDiskInfo> list) {
|
||||
try {
|
||||
return initialDiskInfoMapper.batchInsertInitialDiskInfo(list);
|
||||
}catch (Exception e){
|
||||
log.error("批量插入磁盘信息失败,失败数量:{}", list.size(), e);
|
||||
throw new RuntimeException("批量保存失败",e);
|
||||
public int batchInsertInitialDiskInfo(List<InitialDiskInfo> list, Date createTime) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
// 按表名分组批量插入
|
||||
Map<String, List<InitialDiskInfo>> groupedData = list.stream()
|
||||
.map(data -> {
|
||||
try {
|
||||
InitialDiskInfo processed = new InitialDiskInfo();
|
||||
BeanUtils.copyProperties(data,processed);
|
||||
if (data.getCreateTime() == null) {
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
}
|
||||
processed.setTableName(TableSubUtil.getTableName(createTime, TABLE_PREFIX));
|
||||
return processed;
|
||||
} catch (Exception e){
|
||||
log.error("数据处理失败",e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.groupingBy(
|
||||
InitialDiskInfo::getTableName,
|
||||
LinkedHashMap::new, // 保持插入顺序
|
||||
Collectors.toList()));
|
||||
|
||||
groupedData.forEach((tableName, dataList) -> {
|
||||
try {
|
||||
InitialDiskInfo data = new InitialDiskInfo();
|
||||
data.setTableName(tableName);
|
||||
data.setList(dataList);
|
||||
initialDiskInfoMapper.batchInsertInitialDiskInfo(data);
|
||||
// 记录磁盘名称
|
||||
allDiskNameService.batchInsertAllDistName(dataList);
|
||||
} catch (Exception e) {
|
||||
log.error("表{}插入失败", tableName, e);
|
||||
throw new RuntimeException("批量插入失败", e);
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 磁盘设备/dev/sda基础信息
|
||||
@@ -126,6 +162,8 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
*/
|
||||
@Override
|
||||
public InitialDiskInfo getDistDetailsMsg(InitialDiskInfo initialDiskInfo) {
|
||||
String tableName = TableSubUtil.getTableName(DateUtils.getNowDate(), TABLE_PREFIX);
|
||||
initialDiskInfo.setTableName(tableName);
|
||||
InitialDiskInfo info = initialDiskInfoMapper.getDistDetailsMsgByClientId(initialDiskInfo);
|
||||
if(info != null){
|
||||
long gbUnit = 1024L * 1024 * 1024;
|
||||
@@ -137,6 +175,28 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
}
|
||||
return info;
|
||||
}
|
||||
/**
|
||||
* 分表查询硬盘信息
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public List<InitialDiskInfo> getDistInfoSharding(InitialDiskInfo queryParam) {
|
||||
// 获取涉及的表名
|
||||
Set<String> tableNames = TableSubUtil.getExistingTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime(), TABLE_PREFIX);
|
||||
|
||||
// 并行查询各表
|
||||
return tableNames.parallelStream()
|
||||
.flatMap(tableName -> {
|
||||
InitialDiskInfo condition = new InitialDiskInfo();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setName(queryParam.getName());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
return initialDiskInfoMapper.selectInitialDiskInfoListByCondition(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
/**
|
||||
* /dev/sda读写速率(KB/s)
|
||||
* @param initialDiskInfo
|
||||
@@ -144,7 +204,7 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> rwSpeedEcharts(InitialDiskInfo initialDiskInfo) {
|
||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
||||
List<InitialDiskInfo> list = getDistInfoSharding(initialDiskInfo);
|
||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("readSpeedData", info -> info.getReadSpeed() / 1024.0);
|
||||
extractors.put("writeSpeedData", info -> info.getWriteSpeed() / 1024.0);
|
||||
@@ -157,7 +217,7 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> rwTimesEcharts(InitialDiskInfo initialDiskInfo) {
|
||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
||||
List<InitialDiskInfo> list = getDistInfoSharding(initialDiskInfo);
|
||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("readTimesData", info -> info.getReadTimes());
|
||||
extractors.put("writeTimesData", info -> info.getWriteTimes());
|
||||
@@ -170,7 +230,7 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> rwBytesEcharts(InitialDiskInfo initialDiskInfo) {
|
||||
List<InitialDiskInfo> list = initialDiskInfoMapper.selectInitialDiskInfoList(initialDiskInfo);
|
||||
List<InitialDiskInfo> list = getDistInfoSharding(initialDiskInfo);
|
||||
Map<String, Function<InitialDiskInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("readBytesData", info -> info.getReadBytes());
|
||||
extractors.put("writeBytesData", info -> info.getWriteBytes());
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.AllDiskNameMapper">
|
||||
|
||||
<resultMap type="AllDiskName" id="AllDiskNameResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="readIops" column="read_iops" />
|
||||
<result property="writeIops" column="write_iops" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAllDiskNameVo">
|
||||
select id, client_id, name, status, read_iops, write_iops, create_time, update_time, create_by, update_by from all_disk_name
|
||||
</sql>
|
||||
|
||||
<select id="selectAllDiskNameList" parameterType="AllDiskName" resultMap="AllDiskNameResult">
|
||||
<include refid="selectAllDiskNameVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="readIops != null and readIops != ''"> and read_iops = #{readIops}</if>
|
||||
<if test="writeIops != null and writeIops != ''"> and write_iops = #{writeIops}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAllDiskNameById" parameterType="Long" resultMap="AllDiskNameResult">
|
||||
<include refid="selectAllDiskNameVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAllDiskName" parameterType="AllDiskName" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into all_disk_name
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="readIops != null">read_iops,</if>
|
||||
<if test="writeIops != null">write_iops,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="readIops != null">#{readIops},</if>
|
||||
<if test="writeIops != null">#{writeIops},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="readIops != null">read_iops = #{readIops},</if>
|
||||
<if test="writeIops != null">write_iops = #{writeIops},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAllDiskName" parameterType="AllDiskName">
|
||||
update all_disk_name
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="readIops != null">read_iops = #{readIops},</if>
|
||||
<if test="writeIops != null">write_iops = #{writeIops},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAllDiskNameById" parameterType="Long">
|
||||
delete from all_disk_name where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAllDiskNameByIds" parameterType="String">
|
||||
delete from all_disk_name where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<insert id="batchInsertAllDistName" parameterType="java.util.List">
|
||||
insert IGNORE into all_disk_name
|
||||
(client_id, name, status, read_iops, write_iops, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.clientId},
|
||||
#{item.name},
|
||||
#{item.status},
|
||||
#{item.readIops},
|
||||
#{item.writeIops},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
#{item.updateBy}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.InitialDiskInfoMapper">
|
||||
|
||||
|
||||
<resultMap type="InitialDiskInfo" id="InitialDiskInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
@@ -16,6 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="readTimes" column="read_times" />
|
||||
<result property="writeBytes" column="write_bytes" />
|
||||
<result property="readBytes" column="read_bytes" />
|
||||
<!-- 新增的两个字段 -->
|
||||
<result property="type" column="type" />
|
||||
<result property="usedSpace" column="used_space" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
@@ -23,20 +26,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialDiskInfoVo">
|
||||
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes, read_bytes, create_by, update_by, create_time, update_time from initial_disk_info
|
||||
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes, read_bytes, type, used_space, create_by, update_by, create_time, update_time from initial_disk_info
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialDiskInfoList" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
|
||||
<include refid="selectInitialDiskInfoVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectInitialDiskInfoListByCondition" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
|
||||
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes,
|
||||
read_bytes, type, used_space, create_by, update_by, create_time, update_time
|
||||
from ${tableName}
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectInitialDiskInfoById" parameterType="Long" resultMap="InitialDiskInfoResult">
|
||||
<include refid="selectInitialDiskInfoVo"/>
|
||||
where id = #{id}
|
||||
@@ -56,11 +73,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="readTimes != null">read_times,</if>
|
||||
<if test="writeBytes != null">write_bytes,</if>
|
||||
<if test="readBytes != null">read_bytes,</if>
|
||||
<!-- 新增的两个字段 -->
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="usedSpace != null">used_space,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
||||
@@ -73,11 +93,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="readTimes != null">#{readTimes},</if>
|
||||
<if test="writeBytes != null">#{writeBytes},</if>
|
||||
<if test="readBytes != null">#{readBytes},</if>
|
||||
<!-- 新增的两个字段 -->
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="usedSpace != null">#{usedSpace},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInitialDiskInfo" parameterType="InitialDiskInfo">
|
||||
@@ -93,6 +116,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="readTimes != null">read_times = #{readTimes},</if>
|
||||
<if test="writeBytes != null">write_bytes = #{writeBytes},</if>
|
||||
<if test="readBytes != null">read_bytes = #{readBytes},</if>
|
||||
<!-- 新增的两个字段 -->
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="usedSpace != null">used_space = #{usedSpace},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@@ -106,14 +132,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInitialDiskInfoByIds" parameterType="String">
|
||||
delete from initial_disk_info where id in
|
||||
delete from initial_disk_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertInitialDiskInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT IGNORE INTO initial_disk_info
|
||||
<insert id="batchInsertInitialDiskInfo" parameterType="InitialDiskInfo">
|
||||
INSERT IGNORE INTO ${tableName}
|
||||
(
|
||||
id,
|
||||
client_id,
|
||||
@@ -126,6 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
read_times,
|
||||
write_bytes,
|
||||
read_bytes,
|
||||
type,
|
||||
used_space,
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
@@ -145,6 +173,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.readTimes},
|
||||
#{item.writeBytes},
|
||||
#{item.readBytes},
|
||||
#{item.type},
|
||||
#{item.usedSpace},
|
||||
#{item.createBy},
|
||||
#{item.updateBy},
|
||||
<choose>
|
||||
@@ -166,14 +196,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getDistDetailsMsgByClientId" parameterType="InitialDiskInfo" resultMap="InitialDiskInfoResult">
|
||||
<include refid="selectInitialDiskInfoVo"/>
|
||||
select id, client_id, name, serial, total, write_speed, read_speed, write_times, read_times, write_bytes,
|
||||
read_bytes, type, used_space, create_by, update_by, create_time, update_time
|
||||
from ${tableName}
|
||||
where client_id = #{clientId} and `name`= #{name}
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getAllDistName" parameterType="String" resultType="java.util.Map">
|
||||
select name from initial_disk_info
|
||||
select name from all_disk_name
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
</where>
|
||||
|
||||
Reference in New Issue
Block a user