09081028:给任务模块提供查询和添加的接口
parent
38cb2d157a
commit
769cc3f149
|
@ -22,7 +22,6 @@ public class DataValueModel {
|
|||
* 数据接入的ID
|
||||
*/
|
||||
private Long basicId;
|
||||
private Long tableId;
|
||||
/**
|
||||
* 拼写的sql语句
|
||||
*/
|
||||
|
@ -36,6 +35,5 @@ public class DataValueModel {
|
|||
*/
|
||||
private Integer two;
|
||||
|
||||
private DataValueModel[][] dataValues;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.muyu.source.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @author Lenovo
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-03-22:14
|
||||
* @ Version:1.0
|
||||
* @ Description:任务表查询时用到
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataValueModels {
|
||||
/**
|
||||
* 数据接入的ID
|
||||
*/
|
||||
private Long basicId;
|
||||
|
||||
private Long tableId;
|
||||
/**
|
||||
* 拼写的sql语句
|
||||
*/
|
||||
private String sql;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long one;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer two;
|
||||
|
||||
private DataValueModels[][] dataValues;
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.source.controller;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.source.core.DataValue;
|
||||
import com.muyu.source.domain.model.DataValueModel;
|
||||
import com.muyu.source.domain.model.DataValueModels;
|
||||
import com.muyu.source.service.DataValueService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -102,7 +103,7 @@ public class DataValueController {
|
|||
return Result.success(dataValues);
|
||||
}
|
||||
@PostMapping("/addTableValueByType")
|
||||
public Result addTableValueByType(@RequestBody DataValueModel dataValueModel){
|
||||
public Result addTableValueByType(@RequestBody DataValueModels dataValueModel){
|
||||
//开始执行的时间
|
||||
long begin = System.currentTimeMillis();
|
||||
int i =dataValueService.addTableValueByType(dataValueModel);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.source.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.core.DataValue;
|
||||
import com.muyu.source.domain.model.DataValueModel;
|
||||
import com.muyu.source.domain.model.DataValueModels;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
@ -32,5 +33,5 @@ public interface DataValueService extends IService<DataValue> {
|
|||
*/
|
||||
DataValue[][] findTableValueByTable(DataValueModel dataValueModel);
|
||||
|
||||
int addTableValueByType(DataValueModel dataValueModel);
|
||||
int addTableValueByType(DataValueModels dataValueModel);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.muyu.source.core.DataType;
|
|||
import com.muyu.source.core.DataValue;
|
||||
import com.muyu.source.domain.DataSource;
|
||||
import com.muyu.source.domain.model.DataValueModel;
|
||||
import com.muyu.source.domain.model.DataValueModels;
|
||||
import com.muyu.source.mapper.DataValueMapper;
|
||||
import com.muyu.source.mysql.MysqlDataSource;
|
||||
import com.muyu.source.mysql.MysqlQuery;
|
||||
|
@ -347,7 +348,7 @@ public class DataValueServiceImpl extends ServiceImpl<DataValueMapper, DataValue
|
|||
* @return List<DataValue>
|
||||
*/
|
||||
@Override
|
||||
public int addTableValueByType(DataValueModel dataValueModel) {
|
||||
public int addTableValueByType(DataValueModels dataValueModel) {
|
||||
MysqlQuery mysqlQuery = new MysqlQuery();
|
||||
mysqlQuery.setDataSourceId(dataValueModel.getBasicId());
|
||||
DataSource dataSource = dataSourceService.getById(dataValueModel.getBasicId());
|
||||
|
@ -440,7 +441,7 @@ public class DataValueServiceImpl extends ServiceImpl<DataValueMapper, DataValue
|
|||
* @param batchSize 每小批量的大小
|
||||
* @return 小批量列表
|
||||
*/
|
||||
private List<DataValue[][]> splitData(DataValueModel[][] dataValues, int batchSize) {
|
||||
private List<DataValue[][]> splitData(DataValueModels[][] dataValues, int batchSize) {
|
||||
List<DataValue[][]> batches = new ArrayList<>();
|
||||
int totalSize = dataValues.length;
|
||||
int numBatches = (int) Math.ceil((double) totalSize / batchSize);
|
||||
|
|
Loading…
Reference in New Issue