郑根木 pirms 2 gadiem
vecāks
revīzija
154dd4e3aa
1 mainītis faili ar 35 papildinājumiem un 12 dzēšanām
  1. +35
    -12
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java

+ 35
- 12
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java Parādīt failu

@@ -8,23 +8,44 @@ import lombok.Data;
*/
public interface SwEnum {


/**
* Created by Akmm at 2022/2/9 10:01
* 字段业务类别
*/
class FieldType extends IntEnum {
class FieldTypeBean extends AbstractEnum.IntEnumBean {
public String dataType;

public FieldTypeBean(Integer value, String name, String dataType) {
super(value, name);
this.dataType = dataType;
}
}

class FieldType extends AbstractEnum<Integer, FieldTypeBean> {
public static FieldType instance = new FieldType();

public static IntEnumBean ID = instance.addEnum(1, "主键");
public static IntEnumBean CODE = instance.addEnum(2, "编码字段");
public static IntEnumBean NAME = instance.addEnum(3, "名称字段");
public static IntEnumBean PARENT_ID = instance.addEnum(4, "父ID");
public static IntEnumBean LEVEL_CODE = instance.addEnum(5, "级次码");
public static IntEnumBean ORDER = instance.addEnum(6, "排序字段");
public static IntEnumBean CREATE_USER = instance.addEnum(7, "创建人");
public static IntEnumBean CREATE_TIME = instance.addEnum(8, "创建时间");
public static IntEnumBean UPDATE_USER = instance.addEnum(9, "更新人");
public static IntEnumBean LAST_TIME = instance.addEnum(10, "更新时间");
public static IntEnumBean ID = instance.addEnum(1, "主键", DataType.ID.value);
public static IntEnumBean CODE = instance.addEnum(2, "编码字段", DataType.CODE.value);
public static IntEnumBean NAME = instance.addEnum(3, "名称字段", DataType.NAME.value);
public static IntEnumBean PARENT_ID = instance.addEnum(4, "父ID", DataType.ID.value);
public static IntEnumBean LEVEL_CODE = instance.addEnum(5, "级次码", DataType.CODE.value);
public static IntEnumBean ORDER = instance.addEnum(6, "排序字段", "");
public static IntEnumBean CREATE_USER = instance.addEnum(7, "创建人", DataType.ID.value);
public static IntEnumBean CREATE_TIME = instance.addEnum(8, "创建时间", DataType.DATETIME.value);
public static IntEnumBean UPDATE_USER = instance.addEnum(9, "更新人", DataType.ID.value);
public static IntEnumBean LAST_TIME = instance.addEnum(10, "更新时间", DataType.DATETIME.value);

@Override
protected FieldTypeBean buildBean(Integer value, String name) {
return new FieldTypeBean(value, name, "");
}

public FieldTypeBean addEnum(Integer value, String name, String dataType) {
final FieldTypeBean bean = new FieldTypeBean(value, name, dataType);
mapAll.put(value, bean);
return bean;
}
}

/**
@@ -92,7 +113,9 @@ public interface SwEnum {
}

public DataTypeBean addEnum(String value, String name, String sqlType, int dataLength, String javaType, String defaultValue, String editor) {
return new DataTypeBean(value, name, sqlType, dataLength, javaType, defaultValue, editor);
final DataTypeBean bean = new DataTypeBean(value, name, sqlType, dataLength, javaType, defaultValue, editor);
mapAll.put(value, bean);
return bean;
}
}



Notiek ielāde…
Atcelt
Saglabāt