代码调整
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.db.mybatisplus.service.impl.ReplenishMybatisServiceImpl;
|
||||
import com.njcn.gather.storage.mapper.DetectionDataDealMapper;
|
||||
@@ -27,6 +28,14 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
public Boolean acceptAdNon(List<AdNonHarmonicResult> adNonHarmonicResultList,String code) {
|
||||
String adNonTable = "ad_non_harmonic_";
|
||||
DynamicTableNameHandler.setTableName(adNonTable +code);
|
||||
for(AdNonHarmonicResult item :adNonHarmonicResultList){
|
||||
adNonHarmonicService.remove(new LambdaQueryWrapper<AdNonHarmonicResult>()
|
||||
.eq(AdNonHarmonicResult::getMonitorId,item.getMonitorId())
|
||||
.eq(AdNonHarmonicResult::getSort,item.getSort())
|
||||
.eq(AdNonHarmonicResult::getScriptId,item.getScriptId())
|
||||
);
|
||||
}
|
||||
|
||||
adNonHarmonicService.saveBatch(adNonHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
return true;
|
||||
@@ -36,6 +45,15 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
public Boolean acceptAd(List<AdHarmonicResult> adHarmonicResultList,String code) {
|
||||
String adTable = "ad_harmonic_";
|
||||
DynamicTableNameHandler.setTableName(adTable +code);
|
||||
|
||||
for(AdHarmonicResult item :adHarmonicResultList){
|
||||
this.remove(new LambdaQueryWrapper<AdHarmonicResult>()
|
||||
.eq(AdHarmonicResult::getMonitorId,item.getMonitorId())
|
||||
.eq(AdHarmonicResult::getSort,item.getSort())
|
||||
.eq(AdHarmonicResult::getScriptId,item.getScriptId())
|
||||
);
|
||||
}
|
||||
|
||||
this.saveBatch(adHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
return true;
|
||||
@@ -45,6 +63,15 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
public Boolean acceptAdNonResult(List<AdNonHarmonicResult> adNonHarmonicResultList,String code) {
|
||||
String adNonTableResult = "ad_non_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adNonTableResult +code);
|
||||
|
||||
for(AdNonHarmonicResult item :adNonHarmonicResultList){
|
||||
adNonHarmonicService.remove(new LambdaQueryWrapper<AdNonHarmonicResult>()
|
||||
.eq(AdNonHarmonicResult::getMonitorId,item.getMonitorId())
|
||||
.eq(AdNonHarmonicResult::getSort,item.getSort())
|
||||
.eq(AdNonHarmonicResult::getScriptId,item.getScriptId())
|
||||
|
||||
);
|
||||
}
|
||||
adNonHarmonicService.saveBatch(adNonHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
return true;
|
||||
@@ -54,6 +81,14 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
|
||||
public Boolean acceptAdResult(List<AdHarmonicResult> adHarmonicResultList,String code) {
|
||||
String adTableResult = "ad_harmonic_result_";
|
||||
DynamicTableNameHandler.setTableName(adTableResult +code);
|
||||
for(AdHarmonicResult item :adHarmonicResultList){
|
||||
this.remove(new LambdaQueryWrapper<AdHarmonicResult>()
|
||||
.eq(AdHarmonicResult::getMonitorId,item.getMonitorId())
|
||||
.eq(AdHarmonicResult::getSort,item.getSort())
|
||||
.eq(AdHarmonicResult::getScriptId,item.getScriptId())
|
||||
|
||||
);
|
||||
}
|
||||
this.saveBatch(adHarmonicResultList,100);
|
||||
DynamicTableNameHandler.remove();
|
||||
return true;
|
||||
|
||||
@@ -37,11 +37,12 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
|
||||
String sql = "CREATE TABLE AD_Harmonic_"+code+" (\n" +
|
||||
" Monitor_Id CHAR(60) NOT NULL COMMENT '监测点Id',\n" +
|
||||
" Time_Id DATETIME NULL COMMENT '时间',\n" +
|
||||
" Time_Id DATETIME NOT NULL COMMENT '时间',\n" +
|
||||
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\n" +
|
||||
" Sort int(5) NOT NULL COMMENT '总检测脚本中的测试项序号',\n" +
|
||||
" AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',\n" +
|
||||
" Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" +
|
||||
" Result_Flag int(1) NULL COMMENT '0.不合格 1.合格',\n" +
|
||||
A+B+C+
|
||||
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" +
|
||||
") COMMENT='监测数据表';";
|
||||
@@ -49,14 +50,14 @@ public class TableGenServiceImpl implements TableGenService {
|
||||
|
||||
String sql2 = "CREATE TABLE AD_Harmonic_Result_"+code+" (\n" +
|
||||
" Monitor_Id CHAR(60) NOT NULL COMMENT '监测点Id',\n" +
|
||||
" Time_Id DATETIME NOT NULL COMMENT '时间',\n" +
|
||||
" Time_Id DATETIME NULL COMMENT '时间',\n" +
|
||||
" Script_Id CHAR(32) NOT NULL COMMENT '检测脚本子表Id,字典表',\n" +
|
||||
" Sort int(5) NOT NULL COMMENT '总检测脚本中的测试项序号',\n" +
|
||||
" AD_Type CHAR(32) NOT NULL COMMENT '检测指标,字典表',\n" +
|
||||
" Data_Type CHAR(32) NOT NULL COMMENT '数据指标,只有数据源为分钟统计时候才会使用(最大、最小、平均、CP95,默认平均值),字典表',\n" +
|
||||
" Result_Flag int(1) NOT NULL COMMENT '0.不合格 1.合格',\n" +
|
||||
A+B+C+
|
||||
" PRIMARY KEY (Monitor_Id,Time_Id, Script_Id, Sort, Data_Type)\n" +
|
||||
" PRIMARY KEY (Monitor_Id, Script_Id, Sort, Data_Type)\n" +
|
||||
") COMMENT='监测数据表';";
|
||||
tableGenMapper.genAdHarmonicTable(sql2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user