Kaynağa Gözat

初始

master
郑根木 2 yıl önce
ebeveyn
işleme
e2897d313a
16 değiştirilmiş dosya ile 372 ekleme ve 98 silme
  1. +15
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java
  2. +24
    -8
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java
  3. +1
    -9
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java
  4. +19
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractHandler.java
  5. +1
    -9
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java
  6. +1
    -9
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java
  7. +1
    -8
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java
  8. +82
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java
  9. +2
    -1
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java
  10. +21
    -3
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java
  11. +7
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/CommUtil.java
  12. +18
    -18
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalog.java
  13. +2
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogService.java
  14. +142
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogTreeHandler.java
  15. +18
    -18
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/project/ModelProject.java
  16. +18
    -12
      smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/BuildJavaBean.java

+ 15
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/cache/ModelTableCache.java Dosyayı Görüntüle

@@ -11,6 +11,7 @@ import org.springframework.jdbc.core.ResultSetExtractor;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Set;

@@ -21,7 +22,7 @@ import java.util.Set;
public class ModelTableCache extends AbstractCache<ModelTable> {
private final static String mk = "k";
private final static String md = "d";
private final static String mf = "l";
private final static String mc = "c";

public static ModelTableCache getInstance() {
return CacheManager.getIntance().getCache(ModelTableCache.class);
@@ -30,6 +31,7 @@ public class ModelTableCache extends AbstractCache<ModelTable> {
public ModelTableCache() {
regMap(mk, k-> k.getName().toUpperCase());
regList(md, k-> String.valueOf(k.getDatabaseId()));
regList(mc, k-> String.valueOf(k.getCatalogId()));
// regList(mf, k-> k.get);
}

@@ -90,4 +92,16 @@ public class ModelTableCache extends AbstractCache<ModelTable> {
public final Set<ModelTable> getDbTables(long dbId) {
return getListByKey(md, String.valueOf(dbId));
}

public final Set<ModelTable> getTablesByMc(long mcId) {
return getListByKey(mc, String.valueOf(mcId));
}

public final List<ModelTable> getTablesByMc(long mcId, Comparator<ModelTable> comparator) {
Set<ModelTable> set = getListByKey(mc, String.valueOf(mcId));
if (set == null || set.isEmpty()) return null;
List<ModelTable> list = new ArrayList<>(set);
list.sort(comparator);
return list;
}
}

+ 24
- 8
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractCompService.java Dosyayı Görüntüle

@@ -28,11 +28,11 @@ public abstract class AbstractCompService {

private IHandler getHandler(SwMap params, UserSession us, String type) throws Exception {
IHandler handler = createHanlder(type);
if (handler == null) throw new SwException("暂不支持此类服务:" + type);
if (params == null) params = new SwMap();
if (us == null) us = UserSession.createSys();
handler.init(params, us);
return handler;
if (handler == null) throw new SwException("暂不支持此类服务:" + type);
if (params == null) params = new SwMap();
if (us == null) us = UserSession.createSys();
handler.init(params, us);
return handler;
}

private R pageHandler(SwMap params, UserSession us, String type) {
@@ -52,7 +52,7 @@ public abstract class AbstractCompService {
//树,换爹
public R trcp(@SwBody SwMap params, UserSession us) {
try {
DefaultSaveHandler handler = (DefaultSaveHandler)getHandler(params, us,TYPE_SAVE);
DefaultSaveHandler handler = (DefaultSaveHandler) getHandler(params, us, TYPE_SAVE);
return handler.changeParent();
} catch (Exception e) {
return R.error("操作失败!", e);
@@ -63,38 +63,54 @@ public abstract class AbstractCompService {
public R load(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LOAD);
}

//删除
public R del(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_DEL);
}

//列表数据
public R list(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LIST);
}

//列表总记录数及合计栏
public R listTotal(@SwBody SwMap params, UserSession us) {
try {
AbstractListHandler handler = (AbstractListHandler)getHandler(params, us, TYPE_LIST);
AbstractListHandler handler = (AbstractListHandler) getHandler(params, us, TYPE_LIST);
return handler.getTotal();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}

//combo数据
public R combo(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_COMBO);
}

//combo总记录数及合计栏
public R comboTotal(@SwBody SwMap params, UserSession us) {
try {
AbstractListHandler handler = (AbstractListHandler)getHandler(params, us, TYPE_COMBO);
AbstractListHandler handler = (AbstractListHandler) getHandler(params, us, TYPE_COMBO);
return handler.getTotal();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}

//树数据
public R tree(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_TREE);
}

//树过滤
public R treeFilter(@SwBody SwMap params, UserSession us) {
try {
AbstractTreeHandler handler = (AbstractTreeHandler) getHandler(params, us, TYPE_TREE);
return handler.filter();
} catch (Exception e) {
return R.error("操作失败!", e);
}
}
}

+ 1
- 9
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java Dosyayı Görüntüle

@@ -11,18 +11,10 @@ import lombok.extern.slf4j.Slf4j;
* 保存
*/
@Slf4j
public abstract class AbstractDelHandler<T> implements IHandler{
protected SwMap params;
protected UserSession us;
public abstract class AbstractDelHandler<T> extends AbstractHandler<T>{
protected long id;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;
}

@Override
public R doWork() throws Exception {
id = readId();



+ 19
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractHandler.java Dosyayı Görüntüle

@@ -0,0 +1,19 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.session.UserSession;

/**
* Created by Akmm at 2022/3/2 19:44
*/
public abstract class AbstractHandler<T> implements IHandler {
protected SwMap params;
protected UserSession us;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;
}
}

+ 1
- 9
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java Dosyayı Görüntüle

@@ -23,22 +23,14 @@ import java.util.Map;
* 列表服务
*/
@Slf4j
public abstract class AbstractListHandler implements IHandler {
public abstract class AbstractListHandler extends AbstractHandler {
protected static String KEY_SQLPARA = "query-sqlPara";
protected static String KEY_SQLPARA_SUM = "query-sqlPara-sum";
protected static String KEY_PARAMS = "query-params";

protected SwMap params;
protected UserSession us;
private SessionCache sessionCache;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;
}

@Override
public R doWork() throws Exception {
return R.success(listData());
}


+ 1
- 9
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractLoadHandler.java Dosyayı Görüntüle

@@ -7,15 +7,7 @@ import cc.smtweb.framework.core.session.UserSession;
/**
* Created by Akmm at 2022/3/2 19:44
*/
public abstract class AbstractLoadHandler<T> implements IHandler {
protected SwMap params;
protected UserSession us;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;
}
public abstract class AbstractLoadHandler<T> extends AbstractHandler {

@Override
public R doWork() throws Exception {


+ 1
- 8
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java Dosyayı Görüntüle

@@ -13,17 +13,10 @@ import lombok.extern.slf4j.Slf4j;
* 保存
*/
@Slf4j
public abstract class AbstractSaveHandler<T> implements IHandler {
protected SwMap params;
protected UserSession us;
public abstract class AbstractSaveHandler<T> extends AbstractHandler {
protected T bean;
protected boolean isNew;

@Override
public void init(SwMap params, UserSession us) {
this.params = params;
this.us = us;
}

@Override
public R doWork() throws Exception {


+ 82
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java Dosyayı Görüntüle

@@ -0,0 +1,82 @@
package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.cache.SessionCache;
import cc.smtweb.framework.core.cache.SessionCacheFactory;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.mvc.service.list.FooterField;
import cc.smtweb.framework.core.session.UserSession;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Created by Akmm at 2022/3/2 19:44
* 列表服务
*/
@Slf4j
public abstract class AbstractTreeHandler<T> extends AbstractHandler {

@Override
public R doWork() throws Exception {
return R.success(data());
}

//树过滤
public R filter() throws Exception {
List<T> rows = filterData();
List<SwMap> listRet = buildNodes(rows, true);
return R.success(listRet);
}

protected List<SwMap> data() throws Exception {
List<T> rows = getChildren(params.readLong("parent_id"));
List<SwMap> listRet = buildNodes(rows, params.readBool("lazy"));

return listRet;
}

//搜索
protected abstract List<T> filterData();
//获取指定节点的下级节点
protected abstract List<T> getChildren(long id);
protected List<T> getChildren(T bean) {
return getChildren(getId(bean));
}

//根据bean,构建treenode
private List<SwMap> buildNodes(List<T> rows, boolean lazy) {
List<SwMap> listRet = new ArrayList<>();
if (rows == null || rows.isEmpty()) {
return listRet;
}
for (T row : rows) {
SwMap node = new SwMap();
node.put("id", getId(row));
node.put("text", getText(row));
List<T> children = getChildren(row);
node.put("leaf", children == null || children.isEmpty());
node.put("bean", row);
buildNode(node, row);
listRet.add(node);
if (!lazy) {
List<SwMap> list = buildNodes(children, lazy);
node.put("children", list);
}
}
return listRet;
}

//根据bean,构建treenode
protected void buildNode(SwMap node, T bean) {}

protected abstract long getId(T bean);

protected abstract String getText(T bean);
}

+ 2
- 1
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java Dosyayı Görüntüle

@@ -75,7 +75,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
} else {
dao.updateEntity(bean);

listTreeBean = new TreeHelper<T>(tableName).resetTreeLevel(bean);
listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);
}
}

@@ -129,6 +129,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractSaveHan
@Override
public void work() throws Exception {
EntityDao dao = DbEngine.getInstance().findDao(tableName);
listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);
dao.updateEntity(bean, fieldParentCode.getName());
}



+ 21
- 3
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/mvc/service/TreeHelper.java Dosyayı Görüntüle

@@ -14,13 +14,13 @@ import cc.smtweb.framework.core.db.vo.def.TableType;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;

/**
* Created by Akmm at 2022/3/17 19:56
*/
public class TreeHelper<T extends DefaultEntity> {

private String tableName;

private ModelTable table;
@@ -30,7 +30,13 @@ public class TreeHelper<T extends DefaultEntity> {
private String fieldParent;
private String fieldLevelCode;

public TreeHelper(String tableName) {
//todo 待扩展,进缓存
public static TreeHelper getTreeHelper(String tableName) {
return new TreeHelper(tableName);
}

//先禁止外部创建
private TreeHelper(String tableName) {
this.tableName = tableName;
table = ModelTableCache.getInstance().getByName(tableName);
cache = CacheManager.getIntance().getCache(tableName);
@@ -51,7 +57,19 @@ public class TreeHelper<T extends DefaultEntity> {
}

public Collection<T> getChildren(T bean) {
return cache.getListByKey(AbstractCache.KEY_PARENT_ID, String.valueOf(bean.getEntityId()));
return getChildren(bean.getEntityId());
}

public Collection<T> getChildren(long id) {
return cache.getListByKey(AbstractCache.KEY_PARENT_ID, String.valueOf(id));
}

public List<T> getChildren(long id, Comparator<T> comparator) {
Collection<T> set = cache.getListByKey(AbstractCache.KEY_PARENT_ID, String.valueOf(id));
List<T> list = new ArrayList<>(set);
if (comparator != null)
list.sort(comparator);
return list;
}

public List<T> resetTreeLevel(T bean) throws Exception {


+ 7
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/util/CommUtil.java Dosyayı Görüntüle

@@ -9,8 +9,10 @@ import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.text.Collator;
import java.util.Collection;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

/**
@@ -19,6 +21,7 @@ import java.util.Set;
*/
@Slf4j
public class CommUtil {
private static Collator chineseCollator = Collator.getInstance(Locale.CHINA);

/**
* 找指定类的泛型类
@@ -98,4 +101,8 @@ public class CommUtil {
if (s.length() == 0) return "";
return s.substring(0, s.length() - 1);
}

public static int chineseCompare(String s1, String s2) {
return chineseCollator.compare(s1, s2);
}
}

+ 18
- 18
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalog.java Dosyayı Görüntüle

@@ -14,75 +14,75 @@ public class ModelCatalog extends DefaultEntity {
super(ENTITY_NAME);
}

private long getMcId() {
public long getId() {
return getLong("mc_id");
}

private void setMcId(long mcId) {
public void setId(long mcId) {
put("mc_id", mcId);
}

private long getMcParentId() {
public long getParentId() {
return getLong("mc_parent_id");
}

private void setMcParentId(long mcParentId) {
public void setParentId(long mcParentId) {
put("mc_parent_id", mcParentId);
}

private String getMcCode() {
public String getCode() {
return getStr("mc_code");
}

private void setMcCode(String mcCode) {
public void setCode(String mcCode) {
put("mc_code", mcCode);
}

private String getMcName() {
public String getName() {
return getStr("mc_name");
}

private void setMcName(String mcName) {
public void setName(String mcName) {
put("mc_name", mcName);
}

private long getMcPrjId() {
public long getPrjId() {
return getLong("mc_prj_id");
}

private void setMcPrjId(long mcPrjId) {
public void setPrjId(long mcPrjId) {
put("mc_prj_id", mcPrjId);
}

private long getMcCreateUid() {
public long getCreateUid() {
return getLong("mc_create_uid");
}

private void setMcCreateUid(long mcCreateUid) {
public void setCreateUid(long mcCreateUid) {
put("mc_create_uid", mcCreateUid);
}

private long getMcUpdateUid() {
public long getUpdateUid() {
return getLong("mc_update_uid");
}

private void setMcUpdateUid(long mcUpdateUid) {
public void setUpdateUid(long mcUpdateUid) {
put("mc_update_uid", mcUpdateUid);
}

private long getMcCreateAt() {
public long getCreateAt() {
return getLong("mc_create_at");
}

private void setMcCreateAt(long mcCreateAt) {
public void setCreateAt(long mcCreateAt) {
put("mc_create_at", mcCreateAt);
}

private long getMcUpdateAt() {
public long getUpdateAt() {
return getLong("mc_update_at");
}

private void setMcUpdateAt(long mcUpdateAt) {
public void setUpdateAt(long mcUpdateAt) {
put("mc_update_at", mcUpdateAt);
}
}

+ 2
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogService.java Dosyayı Görüntüle

@@ -24,8 +24,8 @@ public class ModelCatalogService extends AbstractCompService {
return new DefaultDelHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_LIST:
return new DefaultListHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_COMBO:
return new DefaultListHandler<>(ModelCatalog.ENTITY_NAME);
case TYPE_TREE:
return new ModelCatalogTreeHandler();
}
return null;
}


+ 142
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/catalog/ModelCatalogTreeHandler.java Dosyayı Görüntüle

@@ -0,0 +1,142 @@
package cc.smtweb.system.bpm.web.design.catalog;

import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.mvc.service.AbstractTreeHandler;
import cc.smtweb.framework.core.mvc.service.TreeHelper;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import org.apache.commons.lang3.StringUtils;

import java.util.*;

/**
* Created by Akmm at 2022/3/21 18:22
*/
public class ModelCatalogTreeHandler extends AbstractTreeHandler<Object> {
//查询类型:0-目录;1-表定义;2-页面定义
private final static int TYPE_CATALOG = 0;
private final static int TYPE_TABLE = 1;
private final static int TYPE_PAGE = 2;

private long prj_id;//所属项目
private int type;//查询类型:0-目录;1-表定义;2-页面定义

private TreeHelper<ModelCatalog> mcTreeHelper = null;

@Override
public void init(SwMap params, UserSession us) {
super.init(params, us);
type = params.readInt("type");
prj_id = params.readLong("prj_id");
mcTreeHelper = (TreeHelper<ModelCatalog>) TreeHelper.getTreeHelper(ModelCatalog.ENTITY_NAME);
}

@Override
protected List<Object> getChildren(Object bean) {
if (bean instanceof ModelCatalog) {
return super.getChildren(bean);
}
return null;
}

@Override
protected List<Object> filterData() {
List<Object> listRet = new ArrayList<>();

EntityDao<ModelCatalog> dao = DbEngine.getInstance().findDao(ModelCatalog.ENTITY_NAME);
String text = "%" + params.readString("text") + "%";
List<ModelCatalog> list = dao.queryWhere(" where mc_prj_id=? and (mc_name like ? or mc_code like ?) order by mc_name", prj_id, text, text);
listRet.addAll(list);

switch (type) {
case TYPE_TABLE:
EntityDao<ModelTable> tabledao = DbEngine.getInstance().findDao(ModelTable.class);
List<ModelTable> l = tabledao.queryWhere(" where tb_prj_id=? and (tb_name like ? or tb_title like ?) order by tb_name", prj_id, text, text);
listRet.addAll(l);
break;
case TYPE_PAGE:
;
}
return listRet;
}

@Override
protected List<Object> getChildren(long id) {
List<Object> listRet = new ArrayList<>();
List<ModelCatalog> list;
if (id > 0) {
list = mcTreeHelper.getChildren(id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
} else {
list = mcTreeHelper.getChildren(prj_id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
}

listRet.addAll(list);

switch (type) {
case TYPE_TABLE:
addTableChildren(listRet, id);
break;
case TYPE_PAGE:
addPageChildren(listRet, id);
}
return listRet;
}

//增加表
private void addTableChildren(List<Object> listRet, long id) {
Collection<ModelTable> set = ModelTableCache.getInstance().getTablesByMc(id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
if (set == null || set.isEmpty()) return;

listRet.addAll(set);
}

//增加页面定义
private void addPageChildren(List<Object> listRet, long id) {

}

@Override
protected long getId(Object bean) {
if (bean instanceof DefaultEntity) {
return ((DefaultEntity) bean).getEntityId();
}
if (bean instanceof ModelTable) {
return ((ModelTable) bean).getId();
}
return 0;
}

@Override
protected String getText(Object bean) {
if (bean instanceof ModelCatalog) {
return ((ModelCatalog) bean).getName();
}
if (bean instanceof ModelTable) {
return ((ModelTable) bean).getTitle();
}

/*if (bean instanceof ModelTable) {
return ((ModelTable)bean).getTitle();
}*/
return null;
}

@Override
protected void buildNode(SwMap node, Object bean) {
super.buildNode(node, bean);
if (bean instanceof ModelCatalog) {
node.put("type", TYPE_CATALOG);
} else if (bean instanceof ModelTable) {
node.put("type", TYPE_TABLE);
}/* else if (bean instanceof ModelTable) {
node.put("type", TYPE_TABLE);
}*/
}
}

+ 18
- 18
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/project/ModelProject.java Dosyayı Görüntüle

@@ -14,75 +14,75 @@ public class ModelProject extends DefaultEntity {
super(ENTITY_NAME);
}

public long getPrjId() {
public long getId() {
return getLong("prj_id");
}

public void setPrjId(long prjId) {
public void setId(long prjId) {
put("prj_id", prjId);
}

public String getPrjName() {
public String getName() {
return getStr("prj_name");
}

public void setPrjName(String prjName) {
public void setName(String prjName) {
put("prj_name", prjName);
}

public String getPrjDepends() {
public String getDepends() {
return getStr("prj_depends");
}

public void setPrjDepends(String prjDepends) {
public void setDepends(String prjDepends) {
put("prj_depends", prjDepends);
}

public String getPrjDesc() {
public String getDesc() {
return getStr("prj_desc");
}

public void setPrjDesc(String prjDesc) {
public void setDesc(String prjDesc) {
put("prj_desc", prjDesc);
}

public int getPrjStatus() {
public int getStatus() {
return getInt("prj_status");
}

public void setPrjStatus(int prjStatus) {
public void setStatus(int prjStatus) {
put("prj_status", prjStatus);
}

public long getPrjCreateUid() {
public long getCreateUid() {
return getLong("prj_create_uid");
}

public void setPrjCreateUid(long prjCreateUid) {
public void setCreateUid(long prjCreateUid) {
put("prj_create_uid", prjCreateUid);
}

public long getPrjUpdateUid() {
public long getUpdateUid() {
return getLong("prj_update_uid");
}

public void setPrjUpdateUid(long prjUpdateUid) {
public void setUpdateUid(long prjUpdateUid) {
put("prj_update_uid", prjUpdateUid);
}

public long getPrjCreateAt() {
public long getCreateAt() {
return getLong("prj_create_at");
}

public void setPrjCreateAt(long prjCreateAt) {
public void setCreateAt(long prjCreateAt) {
put("prj_create_at", prjCreateAt);
}

public long getPrjUpdateAt() {
public long getUpdateAt() {
return getLong("prj_update_at");
}

public void setPrjUpdateAt(long prjUpdateAt) {
public void setUpdateAt(long prjUpdateAt) {
put("prj_update_at", prjUpdateAt);
}
}

+ 18
- 12
smtweb-system/sw-system-bpm/src/test/java/cc/smtweb/system/bpm/test/BuildJavaBean.java Dosyayı Görüntüle

@@ -11,21 +11,27 @@ import org.junit.Test;
public class BuildJavaBean {
@Test
public void buildBean() {
String str = "`mc_id` bigint(20) NOT NULL,\n" +
" `mc_parent_id` bigint(20) DEFAULT NULL COMMENT '-1',\n" +
" `mc_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,\n" +
" `mc_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT '项目名称',\n" +
" `mc_prj_id` bigint(20) NOT NULL DEFAULT '-1',\n" +
" `mc_create_uid` bigint(20) DEFAULT NULL,\n" +
" `mc_update_uid` bigint(20) DEFAULT NULL,\n" +
" `mc_create_at` bigint(20) NOT NULL DEFAULT '0',\n" +
" `mc_update_at` bigint(20) NOT NULL DEFAULT '0',";
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[] ss = str.split("\n");
for (String s: ss) {
String[] s0 = s.trim().split(" ");
if (StringUtils.isEmpty(s0[0])) continue;
String tn = s0[0].substring(1, s0[0].indexOf("`", 2));
String tnu = CodeGenUtil.underlineToUpperHump(tn);
String tnu = CodeGenUtil.underlineToUpperHump(tn.substring(tn.indexOf("_") + 1));
String tnn = CodeGenUtil.underlineToHump(tn);

String tt = s0[1];
@@ -46,11 +52,11 @@ public class BuildJavaBean {
ttj = "Str";
break;
}
System.out.println("private " + tt + " get" + tnu + "(){\n" +
System.out.println("public " + tt + " get" + tnu + "(){\n" +
"return get" + ttj + "(\"" + tn + "\");\n" +
"}\n" +
"" +
"private void set" + tnu + "(" + tt + " " + tnn + "){\n" +
"public void set" + tnu + "(" + tt + " " + tnn + "){\n" +
"put(\"" + tn + "\", " + tnn + ");\n" +
"}\n");
}


Yükleniyor…
İptal
Kaydet