@@ -12,7 +12,7 @@ public interface SwEnum { | |||||
* Created by Akmm at 2022/2/9 10:01 | * Created by Akmm at 2022/2/9 10:01 | ||||
* 字段业务类别 | * 字段业务类别 | ||||
*/ | */ | ||||
class FieldType extends IntEnum{ | |||||
class FieldType extends IntEnum { | |||||
public static FieldType instance = new FieldType(); | public static FieldType instance = new FieldType(); | ||||
public static IntEnumBean ID = instance.addEnum(1, "主键"); | public static IntEnumBean ID = instance.addEnum(1, "主键"); | ||||
@@ -28,33 +28,72 @@ public interface SwEnum { | |||||
} | } | ||||
/** | /** | ||||
* 字段编辑类型 | |||||
*/ | |||||
class EditorType extends StrEnum { | |||||
public static EditorType instance = new EditorType(); | |||||
public static StrEnumBean INPUT = instance.addEnum("input", "文本"); | |||||
public static StrEnumBean TEXT = instance.addEnum("text", "长文本"); | |||||
public static StrEnumBean NUMBER = instance.addEnum("num", "数字"); | |||||
public static StrEnumBean DATE = instance.addEnum("date", "日期"); | |||||
public static StrEnumBean TIME = instance.addEnum("time", "时间"); | |||||
public static StrEnumBean DATETIME = instance.addEnum("datetime", "日期时间"); | |||||
public static StrEnumBean COMBO = instance.addEnum("combo", "下拉"); | |||||
public static StrEnumBean TREE = instance.addEnum("tree", "树型"); | |||||
} | |||||
/** | |||||
* 数据字段类型Bean | |||||
*/ | |||||
class DataTypeBean extends AbstractEnum.StrEnumBean { | |||||
public String sqlType; | |||||
public int dataLength; | |||||
public String javaType; | |||||
public String defaultValue; | |||||
public String editor; | |||||
public DataTypeBean(String value, String name, String sqlType, int dataLength, String javaType, String defaultValue, String editor) { | |||||
super(value, name); | |||||
this.sqlType = sqlType; | |||||
this.dataLength = dataLength; | |||||
this.javaType = javaType; | |||||
this.defaultValue = defaultValue; | |||||
this.editor = editor; | |||||
} | |||||
} | |||||
/** | |||||
* 数据类型定义,参见design_db.yaml配置 | * 数据类型定义,参见design_db.yaml配置 | ||||
*/ | */ | ||||
@Data | |||||
class DataType { | |||||
/*{type: "id", name: "ID", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"} | |||||
- {type: "code", name: "编码", sql-type: "varchar", java-type: "string", data-length: 32, widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "name", name: "名字", sql-type: "varchar", java-type: "string", data-length: 100, widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "remark", name: "备注", sql-type: "varchar", data-length: 255, java-type: "string", widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "text", name: "大文本", sql-type: "text", java-type: "string", widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "currency", name: "货币", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"} | |||||
- {type: "datetime", name: "时间日期", sql-type: "bigint", java-type: "long", widget: "fz-field-datetime", defaultValue: "0"} | |||||
- {type: "date", name: "日期", sql-type: "int", java-type: "int", widget: "fz-field-date", defaultValue: "0"} | |||||
- {type: "time", name: "时间", sql-type: "int", java-type: "int", widget: "fz-field-time", defaultValue: "0"} | |||||
- {type: "int", name: "整型", sql-type: "int", java-type: "int", widget: "fz-field-int", defaultValue: "0"} | |||||
- {type: "smallint", name: "短整型", sql-type: "smallint", java-type: "short", widget: "fz-field-int", defaultValue: "0"} | |||||
- {type: "bool", name: "布尔型", sql-type: "tinyint", java-type: "boolean", widget: "fz-field-bool", defaultValue: "0"}*/ | |||||
public static final String TYPE_STR = "varchar"; | |||||
public static final String TYPE_BOOL = "bool"; | |||||
public static final String TYPE_DATETIME = "datetime"; | |||||
public static final String TYPE_DATE = "date"; | |||||
private String type; | |||||
private String name; | |||||
private String sqlType; | |||||
private int dataLength; | |||||
private String javaType; | |||||
private String defaultValue; | |||||
class DataType extends AbstractEnum<String, DataTypeBean> { | |||||
public final static String TYPE_BOOL = "bool"; | |||||
public final static String TYPE_DATE = "date"; | |||||
public final static String TYPE_DATETIME = "datetime"; | |||||
public static DataType instance = new DataType(); | |||||
public static DataTypeBean ID = instance.addEnum("id", "ID", "bigint", 0, "long", "", EditorType.INPUT.value); | |||||
public static DataTypeBean CODE = instance.addEnum("code", "编码", "varchar", 32, "string", "", EditorType.INPUT.value); | |||||
public static DataTypeBean NAME = instance.addEnum("name", "名称", "varchar", 100, "string", "", EditorType.INPUT.value); | |||||
public static DataTypeBean REMARK = instance.addEnum("remark", "备注", "varchar", 255, "string", "", EditorType.INPUT.value); | |||||
public static DataTypeBean TEXT = instance.addEnum("text", "大文本", "text", 0, "string", "", EditorType.TEXT.value); | |||||
public static DataTypeBean INT = instance.addEnum("int", "整型", "int", 0, "int", "0", EditorType.NUMBER.value); | |||||
public static DataTypeBean SHORT = instance.addEnum("short", "短整型", "smallint", 0, "short", "0", EditorType.NUMBER.value); | |||||
public static DataTypeBean BOOL = instance.addEnum("bool", "布尔型", "tinyint", 0, "boolean", "0", EditorType.COMBO.value); | |||||
public static DataTypeBean CURRENCY = instance.addEnum("currency", "金额型", "bigint", 0, "long", "0", EditorType.NUMBER.value); | |||||
public static DataTypeBean DATE = instance.addEnum("date", "日期型", "bigint", 0, "long", "0", EditorType.DATE.value); | |||||
public static DataTypeBean TIME = instance.addEnum("time", "时间型", "bigint", 0, "long", "0", EditorType.TIME.value); | |||||
public static DataTypeBean DATETIME = instance.addEnum("datetime", "时间型", "bigint", 0, "long", "0", EditorType.DATETIME.value); | |||||
@Override | |||||
protected DataTypeBean buildBean(String value, String name) { | |||||
return null; | |||||
} | |||||
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); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -1,43 +0,0 @@ | |||||
package cc.smtweb.framework.core.db.config; | |||||
import cc.smtweb.framework.core.common.SwEnum; | |||||
import org.springframework.boot.context.properties.ConfigurationProperties; | |||||
import org.springframework.context.annotation.PropertySource; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
@Component | |||||
//通过@PropertySource注解指定要读取的yaml配置文件,默认读取src\main\resources\application.yml配置 | |||||
@PropertySource(value = "classpath:config/design_db.yaml", factory = YamlPropertyLoaderFactory.class) | |||||
@ConfigurationProperties(prefix = "design") | |||||
public class DesignConfig { | |||||
private List<SwEnum.DataType> dataTypes; | |||||
private Map<String, SwEnum.DataType> mapType = null; | |||||
private void adjustMap() { | |||||
if (mapType == null) { | |||||
synchronized (DesignConfig.class) { | |||||
if (mapType == null) { | |||||
Map<String, SwEnum.DataType> map = new HashMap<>(); | |||||
for (SwEnum.DataType type : dataTypes) { | |||||
map.put(type.getType(), type); | |||||
} | |||||
mapType = map; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
public SwEnum.DataType getDataType(String type) { | |||||
adjustMap(); | |||||
return mapType.get(type); | |||||
} | |||||
public List<SwEnum.DataType> getDataTypes() { | |||||
return dataTypes; | |||||
} | |||||
} |
@@ -1,60 +0,0 @@ | |||||
smtweb: | |||||
machine-id: 1 | |||||
file: | |||||
local-path: /data/files/smart/ | |||||
host: http://127.0.0.1 | |||||
url: ${smtweb.file.host}:${server.port}${server.servlet.context-path}/${smtweb.file.local-path} | |||||
db: | |||||
default: | |||||
rule: | |||||
prefix: _smt_ | |||||
replace: smt_ | |||||
server: | |||||
port: 8888 | |||||
servlet: | |||||
context-path: / | |||||
logging: | |||||
level: | |||||
root: INFO | |||||
cc.smtweb: DEBUG | |||||
spring: | |||||
# 设置服务名 | |||||
application: | |||||
name: smtweb_core | |||||
main: | |||||
allow-bean-definition-overriding: true | |||||
mvc: | |||||
static-path-pattern: /static/** | |||||
redis: | |||||
host: 127.0.0.1 | |||||
port: 6379 | |||||
password: | |||||
database: 0 | |||||
datasource: | |||||
driver-class-name: com.mysql.cj.jdbc.Driver | |||||
url: jdbc:mysql://127.0.0.1:3306/sw_user?useUnicode=true&characterEncoding=utf-8&useTimezone=true&serverTimezone=CTT&allowMultiQueries=true&useSSL=false | |||||
username: root | |||||
password: 1681860 | |||||
servlet: | |||||
multipart: | |||||
max-file-size: 104857600000 | |||||
max-request-size: 10485760000000 | |||||
profiles: | |||||
include: role | |||||
cache: | |||||
type: caffeine | |||||
cache-names: | |||||
- core | |||||
caffeine: | |||||
spec: maximumSize=1024,expireAfterWrite=2h | |||||
park: | |||||
secret: | |||||
key: null | |||||
# key: cmVmb3JtZXJyZWZvcm1lcg== | |||||
swagger: | |||||
name: smtweb-core | |||||
version: 2.0 | |||||
enabled: true | |||||
@@ -1,111 +0,0 @@ | |||||
{ | |||||
"fields": [ | |||||
{ | |||||
"name": "mc_id", | |||||
"fieldType": "1", | |||||
"dataType": "ID", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "ID" | |||||
}, | |||||
{ | |||||
"name": "mc_parent_id", | |||||
"fieldType": "4", | |||||
"dataType": "ID", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "ID", | |||||
"link": "2" | |||||
}, | |||||
{ | |||||
"name": "mc_prj_id", | |||||
"fieldType": "", | |||||
"dataType": "ID", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "ID", | |||||
"link": "1" | |||||
}, | |||||
{ | |||||
"name": "mc_code", | |||||
"fieldType": "2", | |||||
"dataType": "CODE", | |||||
"null": "0", | |||||
"default": "", | |||||
"title": "编码", | |||||
"link": "", | |||||
"editor": "" | |||||
}, | |||||
{ | |||||
"name": "mc_name", | |||||
"fieldType": "3", | |||||
"dataType": "NAME", | |||||
"null": "0", | |||||
"default": "", | |||||
"title": "编码", | |||||
"link": "", | |||||
"editor": "" | |||||
}, | |||||
{ | |||||
"name": "mc_create_uid", | |||||
"fieldType": "7", | |||||
"dataType": "ID", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "创建人", | |||||
"link": "", | |||||
"editor": "" | |||||
}, | |||||
{ | |||||
"name": "mc_update_uid", | |||||
"fieldType": "9", | |||||
"dataType": "ID", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "最后更新人", | |||||
"link": "", | |||||
"editor": "" | |||||
}, | |||||
{ | |||||
"name": "mc_create_at", | |||||
"fieldType": "8", | |||||
"dataType": "DATETIME", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "创建时间", | |||||
"link": "", | |||||
"editor": "" | |||||
}, | |||||
{ | |||||
"name": "mc_update_at", | |||||
"fieldType": "10", | |||||
"dataType": "DATETIME", | |||||
"null": "1", | |||||
"default": "-1", | |||||
"title": "最后更新时间", | |||||
"link": "", | |||||
"editor": "" | |||||
} | |||||
], | |||||
"indexes": [ | |||||
{ | |||||
"name": "pk", | |||||
"fields": "mc_id", | |||||
"type": "P" | |||||
} | |||||
], | |||||
"caches": [ | |||||
{ | |||||
"name": "pr", | |||||
"title": "按树型", | |||||
"fields": "mc_parent_id", | |||||
"type": "L" | |||||
}, | |||||
{ | |||||
"name": "prj", | |||||
"title": "按项目", | |||||
"fields": "mc_prj_id,mc_parent_id", | |||||
"type": "L" | |||||
} | |||||
] | |||||
} |
@@ -1,14 +0,0 @@ | |||||
design: | |||||
data-type: | |||||
- {type: "id", name: "ID", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"} | |||||
- {type: "code", name: "编码", sql-type: "varchar", java-type: "string", data-length: 32, widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "name", name: "名字", sql-type: "varchar", java-type: "string", data-length: 100, widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "remark", name: "备注", sql-type: "varchar", data-length: 255, java-type: "string", widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "text", name: "大文本", sql-type: "text", java-type: "string", widget: "fz-field-string", defaultValue: ""} | |||||
- {type: "currency", name: "货币", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"} | |||||
- {type: "datetime", name: "时间日期", sql-type: "bigint", java-type: "long", widget: "fz-field-datetime", defaultValue: "0"} | |||||
- {type: "date", name: "日期", sql-type: "int", java-type: "int", widget: "fz-field-date", defaultValue: "0"} | |||||
- {type: "time", name: "时间", sql-type: "int", java-type: "int", widget: "fz-field-time", defaultValue: "0"} | |||||
- {type: "int", name: "整型", sql-type: "int", java-type: "int", widget: "fz-field-int", defaultValue: "0"} | |||||
- {type: "smallint", name: "短整型", sql-type: "smallint", java-type: "short", widget: "fz-field-int", defaultValue: "0"} | |||||
- {type: "bool", name: "布尔型", sql-type: "tinyint", java-type: "boolean", widget: "fz-field-bool", defaultValue: "0"} |
@@ -1,16 +0,0 @@ | |||||
package cc.smtweb.system.bpm.web.design.db; | |||||
import cc.smtweb.framework.core.R; | |||||
import cc.smtweb.framework.core.annotation.SwParam; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.db.config.DesignConfig; | |||||
@SwService | |||||
public class DbConfigService { | |||||
@SwParam | |||||
private DesignConfig designConfig; | |||||
public R dataType() { | |||||
return R.success(designConfig.getDataTypes()); | |||||
} | |||||
} |
@@ -7,7 +7,6 @@ import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.db.DbEngine; | import cc.smtweb.framework.core.db.DbEngine; | ||||
import cc.smtweb.framework.core.db.cache.ModelDatabaseCache; | import cc.smtweb.framework.core.db.cache.ModelDatabaseCache; | ||||
import cc.smtweb.framework.core.db.cache.ModelTableCache; | import cc.smtweb.framework.core.db.cache.ModelTableCache; | ||||
import cc.smtweb.framework.core.db.config.DesignConfig; | |||||
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; | ||||
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; | ||||
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; | ||||
@@ -28,9 +27,6 @@ public class AspDbCardService { | |||||
private ModelTableCache bpmTableCache; | private ModelTableCache bpmTableCache; | ||||
@SwParam | @SwParam | ||||
private DesignConfig designConfig; | |||||
@SwParam | |||||
protected DatasetConfigDao datasetConfigDao; | protected DatasetConfigDao datasetConfigDao; | ||||
// @ApiOperation(value = "读取数据模型数据") | // @ApiOperation(value = "读取数据模型数据") | ||||
@@ -5,7 +5,6 @@ import cc.smtweb.framework.core.annotation.SwBody; | |||||
import cc.smtweb.framework.core.annotation.SwParam; | import cc.smtweb.framework.core.annotation.SwParam; | ||||
import cc.smtweb.framework.core.annotation.SwService; | import cc.smtweb.framework.core.annotation.SwService; | ||||
import cc.smtweb.framework.core.db.DbEngine; | import cc.smtweb.framework.core.db.DbEngine; | ||||
import cc.smtweb.framework.core.db.config.DesignConfig; | |||||
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder; | ||||
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder; | ||||
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; | import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder; | ||||
@@ -43,9 +42,6 @@ public class AspModelCardService { | |||||
private BpmPageCache bpmPageCache; | private BpmPageCache bpmPageCache; | ||||
@SwParam | @SwParam | ||||
private DesignConfig designConfig; | |||||
@SwParam | |||||
protected DatasetConfigDao datasetConfigDao; | protected DatasetConfigDao datasetConfigDao; | ||||
// @ApiOperation(value = "读取数据模型数据") | // @ApiOperation(value = "读取数据模型数据") | ||||
@@ -4,7 +4,7 @@ import cc.smtweb.framework.core.R; | |||||
import cc.smtweb.framework.core.SwMap; | import cc.smtweb.framework.core.SwMap; | ||||
import cc.smtweb.framework.core.annotation.SwParam; | import cc.smtweb.framework.core.annotation.SwParam; | ||||
import cc.smtweb.framework.core.annotation.SwService; | import cc.smtweb.framework.core.annotation.SwService; | ||||
import cc.smtweb.framework.core.db.config.DesignConfig; | |||||
import cc.smtweb.framework.core.common.SwEnum; | |||||
import cc.smtweb.system.bpm.spring.BpmConfigBean; | import cc.smtweb.system.bpm.spring.BpmConfigBean; | ||||
import cc.smtweb.system.bpm.util.YamlUtil; | import cc.smtweb.system.bpm.util.YamlUtil; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -16,15 +16,14 @@ import java.util.Map; | |||||
@Slf4j | @Slf4j | ||||
@SwService | @SwService | ||||
@Deprecated | |||||
public class AspModelConfigService { | public class AspModelConfigService { | ||||
@SwParam | |||||
private DesignConfig designConfig; | |||||
@SwParam | @SwParam | ||||
private BpmConfigBean bpmConfigBean; | private BpmConfigBean bpmConfigBean; | ||||
public R load() { | public R load() { | ||||
R result = R.success().put("dataType", designConfig.getDataTypes()); | |||||
R result = R.success().put("dataType", SwEnum.DataType.instance.values()); | |||||
String configUiPath = bpmConfigBean.getConfigUiPath(); | String configUiPath = bpmConfigBean.getConfigUiPath(); | ||||
if (StringUtils.isNotBlank(configUiPath)) { | if (StringUtils.isNotBlank(configUiPath)) { | ||||
@@ -3,7 +3,6 @@ package cc.smtweb.system.bpm.web.design.model; | |||||
import cc.smtweb.framework.core.annotation.SwParam; | import cc.smtweb.framework.core.annotation.SwParam; | ||||
import cc.smtweb.framework.core.annotation.SwService; | import cc.smtweb.framework.core.annotation.SwService; | ||||
import cc.smtweb.framework.core.db.DbEngine; | import cc.smtweb.framework.core.db.DbEngine; | ||||
import cc.smtweb.framework.core.db.config.DesignConfig; | |||||
import cc.smtweb.framework.core.db.jdbc.IdGenerator; | import cc.smtweb.framework.core.db.jdbc.IdGenerator; | ||||
import cc.smtweb.system.bpm.spring.cache.BpmFlowCache; | import cc.smtweb.system.bpm.spring.cache.BpmFlowCache; | ||||
import cc.smtweb.system.bpm.spring.cache.BpmPageCache; | import cc.smtweb.system.bpm.spring.cache.BpmPageCache; | ||||
@@ -22,9 +21,6 @@ public class AspModelExportService { | |||||
@SwParam | @SwParam | ||||
private IdGenerator idGenerator; | private IdGenerator idGenerator; | ||||
@SwParam | |||||
private DesignConfig designConfig; | |||||
/*// @ApiOperation(value = "读取数据模型数据") | /*// @ApiOperation(value = "读取数据模型数据") | ||||
public R mysql(@SwBody SwMap body, UserSession us) { | public R mysql(@SwBody SwMap body, UserSession us) { | ||||
String sql = "select model_id, model_parent_id, model_mc_id, model_site_id, model_key, model_name, model_status, model_content, model_type, model_version, model_create_uid, model_update_uid, model_create_time, model_last_time from sw_bpm.asp_model" + | String sql = "select model_id, model_parent_id, model_mc_id, model_site_id, model_key, model_name, model_status, model_content, model_type, model_version, model_create_uid, model_update_uid, model_create_time, model_last_time from sw_bpm.asp_model" + | ||||
@@ -104,8 +104,8 @@ public class BpmTaskCardService extends AbstractTaskCardService { | |||||
case SwEnum.DataType.TYPE_BOOL: | case SwEnum.DataType.TYPE_BOOL: | ||||
uiField.put("component", "fy-checkbox"); | uiField.put("component", "fy-checkbox"); | ||||
break; | break; | ||||
case SwEnum.DataType.TYPE_DATETIME: | |||||
case SwEnum.DataType.TYPE_DATE: | case SwEnum.DataType.TYPE_DATE: | ||||
case SwEnum.DataType.TYPE_DATETIME: | |||||
uiField.put("component", "fy-datetime"); | uiField.put("component", "fy-datetime"); | ||||
break; | break; | ||||
default: | default: | ||||