Ver código fonte

废弃AbsDbWorker

4.0
郑根木 2 anos atrás
pai
commit
0103df9754
19 arquivos alterados com 53 adições e 64 exclusões
  1. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java
  2. +4
    -8
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java
  3. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java
  4. +3
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java
  5. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java
  6. +9
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java
  7. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsDelHandler.java
  8. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsSaveHandler.java
  9. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java
  10. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java
  11. +2
    -11
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java
  12. +2
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java
  13. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java
  14. +4
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/user/UserHandler.java
  15. +2
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java
  16. +3
    -3
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java
  17. +2
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java
  18. +2
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java
  19. +3
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java

+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/ModelProcSaveHandler.java Ver arquivo

@@ -5,7 +5,7 @@ import cc.smtweb.framework.core.common.SwEnum;
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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
@@ -65,7 +65,7 @@ public class ModelProcSaveHandler extends DefaultSaveHandler<ModelProc> {
throw new BizException("没有待保存的数据!");
}
bean.setContent(data);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelProc> dao = DbEngine.getInstance().findDao(tableName);


+ 4
- 8
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java Ver arquivo

@@ -2,23 +2,19 @@ package cc.smtweb.system.bpm.web.design.form;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.DefaultSaveHandler;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.JsonUtil;
import cc.smtweb.system.bpm.web.design.form.model.ModelFactory;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
* Created by Akmm at 2022/5/9 17:05
@@ -81,7 +77,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
throw new BizException("没有待保存的数据!");
}
bean.setDataset(ModelFormHelper.buildSaveDataset(data));
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);
@@ -113,7 +109,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
throw new BizException("没有待保存的数据!");
}
bean.setContent(ModelFormHelper.buildSaveModel(bean, data));
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);
@@ -149,7 +145,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
//先构建一次,防止有错
String ret = ModelFormHelper.buildReqModel(bean);
// ModelFormHelper.buildSaveModelByTmpl(bean, templateId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
EntityDao<ModelForm> dao = DbEngine.getInstance().findDao(tableName);


+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageDelHandler.java Ver arquivo

@@ -9,7 +9,7 @@ import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -39,7 +39,7 @@ public class DynPageDelHandler extends AbstractDynPageHandler {

checkBean(pageDataSet, id);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
@@ -107,7 +107,7 @@ public class DynPageDelHandler extends AbstractDynPageHandler {
info.ids.addAll(list);
}
}
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
for (RemovableInfo info : mapRemovableInfo.values()) {


+ 3
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageSaveHandler.java Ver arquivo

@@ -9,12 +9,11 @@ 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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.DefaultSaveHandler;
import cc.smtweb.framework.core.mvc.service.TreeHelper;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -55,7 +54,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler {
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);
@@ -108,7 +107,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler {
}
checkBean(bean);
}
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
for (DefaultEntity bean : map.values()) {


+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java Ver arquivo

@@ -62,7 +62,7 @@ public class FlowProvider extends AbstractCompProvider {
public List<Task> findBeforeTasks(String taskIds) {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryEx(" t," + EntityHelper.getSchemaTableName(TaskRel.ENTITY_NAME) + " r " +
"where t.task_id=r.trl_src_task_id and r.trl_dst_task_id in (" + taskIds + ")");
"where t.tsk_id=r.trl_src_task_id and r.trl_dst_task_id in (" + taskIds + ")");
if (CommUtil.isEmpty(list)) return new ArrayList<>();
return list;
}


+ 9
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java Ver arquivo

@@ -2,7 +2,9 @@ package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.mvc.service.SwListData;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
@@ -10,11 +12,8 @@ import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
import cc.smtweb.system.bpm.web.engine.flow.FlowHelper;
import cc.smtweb.system.bpm.web.engine.flow.FlowInstance;
import cc.smtweb.system.bpm.web.engine.flow.FlowListener;
import cc.smtweb.system.bpm.web.engine.flow.entity.Task;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;

import java.util.List;

/**
* Created by Akmm at 2022-09-01 15:03
* 流程流转
@@ -54,7 +53,13 @@ public class FlowTransHandler<T extends DefaultEntity> extends AbstractDynPageHa

public R submit() {
load();
flowInstance.submit(params.readString("comment"));
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
flowInstance.submit(params.readString("comment"));
}
});

return R.success(buildRetData());
}



+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsDelHandler.java Ver arquivo

@@ -6,7 +6,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -31,7 +31,7 @@ public abstract class AbsDelHandler extends AbstractDynPageHandler {
//
checkBean(pageDataset, id);
//
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataset.masterTable);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/AbsSaveHandler.java Ver arquivo

@@ -8,7 +8,7 @@ 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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -51,7 +51,7 @@ public abstract class AbsSaveHandler <T extends DefaultEntity> extends AbstractD
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsDelHandler.java Ver arquivo

@@ -9,7 +9,7 @@ import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsDelHandler;
@@ -64,7 +64,7 @@ public class LCMsDelHandler extends AbsDelHandler {
//
List<? extends DefaultEntity> delDetails = subDao.queryWhere(subForeignKey + " = ?", id);
checkDetails(delDetails);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
subDao.batchDelete(delDetails);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java Ver arquivo

@@ -6,7 +6,7 @@ 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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
@@ -71,7 +71,7 @@ public class LCMsSaveHandler extends AbsSaveHandler<DefaultEntity> {
//
checkBean(masterBean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(masterBean);


+ 2
- 11
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java Ver arquivo

@@ -3,24 +3,15 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.single;
import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.design.form.define.PageDatasetFilter;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
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/4/21 17:53
@@ -40,7 +31,7 @@ public class LCSingleDelHandler extends AbstractDynPageHandler {

checkBean(pageDataSet, id);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);


+ 2
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java Ver arquivo

@@ -9,7 +9,7 @@ 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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -52,7 +52,7 @@ public class LCSingleSaveHandler<T extends DefaultEntity> extends AbstractDynPag
}
checkBean(bean);

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
saveBean(bean);


+ 3
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/menuPlan/MenuPlanHandler.java Ver arquivo

@@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.web.sys.user.menuPlan;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.mvc.service.SwListData;
@@ -48,7 +48,7 @@ public class MenuPlanHandler {
menuPlanContent.saveItem(menuPlanItem, parent_id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");
@@ -79,7 +79,7 @@ public class MenuPlanHandler {
menuPlanContent.delItem(id);
menuPlan.setContent(menuPlanContent.toContentStr());

DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().updateEntity(menuPlan, "smp_content");


+ 4
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/user/user/UserHandler.java Ver arquivo

@@ -6,7 +6,7 @@ import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
@@ -178,7 +178,7 @@ public class UserHandler {
public R batchDelParty() {
Set<Long> idList = params.readLongSet("ids");
Set<Long> roleIdList = UserRoleCache.getInstance().getByParty(idList);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
getUserPartyDao().deleteEntity(idList);
@@ -198,7 +198,7 @@ public class UserHandler {
long id = params.readLong("id");
Set<Long> partyIds = UserPartyCache.getInstance().getIdByUser(id);
Set<Long> roleIds = UserRoleCache.getInstance().getByParty(partyIds);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
getUserDao().deleteEntity(id);
@@ -224,7 +224,7 @@ public class UserHandler {
userList.forEach(user -> {
user.setPwd(LoginHelper.encodePwd(user.getId(), SwConsts.DEF_PWD));
});
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
DbEngine.getInstance().findDao(User.ENTITY_NAME).batchUpdateEntity(userList);


+ 2
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/AbsDbWorker.java Ver arquivo

@@ -2,8 +2,9 @@ package cc.smtweb.framework.core.db.jdbc;

/**
* Created by Akmm at 14-2-15 下午1:51
* 数据库事务操作方法类
* 数据库事务操作方法类,被废弃,用IDbWorker替代
*/
@Deprecated
public abstract class AbsDbWorker implements IDbWorker {
@Override
public void doAfterDbCommit() {}


+ 3
- 3
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/jdbc/IDbWorker.java Ver arquivo

@@ -5,11 +5,11 @@ package cc.smtweb.framework.core.db.jdbc;
* 数据库事务操作方法类
*/
public interface IDbWorker {
public void work();
default void work(){}

//数据库提交完后的业务或缓存处理
public void doAfterDbCommit();
default void doAfterDbCommit(){}

//数据库回滚后的业务或缓存处理
public void doAfterDbRollback();
default void doAfterDbRollback(){}
}

+ 2
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractDelHandler.java Ver arquivo

@@ -2,7 +2,7 @@ package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import lombok.extern.slf4j.Slf4j;

/**
@@ -17,7 +17,7 @@ public abstract class AbstractDelHandler extends AbstractHandler{
id = readId();

checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
delDb();
@@ -25,13 +25,11 @@ public abstract class AbstractDelHandler extends AbstractHandler{

@Override
public void doAfterDbCommit() {
super.doAfterDbCommit();
saveSuccess();
}

@Override
public void doAfterDbRollback() {
super.doAfterDbRollback();
saveFailed();
}
});


+ 2
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractSaveHandler.java Ver arquivo

@@ -2,7 +2,7 @@ package cc.smtweb.framework.core.mvc.service;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import lombok.extern.slf4j.Slf4j;

/**
@@ -29,7 +29,7 @@ public abstract class AbstractSaveHandler<T> extends AbstractHandler {
setNewId();
}
checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work(){
saveDb();


+ 3
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/DefaultSaveHandler.java Ver arquivo

@@ -4,13 +4,12 @@ import cc.smtweb.framework.core.cache.AbstractCache;
import cc.smtweb.framework.core.cache.CacheManager;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.db.jdbc.IDbWorker;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
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.jdbc.AbsDbWorker;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelIndex;
import cc.smtweb.framework.core.db.vo.ModelTable;
@@ -46,7 +45,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractHandler
readFromPage();
if (bean.getEntityId() <= 0L) bean.setEntityId(DbEngine.getInstance().nextId());
checkValid();
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work(){
saveDb();
@@ -159,7 +158,7 @@ public class DefaultSaveHandler<T extends DefaultEntity> extends AbstractHandler
ModelField fieldParentId = table.findFieldByType(SwEnum.FieldType.PARENT_ID.value);

bean.put(fieldParentId.getName(), parentId);
DbEngine.getInstance().doTrans(new AbsDbWorker() {
DbEngine.getInstance().doTrans(new IDbWorker() {
@Override
public void work() {
listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean);


Carregando…
Cancelar
Salvar