@@ -30,8 +30,8 @@ public class ModelTableCache extends AbstractCache<ModelTable> { | |||||
public ModelTableCache() { | public ModelTableCache() { | ||||
regMap(mk, k-> k.getName().toUpperCase()); | regMap(mk, k-> k.getName().toUpperCase()); | ||||
regList(md, k-> String.valueOf(k.getDatabaseId())); | |||||
regList(mc, k-> String.valueOf(k.getCatalogId())); | |||||
regList(md, k-> String.valueOf(k.getDbId())); | |||||
regList(mc, k-> String.valueOf(k.getMcId())); | |||||
// regList(mf, k-> k.get); | // regList(mf, k-> k.get); | ||||
} | } | ||||
@@ -66,10 +66,10 @@ public class ModelTableCache extends AbstractCache<ModelTable> { | |||||
ModelTable table = new ModelTable(); | ModelTable table = new ModelTable(); | ||||
list.add(table); | list.add(table); | ||||
table.setId(rs.getLong("tb_id")); | table.setId(rs.getLong("tb_id")); | ||||
table.setDatabaseId(rs.getLong("tb_db_id")); | |||||
table.setPrjoectId(rs.getLong("tb_prj_id")); | |||||
table.setCatalogId(rs.getLong("tb_mc_id")); | |||||
table.setTableExtends(rs.getString("tb_extends")); | |||||
table.setDbId(rs.getLong("tb_db_id")); | |||||
table.setPrjId(rs.getLong("tb_prj_id")); | |||||
table.setMcId(rs.getLong("tb_mc_id")); | |||||
table.setExtends(rs.getString("tb_extends")); | |||||
table.setName(rs.getString("tb_name").toUpperCase()); | table.setName(rs.getString("tb_name").toUpperCase()); | ||||
table.setTitle(rs.getString("tb_title")); | table.setTitle(rs.getString("tb_title")); | ||||
table.setAbbr(rs.getString("tb_abbr")); | table.setAbbr(rs.getString("tb_abbr")); | ||||
@@ -79,7 +79,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> { | |||||
table.setUpdateUid(rs.getLong("tb_update_uid")); | table.setUpdateUid(rs.getLong("tb_update_uid")); | ||||
table.setCreateAt(rs.getLong("tb_create_at")); | table.setCreateAt(rs.getLong("tb_create_at")); | ||||
table.setUpdateAt(rs.getLong("tb_update_at")); | table.setUpdateAt(rs.getLong("tb_update_at")); | ||||
table.setTableContent(rs.getString("tb_content")); | |||||
table.setContent(rs.getString("tb_content")); | |||||
} | } | ||||
return list; | return list; | ||||
} | } | ||||
@@ -15,6 +15,8 @@ public class DefaultEntity extends BaseBean implements Serializable, Cloneable { | |||||
//表名 | //表名 | ||||
private String tableName; | private String tableName; | ||||
public DefaultEntity() {} | |||||
public DefaultEntity(String tableName) { | public DefaultEntity(String tableName) { | ||||
this.tableName = tableName; | this.tableName = tableName; | ||||
} | } | ||||
@@ -1,6 +1,7 @@ | |||||
package cc.smtweb.framework.core.db.vo; | package cc.smtweb.framework.core.db.vo; | ||||
import cc.smtweb.framework.core.annotation.SwTable; | import cc.smtweb.framework.core.annotation.SwTable; | ||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
@@ -8,24 +9,90 @@ import java.util.Map; | |||||
@Data | @Data | ||||
@SwTable(value = "ASP_MODEL_DATABASE") | @SwTable(value = "ASP_MODEL_DATABASE") | ||||
public class ModelDatabase implements Serializable { | |||||
private long id; | |||||
//项目id | |||||
private long prjId; | |||||
// 库名 | |||||
private String name; | |||||
//中文标题 | |||||
private String title; | |||||
//状态:0-启用 1-停用 | |||||
private int status; | |||||
//版本 | |||||
private int version; | |||||
//创建者 | |||||
private Long createUid; | |||||
//创建时间 | |||||
private Long createTime; | |||||
//最后更新人 | |||||
private Long updateUid; | |||||
//更新时间 | |||||
private Long updateTime; | |||||
public class ModelDatabase extends DefaultEntity { | |||||
public final static String ENTITY_NAME = "ASP_MODEL_DATABASE"; | |||||
public ModelDatabase() { | |||||
super(); | |||||
} | |||||
public long getId() { | |||||
return getLong("db_id"); | |||||
} | |||||
public void setId(long dbId) { | |||||
put("db_id", dbId); | |||||
} | |||||
public long getPrjId() { | |||||
return getLong("db_prj_id"); | |||||
} | |||||
public void setPrjId(long dbPrjId) { | |||||
put("db_prj_id", dbPrjId); | |||||
} | |||||
public String getName() { | |||||
return getStr("db_name"); | |||||
} | |||||
public void setName(String dbName) { | |||||
put("db_name", dbName); | |||||
} | |||||
public String getTitle() { | |||||
return getStr("db_title"); | |||||
} | |||||
public void setTitle(String dbTitle) { | |||||
put("db_title", dbTitle); | |||||
} | |||||
public int getStatus() { | |||||
return getInt("db_status"); | |||||
} | |||||
public void setStatus(int dbStatus) { | |||||
put("db_status", dbStatus); | |||||
} | |||||
public int getVersion() { | |||||
return getInt("db_version"); | |||||
} | |||||
public void setVersion(int dbVersion) { | |||||
put("db_version", dbVersion); | |||||
} | |||||
public long getCreateUid() { | |||||
return getLong("db_create_uid"); | |||||
} | |||||
public void setCreateUid(long dbCreateUid) { | |||||
put("db_create_uid", dbCreateUid); | |||||
} | |||||
public long getUpdateUid() { | |||||
return getLong("db_update_uid"); | |||||
} | |||||
public void setUpdateUid(long dbUpdateUid) { | |||||
put("db_update_uid", dbUpdateUid); | |||||
} | |||||
public long getCreateAt() { | |||||
return getLong("db_create_at"); | |||||
} | |||||
public void setCreateAt(long dbCreateAt) { | |||||
put("db_create_at", dbCreateAt); | |||||
} | |||||
public long getUpdateAt() { | |||||
return getLong("db_update_at"); | |||||
} | |||||
public void setUpdateAt(long dbUpdateAt) { | |||||
put("db_update_at", dbUpdateAt); | |||||
} | |||||
} | } |
@@ -2,6 +2,7 @@ package cc.smtweb.framework.core.db.vo; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | import cc.smtweb.framework.core.annotation.SwTable; | ||||
import cc.smtweb.framework.core.db.cache.ModelTableCache; | import cc.smtweb.framework.core.db.cache.ModelTableCache; | ||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
import cc.smtweb.framework.core.db.vo.def.FieldType; | import cc.smtweb.framework.core.db.vo.def.FieldType; | ||||
import cc.smtweb.framework.core.util.JsonUtil; | import cc.smtweb.framework.core.util.JsonUtil; | ||||
import lombok.Data; | import lombok.Data; | ||||
@@ -11,10 +12,10 @@ import java.io.Serializable; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
@Data | |||||
@SwTable(value="ASP_MODEL_TABLE") | |||||
public class ModelTable implements Serializable { | |||||
private long id; | |||||
@SwTable(value = "ASP_MODEL_TABLE") | |||||
public class ModelTable extends DefaultEntity { | |||||
public final static String ENTITY_NAME = "ASP_MODEL_TABLE"; | |||||
/*private long id; | |||||
//所属数据库id及名称 | //所属数据库id及名称 | ||||
private long databaseId; | private long databaseId; | ||||
//项目id | //项目id | ||||
@@ -42,7 +43,7 @@ public class ModelTable implements Serializable { | |||||
//最后更新人 | //最后更新人 | ||||
private Long updateUid; | private Long updateUid; | ||||
//更新时间 | //更新时间 | ||||
private Long updateAt; | |||||
private Long updateAt;*/ | |||||
/*冗余*/ | /*冗余*/ | ||||
private String idField; | private String idField; | ||||
@@ -52,6 +53,146 @@ public class ModelTable implements Serializable { | |||||
private List<ModelIndex> indexes = new ArrayList<>(); | private List<ModelIndex> indexes = new ArrayList<>(); | ||||
private List<ModelCache> caches = new ArrayList<>(); | private List<ModelCache> caches = new ArrayList<>(); | ||||
public ModelTable() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
public long getId() { | |||||
return getLong("tb_id"); | |||||
} | |||||
public void setId(long tbId) { | |||||
put("tb_id", tbId); | |||||
} | |||||
public long getPrjId() { | |||||
return getLong("tb_prj_id"); | |||||
} | |||||
public void setPrjId(long tbPrjId) { | |||||
put("tb_prj_id", tbPrjId); | |||||
} | |||||
public long getMcId() { | |||||
return getLong("tb_mc_id"); | |||||
} | |||||
public void setMcId(long tbMcId) { | |||||
put("tb_mc_id", tbMcId); | |||||
} | |||||
public long getDbId() { | |||||
return getLong("tb_db_id"); | |||||
} | |||||
public void setDbId(long tbDbId) { | |||||
put("tb_db_id", tbDbId); | |||||
} | |||||
public String getExtends() { | |||||
return getStr("tb_extends"); | |||||
} | |||||
public void setExtends(String tbExtends) { | |||||
put("tb_extends", tbExtends); | |||||
} | |||||
public String getName() { | |||||
return getStr("tb_name"); | |||||
} | |||||
public void setName(String tbName) { | |||||
put("tb_name", tbName); | |||||
} | |||||
public String getTitle() { | |||||
return getStr("tb_title"); | |||||
} | |||||
public void setTitle(String tbTitle) { | |||||
put("tb_title", tbTitle); | |||||
} | |||||
public String getAbbr() { | |||||
return getStr("tb_abbr"); | |||||
} | |||||
public void setAbbr(String tbAbbr) { | |||||
put("tb_abbr", tbAbbr); | |||||
} | |||||
public int getType() { | |||||
return getInt("tb_type"); | |||||
} | |||||
public void setType(int tbType) { | |||||
put("tb_type", tbType); | |||||
} | |||||
public boolean isNeedCache() { | |||||
return getBool("tb_need_cache"); | |||||
} | |||||
public void setNeedCache(boolean tbNeedCache) { | |||||
setBool("tb_need_cache", tbNeedCache); | |||||
} | |||||
public String getContent() { | |||||
return getStr("tb_content"); | |||||
} | |||||
public long getCreateUid() { | |||||
return getLong("tb_create_uid"); | |||||
} | |||||
public void setCreateUid(long tbCreateUid) { | |||||
put("tb_create_uid", tbCreateUid); | |||||
} | |||||
public long getUpdateUid() { | |||||
return getLong("tb_update_uid"); | |||||
} | |||||
public void setUpdateUid(long tbUpdateUid) { | |||||
put("tb_update_uid", tbUpdateUid); | |||||
} | |||||
public long getCreateAt() { | |||||
return getLong("tb_create_at"); | |||||
} | |||||
public void setCreateAt(long tbCreateAt) { | |||||
put("tb_create_at", tbCreateAt); | |||||
} | |||||
public long getUpdateAt() { | |||||
return getLong("tb_update_at"); | |||||
} | |||||
public void setUpdateAt(long tbUpdateAt) { | |||||
put("tb_update_at", tbUpdateAt); | |||||
} | |||||
public String getIdField() { | |||||
return idField; | |||||
} | |||||
public String getDbName() { | |||||
return dbName; | |||||
} | |||||
public List<ModelField> getFields() { | |||||
return fields; | |||||
} | |||||
public List<ModelIndex> getIndexes() { | |||||
return indexes; | |||||
} | |||||
public List<ModelCache> getCaches() { | |||||
return caches; | |||||
} | |||||
public ModelField findField(String fieldName) { | public ModelField findField(String fieldName) { | ||||
if (fieldName != null && fields != null) { | if (fieldName != null && fields != null) { | ||||
for (ModelField modelField : fields) { | for (ModelField modelField : fields) { | ||||
@@ -70,7 +211,7 @@ public class ModelTable implements Serializable { | |||||
} | } | ||||
public String fullName() { | public String fullName() { | ||||
return dbName + '.' + name; | |||||
return dbName + '.' + getName(); | |||||
} | } | ||||
public void addIndex(ModelIndex modelIndex) { | public void addIndex(ModelIndex modelIndex) { | ||||
@@ -132,7 +273,7 @@ public class ModelTable implements Serializable { | |||||
public List<ModelLinkName> findLinkeNames() { | public List<ModelLinkName> findLinkeNames() { | ||||
List<ModelLinkName> list = new ArrayList<>(); | List<ModelLinkName> list = new ArrayList<>(); | ||||
for (ModelField field: fields) { | |||||
for (ModelField field : fields) { | |||||
if (StringUtils.isEmpty(field.getLink())) { | if (StringUtils.isEmpty(field.getLink())) { | ||||
continue; | continue; | ||||
} | } | ||||
@@ -148,8 +289,8 @@ public class ModelTable implements Serializable { | |||||
return list; | return list; | ||||
} | } | ||||
public void setTableContent(String tableContent) { | |||||
this.tableContent = tableContent; | |||||
public void setContent(String tableContent) { | |||||
put("tb_content", tableContent); | |||||
//读取表定义信息 | //读取表定义信息 | ||||
ModelTable bean = JsonUtil.parse(tableContent, ModelTable.class); | ModelTable bean = JsonUtil.parse(tableContent, ModelTable.class); | ||||
if (bean == null) { | if (bean == null) { | ||||
@@ -40,6 +40,7 @@ public abstract class AbstractCompService { | |||||
IHandler handler = getHandler(params, us, type); | IHandler handler = getHandler(params, us, type); | ||||
return handler.doWork(); | return handler.doWork(); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
return R.error("操作失败!", e); | return R.error("操作失败!", e); | ||||
} | } | ||||
} | } | ||||
@@ -1,12 +1,6 @@ | |||||
package cc.smtweb.framework.test; | package cc.smtweb.framework.test; | ||||
import cc.smtweb.framework.core.db.vo.ModelTable; | import cc.smtweb.framework.core.db.vo.ModelTable; | ||||
import cc.smtweb.framework.core.util.DateUtil; | |||||
import com.github.benmanes.caffeine.cache.*; | |||||
import org.checkerframework.checker.nullness.qual.NonNull; | |||||
import org.checkerframework.checker.nullness.qual.Nullable; | |||||
import java.util.concurrent.TimeUnit; | |||||
/** | /** | ||||
* Created by Akmm at 2021/12/25 22:21 | * Created by Akmm at 2021/12/25 22:21 | ||||
@@ -16,6 +10,6 @@ public class TestMain { | |||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
ModelTable table = new ModelTable(); | ModelTable table = new ModelTable(); | ||||
table.setId(1); | table.setId(1); | ||||
table.setTableContent("{\"fields\":[{\"name\":\"db_id\",\"fieldType\":\"ID\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"ID\"},{\"name\":\"db_prj_id\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"ID\",\"link\":\"asp_model_project\"},{\"name\":\"db_name\",\"fieldType\":\"CODE\",\"dataType\":\"CODE\",\"null\":\"0\",\"default\":\"\",\"title\":\"库名\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_title\",\"fieldType\":\"NAME\",\"dataType\":\"NAME\",\"null\":\"0\",\"default\":\"\",\"title\":\"中文名\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_status\",\"fieldType\":\"\",\"dataType\":\"BOOL\",\"null\":\"1\",\"default\":\"0\",\"title\":\"启用状态\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_version\",\"fieldType\":\"\",\"dataType\":\"INT-4\",\"null\":\"1\",\"default\":\"0\",\"title\":\"版本\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_create_uid\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"创建人\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_update_uid\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"最后更新人\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_create_at\",\"fieldType\":\"\",\"dataType\":\"DATETIME\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"创建时间\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_update_at\",\"fieldType\":\"\",\"dataType\":\"DATETIME\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"最后更新时间\",\"link\":\"\",\"editor\":\"\"}],\"indexes\":[{\"name\":\"pk\",\"fields\":\"db_id\",\"type\":\"P\"}],\"caches\":[{\"name\":\"n\",\"title\":\"按库名\",\"fields\":\"db_name\",\"type\":\"M\"},{\"name\":\"prj\",\"title\":\"按项目\",\"fields\":\"db_prj_id\",\"type\":\"L\"}]}"); | |||||
table.setContent("{\"fields\":[{\"name\":\"db_id\",\"fieldType\":\"ID\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"ID\"},{\"name\":\"db_prj_id\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"ID\",\"link\":\"asp_model_project\"},{\"name\":\"db_name\",\"fieldType\":\"CODE\",\"dataType\":\"CODE\",\"null\":\"0\",\"default\":\"\",\"title\":\"库名\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_title\",\"fieldType\":\"NAME\",\"dataType\":\"NAME\",\"null\":\"0\",\"default\":\"\",\"title\":\"中文名\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_status\",\"fieldType\":\"\",\"dataType\":\"BOOL\",\"null\":\"1\",\"default\":\"0\",\"title\":\"启用状态\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_version\",\"fieldType\":\"\",\"dataType\":\"INT-4\",\"null\":\"1\",\"default\":\"0\",\"title\":\"版本\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_create_uid\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"创建人\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_update_uid\",\"fieldType\":\"\",\"dataType\":\"ID\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"最后更新人\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_create_at\",\"fieldType\":\"\",\"dataType\":\"DATETIME\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"创建时间\",\"link\":\"\",\"editor\":\"\"},{\"name\":\"db_update_at\",\"fieldType\":\"\",\"dataType\":\"DATETIME\",\"null\":\"1\",\"default\":\"-1\",\"title\":\"最后更新时间\",\"link\":\"\",\"editor\":\"\"}],\"indexes\":[{\"name\":\"pk\",\"fields\":\"db_id\",\"type\":\"P\"}],\"caches\":[{\"name\":\"n\",\"title\":\"按库名\",\"fields\":\"db_name\",\"type\":\"M\"},{\"name\":\"prj\",\"title\":\"按项目\",\"fields\":\"db_prj_id\",\"type\":\"L\"}]}"); | |||||
} | } | ||||
} | } |
@@ -65,7 +65,7 @@ public class AspDbCardService { | |||||
return R.error("库标题不能为空"); | return R.error("库标题不能为空"); | ||||
} | } | ||||
modelPo.setUpdateTime(DateUtil.nowDateTimeLong()); | |||||
modelPo.setUpdateAt(DateUtil.nowDateTimeLong()); | |||||
// 保存数据到部署表和部署历史表 | // 保存数据到部署表和部署历史表 | ||||
if (isNullId(modelPo.getId())) { | if (isNullId(modelPo.getId())) { | ||||
@@ -78,8 +78,8 @@ public class AspDbCardService { | |||||
.add("db_title", modelPo.getTitle()) | .add("db_title", modelPo.getTitle()) | ||||
.add("db_status", modelPo.getStatus()) | .add("db_status", modelPo.getStatus()) | ||||
.add("db_version", modelPo.getVersion()) | .add("db_version", modelPo.getVersion()) | ||||
.add("db_create_at", modelPo.getCreateTime()) | |||||
.add("db_update_at", modelPo.getUpdateTime()) | |||||
.add("db_create_at", modelPo.getCreateAt()) | |||||
.add("db_update_at", modelPo.getUpdateAt()) | |||||
.add("db_create_uid", us.getUserId()) | .add("db_create_uid", us.getUserId()) | ||||
.add("db_update_uid", us.getUserId()); | .add("db_update_uid", us.getUserId()); | ||||
sqlBuilder.update(dbEngine); | sqlBuilder.update(dbEngine); | ||||
@@ -102,7 +102,7 @@ public class AspDbCardService { | |||||
.add("db_title", modelPo.getTitle()) | .add("db_title", modelPo.getTitle()) | ||||
.add("db_status", modelPo.getStatus()) | .add("db_status", modelPo.getStatus()) | ||||
.add("db_version", modelPo.getVersion()) | .add("db_version", modelPo.getVersion()) | ||||
.add("db_update_at", modelPo.getUpdateTime()) | |||||
.add("db_update_at", modelPo.getUpdateAt()) | |||||
.add("db_update_uid", us.getUserId()); | .add("db_update_uid", us.getUserId()); | ||||
int ret = sqlBuilder.update(dbEngine); | int ret = sqlBuilder.update(dbEngine); | ||||
@@ -0,0 +1,30 @@ | |||||
package cc.smtweb.system.bpm.web.design.table; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.db.vo.ModelTable; | |||||
import cc.smtweb.framework.core.mvc.service.*; | |||||
import cc.smtweb.system.bpm.web.design.catalog.ModelCatalog; | |||||
/** | |||||
* Created by Akmm at 2022/3/22 9:12 | |||||
*/ | |||||
@SwService | |||||
public class ModelDatabaseService extends AbstractCompService { | |||||
@Override | |||||
protected IHandler createHanlder(String type) { | |||||
switch (type) { | |||||
case TYPE_LOAD: | |||||
return new DefaultLoadHandler<ModelCatalog>(ModelTable.ENTITY_NAME); | |||||
case TYPE_SAVE: | |||||
return new DefaultSaveHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_DEL: | |||||
return new DefaultDelHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_LIST: | |||||
return new DefaultListHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_COMBO: | |||||
return new DefaultListHandler<>(ModelTable.ENTITY_NAME); | |||||
} | |||||
return null; | |||||
} | |||||
} |
@@ -0,0 +1,31 @@ | |||||
package cc.smtweb.system.bpm.web.design.table; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.db.vo.ModelTable; | |||||
import cc.smtweb.framework.core.mvc.service.*; | |||||
import cc.smtweb.system.bpm.web.design.catalog.ModelCatalog; | |||||
import cc.smtweb.system.bpm.web.design.catalog.ModelCatalogTreeHandler; | |||||
/** | |||||
* Created by Akmm at 2022/3/22 9:12 | |||||
*/ | |||||
@SwService | |||||
public class ModelTableService extends AbstractCompService { | |||||
@Override | |||||
protected IHandler createHanlder(String type) { | |||||
switch (type) { | |||||
case TYPE_LOAD: | |||||
return new DefaultLoadHandler<ModelCatalog>(ModelTable.ENTITY_NAME); | |||||
case TYPE_SAVE: | |||||
return new DefaultSaveHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_DEL: | |||||
return new DefaultDelHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_LIST: | |||||
return new DefaultListHandler<>(ModelTable.ENTITY_NAME); | |||||
case TYPE_COMBO: | |||||
return new DefaultListHandler<>(ModelTable.ENTITY_NAME); | |||||
} | |||||
return null; | |||||
} | |||||
} |
@@ -11,21 +11,16 @@ import org.junit.Test; | |||||
public class BuildJavaBean { | public class BuildJavaBean { | ||||
@Test | @Test | ||||
public void buildBean() { | public void buildBean() { | ||||
String str = "`tb_id` bigint(20) NOT NULL,\n" + | |||||
" `tb_prj_id` bigint(20) DEFAULT NULL,\n" + | |||||
" `tb_mc_id` bigint(20) NOT NULL,\n" + | |||||
" `tb_db_id` bigint(20) NOT NULL COMMENT '数据库id',\n" + | |||||
" `tb_extends` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '继承关系',\n" + | |||||
" `tb_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称',\n" + | |||||
" `tb_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL COMMENT '表中文名称',\n" + | |||||
" `tb_abbr` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '缩写,用于字段和索引组成',\n" + | |||||
" `tb_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '类别:0-普通表,1 树型表 2 编码表 9-虚拟抽象表 11 视图',\n" + | |||||
" `tb_need_cache` tinyint(4) NOT NULL DEFAULT '0' COMMENT '需要缓存',\n" + | |||||
" `tb_content` text COLLATE utf8_unicode_ci COMMENT '表详细信息',\n" + | |||||
" `tb_create_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `tb_update_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `tb_create_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',\n" + | |||||
" `tb_update_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',\n"; | |||||
String str = "`db_id` bigint(20) NOT NULL,\n" + | |||||
" `db_prj_id` bigint(20) DEFAULT NULL,\n" + | |||||
" `db_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '添加上所有父节节点key,就构成模型唯一key',\n" + | |||||
" `db_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL COMMENT '名称',\n" + | |||||
" `db_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态:0 启用,1 禁用',\n" + | |||||
" `db_version` int(11) NOT NULL DEFAULT '0' COMMENT '版本',\n" + | |||||
" `db_create_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `db_update_uid` bigint(20) DEFAULT NULL,\n" + | |||||
" `db_create_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',\n" + | |||||
" `db_update_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',\n"; | |||||
String[] ss = str.split("\n"); | String[] ss = str.split("\n"); | ||||
for (String s: ss) { | for (String s: ss) { | ||||
String[] s0 = s.trim().split(" "); | String[] s0 = s.trim().split(" "); | ||||