修改数据结构,并添加数据类型枚举

master
王鑫 2024-08-29 14:17:16 +08:00
parent 8721f7a8be
commit 8a3a6d3162
2 changed files with 75 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package com.muyu.domain;
import com.muyu.enums.DataType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -16,9 +17,20 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public class DataStructure {
private String name;
private Object type;
/**
*
*/
private String key;
/**
*
*/
private String type;
/**
*
*/
private String label;
private Object value;
/**
*
*/
private DataType value;
}

View File

@ -0,0 +1,59 @@
package com.muyu.enums;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author WangXin
* @Data 2024/8/28
* @Description
* @Version 1.0.0
*/
public enum DataType {
STRING(
new String[]{"char", "varchar", "text", "mediumtext", "longtext", "longblob"},
String.class
),
INTEGER(
new String[]{"int", "tinyint"},
Integer.class
),
DATE(
new String[]{"date", "datetime","timestamp"},
Date.class
),
BIG_DECIMAL(
new String[]{"decimal", "double", "float"},
BigDecimal.class
),
LONG(
new String[]{"bigint"},
Long.class
);
private String[] sourceType;
private Class<?> targetType;
DataType(String[] sourceType, Class<?> targetType) {
this.sourceType = sourceType;
this.targetType = targetType;
}
public String[] getSourceType() {
return sourceType;
}
public void setSourceType(String[] sourceType) {
this.sourceType = sourceType;
}
public Class<?> getTargetType() {
return targetType;
}
public void setTargetType(Class<?> targetType) {
this.targetType = targetType;
}
}