From 7211a7b35b03ecdb7260039418466304151d96dc Mon Sep 17 00:00:00 2001 From: zhenggm Date: Fri, 9 Sep 2022 19:43:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9A=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/web/design/form/model/ModelFactory.java | 1 + .../web/engine/dynPage/AbstractDynPageHandler.java | 22 ++ .../bpm/web/engine/dynPage/DynPageProvider.java | 21 ++ .../model/flow/listcard/single/FlowDelHandler.java | 4 +- .../listcard/single/FlowSingleLoadHandler.java | 21 +- .../listcard/single/FlowSingleSaveHandler.java | 18 +- .../flow/listcard/single/FlowSingleService.java | 12 +- .../flow/listcard/single/FlowTransHandler.java | 6 +- .../model/listcard/abshandler/ModelDelHandler.java | 85 ++++++++ .../model/listcard/abshandler/ModelHelper.java | 25 +++ .../listcard/abshandler/ModelLoadHandler.java | 115 ++++++++++ .../listcard/abshandler/ModelSaveHandler.java | 242 +++++++++++++++++++++ .../model/listcard/abshandler/ModelService.java | 77 +++++++ .../model/listcard/lclc1/LCLC1LoadHandler.java | 10 +- .../model/listcard/lclc1/LCLC1SaveHandler.java | 6 +- .../model/listcard/mastersub/LCMsSaveHandler.java | 4 +- .../model/listcard/normal/LCNormalDefine.java | 12 - .../model/listcard/normal/LCNormalDelHandler.java | 30 --- .../model/listcard/normal/LCNormalLoadHandler.java | 44 ---- .../model/listcard/normal/LCNormalSaveHandler.java | 21 -- .../model/listcard/normal/LCNormalService.java | 64 +----- .../model/listcard/single/LCSingleDelHandler.java | 85 -------- .../model/listcard/single/LCSingleHelper.java | 43 ---- .../model/listcard/single/LCSingleLoadHandler.java | 97 --------- .../model/listcard/single/LCSingleSaveHandler.java | 216 ------------------ .../model/listcard/single/LCSingleService.java | 66 +----- .../web/sys/base/billType/BillTypeSaveHandler.java | 8 +- .../bpm/web/sys/base/billType/BillTypeService.java | 4 +- 28 files changed, 641 insertions(+), 718 deletions(-) create mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java create mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelHelper.java create mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java create mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java create mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelService.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDefine.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalSaveHandler.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java delete mode 100644 smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java index f137609..74897ef 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/model/ModelFactory.java @@ -52,6 +52,7 @@ public class ModelFactory { worker.saveForm(bean, listFormChild); } + //构建模板 public void buildSaveModel(ModelForm bean) { BaseModelWorker worker = getWorker(bean); worker.buildSaveModel(bean); diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/AbstractDynPageHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/AbstractDynPageHandler.java index 53a6f18..d54ce28 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/AbstractDynPageHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/AbstractDynPageHandler.java @@ -1,7 +1,9 @@ package cc.smtweb.system.bpm.web.engine.dynPage; +import cc.smtweb.framework.core.common.SwEnum; import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.exception.BizException; +import cc.smtweb.framework.core.exception.SwException; import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.system.bpm.web.design.form.ModelForm; @@ -41,6 +43,26 @@ public abstract class AbstractDynPageHandler extends AbstractHandler { return datasets.findByName(name); } + //找可编辑卡片数据集 + protected PageDataset findCardDataset(String dsName) { + PageDataset cardDataset = datasets.findByName(dsName); + if (cardDataset == null) throw new SwException("没有找到卡片数据集(" + dsName + ")!"); + if (!SwEnum.DatasetType.FORM.value.equals(cardDataset.type)) {//单表 + throw new SwException("卡片数据集定义错误(" + dsName + ")!"); + } + return cardDataset; + } + + //找列表数据集 + protected PageDataset findListDataset(String dsName) { + PageDataset listDataset = datasets.findByName(dsName); + if (listDataset == null) throw new SwException("没有找到列表数据集(" + dsName + ")!"); + if (!SwEnum.DatasetType.LIST.value.equals(listDataset.type)) {//列表 + throw new SwException("列表数据集定义错误(" + dsName + ")!"); + } + return listDataset; + } + //获取第一个,主数据集 protected PageDataset findMasterDataset() { return datasets.findMasterDataset(); diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageProvider.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageProvider.java index 180b78b..e3641b5 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageProvider.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageProvider.java @@ -37,6 +37,27 @@ public class DynPageProvider extends AbstractCompProvider { }); } + public T loadBean(PageDataset pageDataSet, SwMap filter) { + return doGetData("b_" + pageDataSet.id, () -> { + ModelTable masterTable = ModelTableCache.getInstance().get(pageDataSet.masterTable); + EntityDao dao = DbEngine.getInstance().findDao(masterTable.getName()); + T bean = dao.createBean(); + + SqlNamedPara sqlPara = DynPageHelper.buildSelectSql(pageDataSet, filter); + SwMap map = DbEngine.getInstance().queryEntityN(sqlPara.sql, sqlPara.mapParas, SwMap.class); + if (map == null) { + return bean; + //throw new BizException("没有找到指定数据(ds=" + pageDataSet.name + ")"); + } + + EntityHelper.loadBeanText(masterTable.getName(), map, sqlPara.mapFieldAlias); + DynPageHelper.setCalcFields(map, pageDataSet); + + bean.getData().putAll(map); + return bean; + }); + } + public T loadBean(String tableName, long id) { return doGetData(tableName + "." + id, () -> { EntityDao bdao = (EntityDao) DbEngine.getInstance().findDao(tableName); diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java index fb3282e..3e58c16 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowDelHandler.java @@ -3,13 +3,13 @@ package cc.smtweb.system.bpm.web.engine.model.flow.listcard.single; import cc.smtweb.framework.core.db.vo.ModelTable; 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.model.listcard.single.LCSingleDelHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelDelHandler; /** * Created by Akmm at 2022-09-01 15:03 * 流程删除 */ -public class FlowDelHandler extends LCSingleDelHandler implements FlowListener { +public class FlowDelHandler extends ModelDelHandler implements FlowListener { protected FlowInstance flowInstance; @Override diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java index e6d63d9..eb6c293 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleLoadHandler.java @@ -10,24 +10,23 @@ 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.model.listcard.single.LCSingleHelper; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelLoadHandler; /** * Created by Akmm at 2022-08-26 17:15 * 流程加载 */ -public class FlowSingleLoadHandler extends LCSingleLoadHandler implements FlowListener { +public class FlowSingleLoadHandler extends ModelLoadHandler implements FlowListener { protected FlowInstance flowInstance; @Override - protected void afterAdd(SwMap ret, T bean) { + protected void afterAdd(SwMap ret) { + super.afterAdd(ret); flowInstance = FlowInstance.createByBillType(us, this, form.getBillType()); - PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets); bean.setEntityId(flowInstance.getProcInst().getId()); - - ret.put(cardDataset.name, DynRetBean.createBean(bean)); + ret.put(ModelHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); flowInstance.setPageRetExtra(ret); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); @@ -35,13 +34,13 @@ public class FlowSingleLoadHandler extends LCSingleLoad } @Override - public R load() { - SwMap ret = new SwMap(); + protected void load(SwMap ret, SwMap filter) { + //过滤条件 long id = params.readLong("id"); long taskId = params.readLong("taskId"); - PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets); + PageDataset cardDataset = findCardDataset(ModelHelper.DATASET_NAME_CARD); T bean = provider.loadBean(cardDataset, id); ret.put(cardDataset.name, DynRetBean.createBean(bean)); @@ -51,8 +50,6 @@ public class FlowSingleLoadHandler extends LCSingleLoad flowInstance.setPageRetExtra(ret); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.create(flowInstance.loadComment(), 0))); - afterLoad(ret, bean); - return R.success(ret); } @Override diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java index 82c05af..72ed92e 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleSaveHandler.java @@ -5,23 +5,22 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.framework.core.exception.BizException; import cc.smtweb.framework.core.mvc.service.SwListData; import cc.smtweb.framework.core.util.DateUtil; -import cc.smtweb.system.bpm.web.design.form.define.PageDataset; 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.model.listcard.single.LCSingleSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; /** * Created by Akmm at 2022-08-26 16:47 * 带流程的简单卡片之保存 */ -public class FlowSingleSaveHandler extends LCSingleSaveHandler implements FlowListener { +public class FlowSingleSaveHandler extends ModelSaveHandler implements FlowListener { protected FlowInstance flowInstance; @Override - protected T readBeanFromPage(PageDataset pageDataSet, SwMap pageData) { - T bean = super.readBeanFromPage(pageDataSet, pageData); + protected void readFromPage(SwMap pageData, SwMap filter) { + super.readFromPage(pageData, filter); long id = params.readLong("id"); long taskId = params.readLong("taskId"); @@ -43,18 +42,17 @@ public class FlowSingleSaveHandler extends LCSingleSave flowInstance.getProcInst().setUrl(getBillUrl()); } flowInstance.getProcInst().setBillInfo(getBillInfo()); - return bean; } @Override - protected void saveBean(T bean) { - super.saveBean(bean); + protected void doSave() { + super.doSave(); flowInstance.save(); } @Override - protected void afterSave(SwMap ret, T bean) { - super.afterSave(ret, bean); + protected void afterSave(SwMap ret) { + super.afterSave(ret); flowInstance.setPageRetExtra(ret); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java index 6b7845f..a017a49 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowSingleService.java @@ -7,9 +7,9 @@ import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.mvc.service.IWorker; import cc.smtweb.framework.core.session.UserSession; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleDelHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleLoadHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelDelHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelLoadHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService; /** @@ -27,17 +27,17 @@ public class FlowSingleService extends LCSingleService { } @Override - protected LCSingleSaveHandler getSaveHandler() { + protected ModelSaveHandler getSaveHandler() { return new FlowSingleSaveHandler(); } @Override - protected LCSingleLoadHandler getLoadHandler() { + protected ModelLoadHandler getLoadHandler() { return new FlowSingleLoadHandler(); } @Override - protected LCSingleDelHandler getDelHandler() { + protected ModelDelHandler getDelHandler() { return new FlowDelHandler(); } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java index 0616a41..9fa1019 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/flow/listcard/single/FlowTransHandler.java @@ -11,7 +11,7 @@ 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.model.listcard.single.LCSingleHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; /** * Created by Akmm at 2022-09-01 15:03 @@ -33,7 +33,7 @@ public class FlowTransHandler extends AbstractDynPageHa private SwMap buildRetData() { SwMap ret = new SwMap(); - ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); + ret.put(ModelHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); flowInstance.setPageRetExtra(ret); ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); @@ -52,7 +52,7 @@ public class FlowTransHandler extends AbstractDynPageHa } protected void loadBean() { - PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets); + PageDataset cardDataset = findCardDataset(ModelHelper.DATASET_NAME_CARD); bean = provider.loadBean(cardDataset, billId); } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java new file mode 100644 index 0000000..cdcb695 --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java @@ -0,0 +1,85 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +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.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.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.engine.dynPage.AbstractDynPageHandler; + +/** + * Created by Akmm at 2022/4/21 17:53 + * 删除操作 + */ +public class ModelDelHandler extends AbstractDynPageHandler { + /** + * 删除指定数据集,入参{pageId, dataset, id} + * + * @return + */ + public R del() { + long id = params.readLong("id"); + if (id == 0L) throw new BizException("没有收到待删除记录Id(" + id + ")!"); + //数据集 + PageDataset pageDataSet = findCardDataset(ModelHelper.DATASET_NAME_CARD); + + checkBean(pageDataSet, id); + + DbEngine.getInstance().doTrans(new IDbWorker() { + @Override + public void work() { + ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); + if (table == null) throw new BizException("没有找到指定的的表定义:" + pageDataSet.name + "!"); + EntityDao dao = DbEngine.getInstance().findDao(table.getName()); + dao.deleteEntity(id); + localDel(id, table); + } + + @Override + public void doAfterDbCommit() { + ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); + if (table.isNeedCache()) { + AbstractCache cache = CacheManager.getIntance().getCache(table.getName()); + cache.remove(id); + } + afterCommit(id, table); + } + + @Override + public void doAfterDbRollback() { + afterRollback(id); + } + }); + return R.success(); + } + + //回调:::删除之后 + protected void localDel(long id, ModelTable table) { + } + + //回调:::提交成功后 + protected void afterCommit(long id, ModelTable table) { + } + + //回调:::提交失败,事务回滚后 + protected void afterRollback(long id) { + + } + + /** + * 删除校验 + * + * @param pageDataSet + * @param id + */ + protected void checkBean(PageDataset pageDataSet, long id) { + //校验外键引用关系 + EntityHelper.checkExists(pageDataSet.masterTable, id); + } +} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelHelper.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelHelper.java new file mode 100644 index 0000000..6f06771 --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelHelper.java @@ -0,0 +1,25 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +import cc.smtweb.framework.core.common.SwEnum; +import cc.smtweb.framework.core.common.SwMap; +import cc.smtweb.framework.core.exception.SwException; +import cc.smtweb.system.bpm.web.design.form.ModelForm; +import cc.smtweb.system.bpm.web.design.form.ModelFormHelper; +import cc.smtweb.system.bpm.web.design.form.define.PageDataset; +import cc.smtweb.system.bpm.web.design.form.define.PageDatasets; +import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; + +/** + * Created by Akmm at 2022-08-16 16:07 + * 常量定义 + */ +public interface ModelHelper { + String DATASET_NAME_LIST = "list"; + String DATASET_NAME_CARD = "card"; + + static SwMap buildRetData(String dsName, SwMap data) { + SwMap mapRet = new SwMap(); + mapRet.put(dsName, DynRetBean.createBean(data)); + return mapRet; + } +} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java new file mode 100644 index 0000000..a260707 --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java @@ -0,0 +1,115 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +import cc.smtweb.framework.core.common.R; +import cc.smtweb.framework.core.common.SwConsts; +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.vo.ModelTable; +import cc.smtweb.framework.core.exception.SwException; +import cc.smtweb.system.bpm.web.design.form.define.PageDataset; +import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler; +import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; +import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; + +/** + * Created by Akmm at 2022-08-16 15:43 + */ +public class ModelLoadHandler extends AbstractDynPageHandler { + protected T bean; + + //新增卡片操作,初始化定义的数据集 + public R add() { + SwMap ret = new SwMap(); + bean = addBean(ret, ModelHelper.DATASET_NAME_CARD); + afterAdd(ret); + return R.success(ret); + } + + //创建一个bean,并加到返回对象中 + protected E addBean(SwMap ret, String dsName) { + //返回的数据,以dataset.name为key,查出的结果(bean或list)为value + PageDataset cardDataset = findCardDataset(dsName); + ModelTable table = cardDataset._getModelTable(); + if (table == null) throw new SwException("卡片主表未找到!"); + final EntityDao dao = DbEngine.getInstance().findDao(table.getName()); + + E entity = dao.createBean(us.getUserId()); + entity.setEntityId(DbEngine.getInstance().nextId()); + + ret.put(dsName, DynRetBean.createBean(entity)); + return entity; + } + + + //新增初始化 - bean + protected void afterAdd(SwMap ret) { + } + + public R load() { + SwMap ret = new SwMap(); + //过滤条件 + SwMap filter = params.readMap("filter"); + load(ret, filter); + return R.success(ret); + } + + //从数据库加载bean,并设到返回值 + protected void load(SwMap ret, SwMap filter) { + PageDataset cardDataset = findCardDataset(ModelHelper.DATASET_NAME_CARD); + bean = provider.loadBean(cardDataset, filter.readLong(SwConsts.NAME_ID)); + ret.put(ModelHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); + } + + //给子类使用的工具方法:根据数据集配置,读取bean,并加到返回值 + protected E loadBean(SwMap ret, String dsName, SwMap filter) { + PageDataset cardDataset = findCardDataset(dsName); + E bean = provider.loadBean(cardDataset, filter); + ret.put(dsName, DynRetBean.createBean(bean)); + return bean; + } + + + protected DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { + DynPageListHandler listHandler = new DynPageListHandler(form.getId(), filter, pageDataSet); + listHandler.init(params, us); + return listHandler; + } + + /** + * 列表数据 + * + * @return + */ + protected R list(String dsName) { + //过滤条件 + SwMap filter = params.readMap("filter"); + //对应的数据集定义 + PageDataset pageDataSet = findListDataset(dsName); + DynRetBean bean = DynRetBean.createList(getListWorker(filter, pageDataSet).buildListData()); + return R.success(bean); + } + + protected R getTotal(String dsName) { + //数据集 + PageDataset pageDataSet = findListDataset(dsName); + //过滤条件 + SwMap filter = params.readMap("filter"); + + return getListWorker(filter, pageDataSet).getTotal(); + } + + public R list() { + return list(ModelHelper.DATASET_NAME_LIST); + } + + /** + * 计算分页数据 + * + * @return + */ + public R getTotal() { + return getTotal(ModelHelper.DATASET_NAME_LIST); + } +} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java new file mode 100644 index 0000000..2a89aa0 --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java @@ -0,0 +1,242 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +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.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.impl.DefaultEntity; +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.TreeHelper; +import cc.smtweb.framework.core.util.StringUtil; +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.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by Akmm at 2022/4/21 17:53 + * 模型保存操作 + * 入参:{pageId, data:} + */ +public class ModelSaveHandler extends AbstractDynPageHandler { + private Map> mapTreeBean = new HashMap<>(); + protected T bean; + + /** + * 保存指定数据集操作,入参:{pageId,dataset:"", data:{form:{},list: {total:0,rows:[]}}, filter:{}} + */ + public R save() { + SwMap filter = params.readMap("filter"); + //待保存数据 + SwMap data = params.readMap("data"); + if (data == null) throw new BizException("没有收到待保存的的数据!"); + + readFromPage(data, filter); + checkValid(); + DbEngine.getInstance().doTrans(new IDbWorker() { + @Override + public void work() { + doSave(); + } + + @Override + public void doAfterDbCommit() { + doAfterCommit(); + } + + @Override + public void doAfterDbRollback() { + doAfterRollback(); + } + }); + bean.removeStatus(); + SwMap ret = ModelHelper.buildRetData(ModelHelper.DATASET_NAME_CARD, bean.getData()); + afterSave(ret); + return R.success(ret); + } + + protected void afterSave(SwMap ret) { + } + + /** + * 从页面获取待保存的bean + * + * @param pageDataSet + * @param pageData + * @return + */ + protected void readFromPage(SwMap pageData, SwMap filter) { + //读取待保存的bean + bean = readBeanFromPage(ModelHelper.DATASET_NAME_CARD, pageData, filter); + } + + //给子类使用的工具方法:从页面读取一个bean + protected E readBeanFromPage(String dsName, SwMap pageData, SwMap filter) { + //对应的数据集定义 + PageDataset pageDataSet = findCardDataset(dsName); + + ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); + if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name); + + SwMap data = pageData.readMap(pageDataSet.name); + if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); + data = data.readMap("form"); + if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); + + boolean isNew = data.readBool(DefaultEntity.statusKey); + EntityDao dao = DbEngine.getInstance().findDao(table.getName()); + E vo; + if (isNew) { + vo = dao.createBean(); + //暂时不考虑list保存的情况 + vo.getData().putAll(data); + } else { + long id = data.readLong(table.getIdField()); + vo = dao.queryEntity(id); + if (vo == null) { + throw new BizException("没有找到待保存的记录:" + table.getName() + "." + id); + } + //暂时不考虑list保存的情况 + vo.getData().putAll(data); + vo.setIsNew(false); + } + if (filter != null && vo.isNew()) {//有过滤条件,将关联的值设上 + setLinkValue(pageDataSet, vo, f -> filter.get(f.name)); + } + return vo; + } + + /** + * 保存校验 + * + * @param bean + */ + protected void checkValid() { + checkValid(bean); + } + + //给子类使用的工具方法:校验bean + protected void checkValid(E vo) { + ModelTable table = ModelTableCache.getInstance().getByName(vo.getTableName()); + for (ModelField field : table.getFields()) { + String value = vo.getStr(field.getName()); + //非空校验 + if (field.isNotNull() && StringUtils.isEmpty(value)) { + throw new BizException("字段不允许为空:" + field.getTitle()); + } + + //长度校验 + if (StringUtils.isNotEmpty(value)) { + int len = SwEnum.DataType.instance.getByValue(field.getDataType()).dataLength; + if (len > 0 && StringUtil.getStrLenB(value) > len) { + throw new BizException("字段值超长:" + field.getTitle()); + } + } + } + //唯一键校验 + EntityDao dao = DbEngine.getInstance().findDao(vo.getTableName()); + for (ModelIndex mi : table.getIndexes()) { + if (mi.isUnique()) { + dao.checkUnique(vo, mi.getFields().split(",")); + } + } + } + + protected void doSave() { + saveBean(bean); + } + + //给子类使用的工具方法:保存bean + protected void saveBean(E entity) { + final String tableName = entity.getTableName(); + EntityDao dao = DbEngine.getInstance().findDao(tableName); + if (entity.isNew()) { + dao.insertEntity(entity); + } else { + ModelTable table = ModelTableCache.getInstance().getByName(tableName); + ModelField field = table.findFieldByType(SwEnum.FieldType.UPDATE_USER.value); + if (field != null) entity.put(field.getName(), us.getUserId()); + + dao.updateEntity(entity); + if (table.getType() == SwEnum.TableType.TYPE_TREE.value) { + List listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(entity); + mapTreeBean.put(tableName, listTreeBean); + } + } + } + + //保存后 + protected void doAfterCommit() { + commitBean(bean); + } + + //给子类使用的工具方法:提交后事件 + protected void commitBean(E entity) { + final String tableName = entity.getTableName(); + ModelTable table = ModelTableCache.getInstance().getByName(tableName); + if (table.isNeedCache()) { + AbstractCache cache = CacheManager.getIntance().getCache(tableName); + List listTreeBean = (List)mapTreeBean.get(tableName); + //树型表,父亲改变了,要多处理下缓存;还有个东东:级次码 + if (listTreeBean != null && !listTreeBean.isEmpty()) { + for (DefaultEntity b : listTreeBean) { + cache.put(b); + } + } else { + cache.put(entity); + } + } + } + + //事务回滚 + protected void doAfterRollback() { + rollBean(bean); + } + + //给子类使用的工具方法:回滚指定的bean + protected void rollBean(E bean) { + final String tableName = bean.getTableName(); + ModelTable table = ModelTableCache.getInstance().getByName(tableName); + if (table.isNeedCache()) { + AbstractCache cache = CacheManager.getIntance().getCache(tableName); + cache.reset(bean); + } + } + + //将关联的值设上 + protected void setLinkValue(PageDataset pageDataSet, DefaultEntity bean, IGetValue iGetValue) { + ModelTable table = ModelTableCache.getInstance().getByName(bean.getTableName()); + for (PageDatasetFilter f : pageDataSet.filters) { + String v = bean.getStr(f.field); + //有值,就不管 + if (v != null && !v.equals(table.findField(f.field).getDefaultValue())) continue; + + if (SwEnum.FilterType.CONST.value.equals(f.type)) {//常量 + bean.put(f.field, f.value); + } else if (SwEnum.FilterType.PARAM.value.equals(f.type)) {//参数 + bean.put(f.field, f.value); + } else if (SwEnum.FilterType.LINK.value.equals(f.type)) {//参数 + Object value = iGetValue.getValue(f); + if (value != null) { + bean.put(f.field, value); + } + } + } + } + + public interface IGetValue { + Object getValue(PageDatasetFilter f); + } +} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelService.java new file mode 100644 index 0000000..5a64c73 --- /dev/null +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelService.java @@ -0,0 +1,77 @@ +package cc.smtweb.system.bpm.web.engine.model.listcard.abshandler; + +import cc.smtweb.framework.core.annotation.SwBody; +import cc.smtweb.framework.core.common.R; +import cc.smtweb.framework.core.common.SwMap; +import cc.smtweb.framework.core.mvc.service.AbstractHandler; +import cc.smtweb.framework.core.session.UserSession; +import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; + +/** + * Created by Akmm at 2022-08-12 15:37 + * 单页面简单列表卡片服务类 + */ +public class ModelService extends DynPageService { + public final static String TYPE_MODEL_LIST = "modelList"; + public final static String TYPE_MODEL_ADD = "modelAdd"; + public final static String TYPE_MODEL_LOAD = "modelLoad"; + public final static String TYPE_MODEL_SAVE = "modelSave"; + public final static String TYPE_MODEL_DEL = "modelDel"; + + @Override + protected AbstractHandler createHandler(String type) { + switch (type) { + case TYPE_MODEL_LIST: + case TYPE_MODEL_LOAD: + case TYPE_MODEL_ADD: + return getLoadHandler(); + case TYPE_MODEL_SAVE: + return getSaveHandler(); + case TYPE_MODEL_DEL: + return getDelHandler(); + } + return super.createHandler(type); + } + + protected ModelSaveHandler getSaveHandler() { + return new ModelSaveHandler(); + } + + protected ModelLoadHandler getLoadHandler() { + return new ModelLoadHandler(); + } + + protected ModelDelHandler getDelHandler() { + return new ModelDelHandler(); + } + + //保存 + public R modelSave(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_SAVE, handler -> ((ModelSaveHandler) handler).save()); + } + + //读取 + public R modelLoad(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_LOAD, handler -> ((ModelLoadHandler) handler).load()); + } + + //读取 + public R modelAdd(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_ADD, handler -> ((ModelLoadHandler) handler).add()); + } + + //删除 + public R modelDel(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((ModelDelHandler) handler).del()); + } + + //列表数据 + public R modelList(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((ModelLoadHandler) handler).list()); + } + + //列表总记录数及合计栏 + public R modelListTotal(@SwBody SwMap params, UserSession us) { + return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((ModelLoadHandler) handler).getTotal()); + } +} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java index 247d636..787b912 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java @@ -4,7 +4,7 @@ import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsLoadHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; /** * @Author:lip @@ -18,7 +18,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { */ public R lAdd() { SwMap data = doAdd(LCLC1Define.dsLCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsLCard, data)); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, data)); } /** @@ -28,7 +28,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { */ public R rAdd() { SwMap data = doAdd(LCLC1Define.dsRCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsRCard, data)); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, data)); } /** @@ -38,7 +38,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { */ public R lLoad() { SwMap bean = doLoadCard(LCLC1Define.dsLCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsLCard, bean)); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, bean)); } /** @@ -48,7 +48,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { */ public R rLoad() { SwMap bean = doLoadCard(LCLC1Define.dsRCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsRCard, bean)); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, bean)); } /** diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java index 128900a..457330d 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java @@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.lclc1; import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsSaveHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; /** * @Author:lip @@ -17,7 +17,7 @@ public class LCLC1SaveHandler extends AbsSaveHandler { */ public R lSave() { DefaultEntity bean = doSave(LCLC1Define.dsLCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsLCard, bean.getData())); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, bean.getData())); } /** @@ -27,6 +27,6 @@ public class LCLC1SaveHandler extends AbsSaveHandler { */ public R rSave() { DefaultEntity bean = doSave(LCLC1Define.dsRCard); - return R.success(LCSingleHelper.buildRetData(LCLC1Define.dsRCard, bean.getData())); + return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, bean.getData())); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java index 4754bc9..25f6096 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsSaveHandler.java @@ -12,7 +12,7 @@ import cc.smtweb.framework.core.exception.BizException; import cc.smtweb.system.bpm.web.design.form.define.PageDataset; import cc.smtweb.system.bpm.web.engine.model.listcard.ModelUtils; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsSaveHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; import org.springframework.util.Assert; import java.util.ArrayList; @@ -96,6 +96,6 @@ public class LCMsSaveHandler extends AbsSaveHandler { afterRollback(masterBean); } }); - return R.success(LCSingleHelper.buildRetData(masterDataSet.name, masterBean.getData())); + return R.success(ModelHelper.buildRetData(masterDataSet.name, masterBean.getData())); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDefine.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDefine.java deleted file mode 100644 index 82581c9..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDefine.java +++ /dev/null @@ -1,12 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.normal; - -/** - * @Author:lip - * @Date : 2022/9/2 15:23 - */ -public class LCNormalDefine { - //列表里数据集 - public static final String dsList = "list"; - //卡片数据集 - public static final String dsCard = "card"; -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java deleted file mode 100644 index b780aba..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalDelHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.normal; - -import cc.smtweb.framework.core.common.R; -import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsDelHandler; - -/** - * Created by Akmm at 2022/4/21 17:53 - * 删除操作 - */ -public class LCNormalDelHandler extends AbsDelHandler { - /** - * 通过列表删除 - * - * @return - */ - public R listDel() { - doDel(LCNormalDefine.dsList); - return R.success(); - } - - /** - * 通过卡片删除 - * - * @return - */ - public R cardDel() { - doDel(LCNormalDefine.dsCard); - return R.success(); - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java deleted file mode 100644 index 5e76454..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.normal; - -import cc.smtweb.framework.core.common.R; -import cc.smtweb.framework.core.common.SwMap; -import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; -import cc.smtweb.system.bpm.web.engine.model.listcard.ModelUtils; -import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsLoadHandler; - -/** - * @Author:lip - * @Date : 2022/8/29 14:37 - */ -public class LCNormalLoadHandler extends AbsLoadHandler { - - //新增卡片操作,初始化定义的数据集 - public R add() { - SwMap data = doAdd(LCNormalDefine.dsCard); - return R.success(ModelUtils.buildRetData(LCNormalDefine.dsCard, data)); - } - - public R load() { - SwMap data = doLoadCard(LCNormalDefine.dsCard); - return R.success(ModelUtils.buildRetData(LCNormalDefine.dsCard, data)); - } - - /** - * 列表数据 - * - * @return - */ - public R list() { - DynRetBean dynRetBean = doList(LCNormalDefine.dsList); - return R.success(dynRetBean); - } - - /** - * 计算分页数据 - * - * @return - */ - public R getTotal() { - return doTotal(LCNormalDefine.dsList); - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalSaveHandler.java deleted file mode 100644 index 3b48992..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalSaveHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.normal; - -import cc.smtweb.framework.core.common.R; -import cc.smtweb.framework.core.db.impl.DefaultEntity; -import cc.smtweb.system.bpm.web.engine.model.listcard.ModelUtils; -import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsSaveHandler; - -/** - * @Author:lip - * @Date : 2022/9/2 14:56 - */ -public class LCNormalSaveHandler extends AbsSaveHandler { - /** - * @return - */ - public R save() { - DefaultEntity bean = doSave(LCNormalDefine.dsCard); - return R.success(ModelUtils.buildRetData(LCNormalDefine.dsCard, bean.getData())); - } - -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java index 1513364..2fc43f4 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java @@ -4,69 +4,17 @@ import cc.smtweb.framework.core.annotation.SwBody; import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.common.SwMap; -import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.session.UserSession; -import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelDelHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelLoadHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelService; +import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService; /** * @Author:lip * @Date : 2022/8/27 13:54 */ @SwService -public class LCNormalService extends DynPageService { - protected final static String TYPE_MODEL_LIST = "modelList"; - protected final static String TYPE_MODEL_ADD = "modelAdd"; - protected final static String TYPE_MODEL_LOAD = "modelLoad"; - protected final static String TYPE_MODEL_SAVE = "modelSave"; - protected final static String TYPE_MODEL_DEL = "modelDel"; - - @Override - protected AbstractHandler createHandler(String type) { - switch (type) { - case TYPE_MODEL_LIST: - case TYPE_MODEL_LOAD: - case TYPE_MODEL_ADD: - return new LCNormalLoadHandler(); - case TYPE_MODEL_SAVE: - return new LCNormalSaveHandler(); - case TYPE_MODEL_DEL: - return new LCNormalDelHandler(); - } - return super.createHandler(type); - } - - //保存 - public R modelSave(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_SAVE, handler -> ((LCNormalSaveHandler) handler).save()); - } - - //列表删除 - public R modelLDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCNormalDelHandler) handler).listDel()); - } - - //卡片删除 - public R modelCDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCNormalDelHandler) handler).cardDel()); - } - - //读取 - public R modelLoad(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LOAD, handler -> ((LCNormalLoadHandler) handler).load()); - } - - //读取 - public R modelAdd(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_ADD, handler -> ((LCNormalLoadHandler) handler).add()); - } - - //列表数据 - public R modelList(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCNormalLoadHandler) handler).list()); - } - - //列表总记录数及合计栏 - public R modelListTotal(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCNormalLoadHandler) handler).getTotal()); - } +public class LCNormalService extends ModelService { } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java deleted file mode 100644 index 4cd0444..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleDelHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -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.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.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.engine.dynPage.AbstractDynPageHandler; - -/** - * Created by Akmm at 2022/4/21 17:53 - * 删除操作 - */ -public class LCSingleDelHandler extends AbstractDynPageHandler { - /** - * 删除指定数据集,入参{pageId, dataset, id} - * - * @return - */ - public R del() { - long id = params.readLong("id"); - if (id == 0L) throw new BizException("没有收到待删除记录Id(" + id + ")!"); - //数据集 - PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets); - - checkBean(pageDataSet, id); - - DbEngine.getInstance().doTrans(new IDbWorker() { - @Override - public void work() { - ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); - if (table == null) throw new BizException("没有找到指定的的表定义:" + pageDataSet.name + "!"); - EntityDao dao = DbEngine.getInstance().findDao(table.getName()); - dao.deleteEntity(id); - localDel(id, table); - } - - @Override - public void doAfterDbCommit() { - ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); - if (table.isNeedCache()) { - AbstractCache cache = CacheManager.getIntance().getCache(table.getName()); - cache.remove(id); - } - afterCommit(id, table); - } - - @Override - public void doAfterDbRollback() { - afterRollback(id); - } - }); - return R.success(); - } - - //回调:::删除之后 - protected void localDel(long id, ModelTable table) { - } - - //回调:::提交成功后 - protected void afterCommit(long id, ModelTable table) { - } - - //回调:::提交失败,事务回滚后 - protected void afterRollback(long id) { - - } - - /** - * 删除校验 - * - * @param pageDataSet - * @param id - */ - protected void checkBean(PageDataset pageDataSet, long id) { - //校验外键引用关系 - EntityHelper.checkExists(pageDataSet.masterTable, id); - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java deleted file mode 100644 index 0bbfe95..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleHelper.java +++ /dev/null @@ -1,43 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.single; - -import cc.smtweb.framework.core.common.SwEnum; -import cc.smtweb.framework.core.common.SwMap; -import cc.smtweb.framework.core.exception.SwException; -import cc.smtweb.system.bpm.web.design.form.define.PageDataset; -import cc.smtweb.system.bpm.web.design.form.define.PageDatasets; -import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; - -/** - * Created by Akmm at 2022-08-16 16:07 - * 常量定义 - */ -public interface LCSingleHelper { - String DATASET_NAME_LIST = "list"; - String DATASET_NAME_CARD = "card"; - - //卡片数据集 - static PageDataset findCardDataset(PageDatasets datasets) { - PageDataset cardDataset = datasets.findByName(DATASET_NAME_CARD); - if (cardDataset == null) throw new SwException("没有找到卡片数据集!"); - if (!SwEnum.DatasetType.FORM.value.equals(cardDataset.type)) {//单表 - throw new SwException("卡片数据集定义错误!"); - } - return cardDataset; - } - - //列表数据集 - static PageDataset findListDataset(PageDatasets datasets) { - PageDataset cardDataset = datasets.findByName(DATASET_NAME_LIST); - if (cardDataset == null) throw new SwException("没有找到列表数据集!"); - if (!SwEnum.DatasetType.LIST.value.equals(cardDataset.type)) {//列表 - throw new SwException("列表数据集定义错误!"); - } - return cardDataset; - } - - static SwMap buildRetData(String dsName, SwMap data) { - SwMap mapRet = new SwMap(); - mapRet.put(dsName, DynRetBean.createBean(data)); - return mapRet; - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java deleted file mode 100644 index b2aa1fa..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleLoadHandler.java +++ /dev/null @@ -1,97 +0,0 @@ -package cc.smtweb.system.bpm.web.engine.model.listcard.single; - -import cc.smtweb.framework.core.common.R; -import cc.smtweb.framework.core.common.SwConsts; -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.vo.ModelTable; -import cc.smtweb.framework.core.exception.SwException; -import cc.smtweb.system.bpm.web.design.form.define.PageDataset; -import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler; -import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; -import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; - -/** - * Created by Akmm at 2022-08-16 15:43 - */ -public class LCSingleLoadHandler extends AbstractDynPageHandler { - - //新增卡片操作,初始化定义的数据集 - public R add() { - SwMap ret = new SwMap(); - //返回的数据,以dataset.name为key,查出的结果(bean或list)为value - PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets); - ModelTable table = cardDataset._getModelTable(); - if (table == null) throw new SwException("卡片主表未找到!"); - final EntityDao dao = DbEngine.getInstance().findDao(table.getName()); - - T bean = dao.createBean(us.getUserId()); - bean.setEntityId(DbEngine.getInstance().nextId()); - - ret.put(cardDataset.name, DynRetBean.createBean(bean)); - - afterAdd(ret, bean); - return R.success(ret); - } - - - //新增初始化 - bean - protected void afterAdd(SwMap ret, T bean) { - } - - //加载之后 - protected void afterLoad(SwMap ret, T bean) { - } - - public R load() { - SwMap ret = new SwMap(); - //过滤条件 - SwMap filter = params.readMap("filter"); - //对应的数据集定义 - PageDataset cardDataset = LCSingleHelper.findCardDataset(datasets); - - T bean = provider.loadBean(cardDataset, filter.readLong(SwConsts.NAME_ID)); - ret.put(cardDataset.name, DynRetBean.createBean(bean)); - - afterLoad(ret, bean); - return R.success(ret); - } - - protected DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { - DynPageListHandler listHandler = new DynPageListHandler(form.getId(), filter, pageDataSet); - listHandler.init(params, us); - return listHandler; - } - - /** - * 列表数据 - * - * @return - */ - public R list() { - //过滤条件 - SwMap filter = params.readMap("filter"); - //对应的数据集定义 - PageDataset pageDataSet = LCSingleHelper.findListDataset(datasets); - - DynRetBean bean = DynRetBean.createList(getListWorker(filter, pageDataSet).buildListData()); - - return R.success(bean); - } - - /** - * 计算分页数据 - * - * @return - */ - public R getTotal() { - //数据集 - PageDataset pageDataSet = LCSingleHelper.findListDataset(datasets); - //过滤条件 - SwMap filter = params.readMap("filter"); - - return getListWorker(filter, pageDataSet).getTotal(); - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java deleted file mode 100644 index 151b334..0000000 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java +++ /dev/null @@ -1,216 +0,0 @@ -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.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.impl.DefaultEntity; -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.TreeHelper; -import cc.smtweb.framework.core.util.StringUtil; -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.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by Akmm at 2022/4/21 17:53 - * 保存操作 - * 入参:{pageId, data:} - */ -public class LCSingleSaveHandler extends AbstractDynPageHandler { - private Map> mapTreeBean = new HashMap<>(); - - /** - * 保存指定数据集操作,入参:{pageId,dataset:"", data:{form:{},list: {total:0,rows:[]}}, filter:{}} - */ - public R save() { - //数据集 - String dbName = params.readString("dataset"); - SwMap filter = params.readMap("filter"); - //待保存数据 - SwMap data = params.readMap("data"); - if (data == null) throw new BizException("没有收到待保存的的数据:" + dbName + "!"); - //对应的数据集定义 - PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets); - //读取待保存的bean - T bean = readBeanFromPage(pageDataSet, data); - if (filter != null && bean.isNew()) {//有过滤条件,将关联的值设上 - setLinkValue(pageDataSet, bean, f -> filter.get(f.name)); - } - checkBean(bean); - - DbEngine.getInstance().doTrans(new IDbWorker() { - @Override - public void work() { - saveBean(bean); - } - - @Override - public void doAfterDbCommit() { - afterCommit(bean); - } - - @Override - public void doAfterDbRollback() { - afterRollback(bean); - } - }); - bean.removeStatus(); - SwMap ret = LCSingleHelper.buildRetData(pageDataSet.name, bean.getData()); - afterSave(ret, bean); - return R.success(ret); - } - - protected void afterSave(SwMap ret, T bean) { - } - - /** - * 从页面获取待保存的bean - * - * @param pageDataSet - * @param data - * @return - */ - protected T readBeanFromPage(PageDataset pageDataSet, SwMap pageData) { - ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); - if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name); - - SwMap data = pageData.readMap(pageDataSet.name); - if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); - data = data.readMap("form"); - if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); - - boolean isNew = data.readBool(DefaultEntity.statusKey); - EntityDao dao = DbEngine.getInstance().findDao(table.getName()); - T bean; - if (isNew) { - bean = dao.createBean(); - //暂时不考虑list保存的情况 - bean.getData().putAll(data); - } else { - long id = data.readLong(table.getIdField()); - bean = dao.queryEntity(id); - if (bean == null) { - throw new BizException("没有找到待保存的记录:" + table.getName() + "." + id); - } - //暂时不考虑list保存的情况 - bean.getData().putAll(data); - bean.setIsNew(false); - } - - return bean; - } - - /** - * 保存校验 - * - * @param bean - */ - protected void checkBean(T bean) { - ModelTable table = ModelTableCache.getInstance().getByName(bean.getTableName()); - for (ModelField field : table.getFields()) { - String value = bean.getStr(field.getName()); - //非空校验 - if (field.isNotNull() && StringUtils.isEmpty(value)) { - throw new BizException("字段不允许为空:" + field.getTitle()); - } - - //长度校验 - if (StringUtils.isNotEmpty(value)) { - int len = SwEnum.DataType.instance.getByValue(field.getDataType()).dataLength; - if (len > 0 && StringUtil.getStrLenB(value) > len) { - throw new BizException("字段值超长:" + field.getTitle()); - } - } - } - //唯一键校验 - EntityDao dao = DbEngine.getInstance().findDao(bean.getTableName()); - for (ModelIndex mi : table.getIndexes()) { - if (mi.isUnique()) { - dao.checkUnique(bean, mi.getFields().split(",")); - } - } - } - - protected void saveBean(T bean) { - final String tableName = bean.getTableName(); - EntityDao dao = DbEngine.getInstance().findDao(tableName); - if (bean.isNew()) { - dao.insertEntity(bean); - } else { - ModelTable table = ModelTableCache.getInstance().getByName(tableName); - ModelField field = table.findFieldByType(SwEnum.FieldType.UPDATE_USER.value); - if (field != null) bean.put(field.getName(), us.getUserId()); - - dao.updateEntity(bean); - if (table.getType() == SwEnum.TableType.TYPE_TREE.value) { - List listTreeBean = TreeHelper.getTreeHelper(tableName).resetTreeLevel(bean); - mapTreeBean.put(tableName, listTreeBean); - } - } - } - - protected void afterCommit(T bean) { - final String tableName = bean.getTableName(); - ModelTable table = ModelTableCache.getInstance().getByName(tableName); - if (table.isNeedCache()) { - AbstractCache cache = CacheManager.getIntance().getCache(tableName); - List listTreeBean = mapTreeBean.get(tableName); - //树型表,父亲改变了,要多处理下缓存;还有个东东:级次码 - if (listTreeBean != null && !listTreeBean.isEmpty()) { - for (DefaultEntity b : listTreeBean) { - cache.put(b); - } - } else { - cache.put(bean); - } - } - } - - protected void afterRollback(T bean) { - final String tableName = bean.getTableName(); - ModelTable table = ModelTableCache.getInstance().getByName(tableName); - if (table.isNeedCache()) { - AbstractCache cache = CacheManager.getIntance().getCache(tableName); - cache.reset(bean); - } - } - - //将关联的值设上 - protected void setLinkValue(PageDataset pageDataSet, T bean, IGetValue iGetValue) { - ModelTable table = ModelTableCache.getInstance().getByName(bean.getTableName()); - for (PageDatasetFilter f : pageDataSet.filters) { - String v = bean.getStr(f.field); - //有值,就不管 - if (v != null && !v.equals(table.findField(f.field).getDefaultValue())) continue; - - if (SwEnum.FilterType.CONST.value.equals(f.type)) {//常量 - bean.put(f.field, f.value); - } else if (SwEnum.FilterType.PARAM.value.equals(f.type)) {//参数 - bean.put(f.field, f.value); - } else if (SwEnum.FilterType.LINK.value.equals(f.type)) {//参数 - Object value = iGetValue.getValue(f); - if (value != null) { - bean.put(f.field, value); - } - } - } - } - - public interface IGetValue { - Object getValue(PageDatasetFilter f); - } -} diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java index 603c298..7a74d84 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java @@ -7,73 +7,13 @@ import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelService; /** * Created by Akmm at 2022-08-12 15:37 * 单页面简单列表卡片服务类 */ @SwService -public class LCSingleService extends DynPageService { - public final static String TYPE_MODEL_LIST = "modelList"; - public final static String TYPE_MODEL_ADD = "modelAdd"; - public final static String TYPE_MODEL_LOAD = "modelLoad"; - public final static String TYPE_MODEL_SAVE = "modelSave"; - public final static String TYPE_MODEL_DEL = "modelDel"; - - @Override - protected AbstractHandler createHandler(String type) { - switch (type) { - case TYPE_MODEL_LIST: - case TYPE_MODEL_LOAD: - case TYPE_MODEL_ADD: - return getLoadHandler(); - case TYPE_MODEL_SAVE: - return getSaveHandler(); - case TYPE_MODEL_DEL: - return getDelHandler(); - } - return super.createHandler(type); - } - - protected LCSingleSaveHandler getSaveHandler() { - return new LCSingleSaveHandler(); - } - - protected LCSingleLoadHandler getLoadHandler() { - return new LCSingleLoadHandler(); - } - - protected LCSingleDelHandler getDelHandler() { - return new LCSingleDelHandler(); - } - - //保存 - public R modelSave(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_SAVE, handler -> ((LCSingleSaveHandler) handler).save()); - } - - //读取 - public R modelLoad(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LOAD, handler -> ((LCSingleLoadHandler) handler).load()); - } - - //读取 - public R modelAdd(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_ADD, handler -> ((LCSingleLoadHandler) handler).add()); - } - - //删除 - public R modelDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCSingleDelHandler) handler).del()); - } - - //列表数据 - public R modelList(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCSingleLoadHandler) handler).list()); - } - - //列表总记录数及合计栏 - public R modelListTotal(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_LIST, handler -> ((LCSingleLoadHandler) handler).getTotal()); - } +public class LCSingleService extends ModelService { } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java index 1aa545a..ec7d13e 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeSaveHandler.java @@ -1,16 +1,16 @@ package cc.smtweb.system.bpm.web.sys.base.billType; import cc.smtweb.framework.core.exception.BizException; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; import org.apache.commons.lang3.StringUtils; /** * Created by Akmm at 2022-08-25 19:11 */ -public class BillTypeSaveHandler extends LCSingleSaveHandler { +public class BillTypeSaveHandler extends ModelSaveHandler { @Override - protected void checkBean(BillType bean) { - super.checkBean(bean); + protected void checkValid() { + super.checkValid(); if (StringUtils.isEmpty(bean.getCode())) { throw new BizException("编码不能为空!"); } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java index d74b3d7..c278ecc 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/sys/base/billType/BillTypeService.java @@ -3,7 +3,7 @@ package cc.smtweb.system.bpm.web.sys.base.billType; import cc.smtweb.framework.core.annotation.SwService; import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.mvc.service.DefaultComboHandler; -import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService; /** @@ -19,7 +19,7 @@ public class BillTypeService extends LCSingleService { } @Override - protected LCSingleSaveHandler getSaveHandler() { + protected ModelSaveHandler getSaveHandler() { return new BillTypeSaveHandler(); } } From 2ff242165d755716723d53612e6647eb29002282 Mon Sep 17 00:00:00 2001 From: zhenggm Date: Fri, 9 Sep 2022 20:47:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9A=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/listcard/abshandler/ModelDelHandler.java | 3 +- .../listcard/abshandler/ModelLoadHandler.java | 7 ++-- .../listcard/abshandler/ModelSaveHandler.java | 5 ++- .../model/listcard/lclc1/LCLC1DelHandler.java | 36 +++++------------ .../model/listcard/lclc1/LCLC1LoadHandler.java | 30 +++++++-------- .../model/listcard/lclc1/LCLC1SaveHandler.java | 11 +++--- .../engine/model/listcard/lclc1/LCLC1Service.java | 45 ++++++++++------------ .../cc/smtweb/framework/core/common/SwConsts.java | 2 +- 8 files changed, 61 insertions(+), 78 deletions(-) diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java index cdcb695..57f38d3 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java @@ -18,6 +18,7 @@ import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler; * 删除操作 */ public class ModelDelHandler extends AbstractDynPageHandler { + protected String cardDsName = ModelHelper.DATASET_NAME_CARD; /** * 删除指定数据集,入参{pageId, dataset, id} * @@ -27,7 +28,7 @@ public class ModelDelHandler extends AbstractDynPageHandler { long id = params.readLong("id"); if (id == 0L) throw new BizException("没有收到待删除记录Id(" + id + ")!"); //数据集 - PageDataset pageDataSet = findCardDataset(ModelHelper.DATASET_NAME_CARD); + PageDataset pageDataSet = findCardDataset(cardDsName); checkBean(pageDataSet, id); diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java index a260707..e184105 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java @@ -18,11 +18,12 @@ import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; */ public class ModelLoadHandler extends AbstractDynPageHandler { protected T bean; + protected String cardDsName = ModelHelper.DATASET_NAME_CARD; //新增卡片操作,初始化定义的数据集 public R add() { SwMap ret = new SwMap(); - bean = addBean(ret, ModelHelper.DATASET_NAME_CARD); + bean = addBean(ret, cardDsName); afterAdd(ret); return R.success(ret); } @@ -57,9 +58,9 @@ public class ModelLoadHandler extends AbstractDynPageHa //从数据库加载bean,并设到返回值 protected void load(SwMap ret, SwMap filter) { - PageDataset cardDataset = findCardDataset(ModelHelper.DATASET_NAME_CARD); + PageDataset cardDataset = findCardDataset(cardDsName); bean = provider.loadBean(cardDataset, filter.readLong(SwConsts.NAME_ID)); - ret.put(ModelHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); + ret.put(cardDsName, DynRetBean.createBean(bean)); } //给子类使用的工具方法:根据数据集配置,读取bean,并加到返回值 diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java index 2a89aa0..407e9f9 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java @@ -33,6 +33,7 @@ import java.util.Map; public class ModelSaveHandler extends AbstractDynPageHandler { private Map> mapTreeBean = new HashMap<>(); protected T bean; + protected String cardDsName = ModelHelper.DATASET_NAME_CARD; /** * 保存指定数据集操作,入参:{pageId,dataset:"", data:{form:{},list: {total:0,rows:[]}}, filter:{}} @@ -62,7 +63,7 @@ public class ModelSaveHandler extends AbstractDynPageHa } }); bean.removeStatus(); - SwMap ret = ModelHelper.buildRetData(ModelHelper.DATASET_NAME_CARD, bean.getData()); + SwMap ret = ModelHelper.buildRetData(cardDsName, bean.getData()); afterSave(ret); return R.success(ret); } @@ -79,7 +80,7 @@ public class ModelSaveHandler extends AbstractDynPageHa */ protected void readFromPage(SwMap pageData, SwMap filter) { //读取待保存的bean - bean = readBeanFromPage(ModelHelper.DATASET_NAME_CARD, pageData, filter); + bean = readBeanFromPage(cardDsName, pageData, filter); } //给子类使用的工具方法:从页面读取一个bean diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java index a25ad52..137f34e 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java @@ -1,32 +1,24 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.lclc1; import cc.smtweb.framework.core.common.R; +import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsDelHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelDelHandler; /** * @Author:lip * @Date : 2022/9/2 11:44 */ -public class LCLC1DelHandler extends AbsDelHandler { +public class LCLC1DelHandler extends ModelDelHandler { /** * 左列表删除 * * @return */ - public R lLDel() { - doDel(LCLC1Define.dsLList); - return R.success(); - } - - /** - * 左卡片删除 - * - * @return - */ - public R lCDel() { - doDel(LCLC1Define.dsLCard); - return R.success(); + public R lDel() { + cardDsName = LCLC1Define.dsLCard; + return super.del(); } /** @@ -34,18 +26,8 @@ public class LCLC1DelHandler extends AbsDelHandler { * * @return */ - public R rLDel() { - doDel(LCLC1Define.dsRList); - return R.success(); - } - - /** - * 右卡片删除 - * - * @return - */ - public R rCDel() { - doDel(LCLC1Define.dsRCard); - return R.success(); + public R rDel() { + cardDsName = LCLC1Define.dsRCard; + return super.del(); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java index 787b912..5a47186 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java @@ -2,23 +2,25 @@ package cc.smtweb.system.bpm.web.engine.model.listcard.lclc1; import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.common.SwMap; +import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsLoadHandler; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelLoadHandler; /** * @Author:lip * @Date : 2022/9/2 11:44 */ -public class LCLC1LoadHandler extends AbsLoadHandler { +public class LCLC1LoadHandler extends ModelLoadHandler { /** * 左表新增 * * @return */ public R lAdd() { - SwMap data = doAdd(LCLC1Define.dsLCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, data)); + cardDsName = LCLC1Define.dsLCard; + return super.add(); } /** @@ -27,8 +29,8 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R rAdd() { - SwMap data = doAdd(LCLC1Define.dsRCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, data)); + cardDsName = LCLC1Define.dsRCard; + return super.add(); } /** @@ -37,8 +39,8 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R lLoad() { - SwMap bean = doLoadCard(LCLC1Define.dsLCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, bean)); + cardDsName = LCLC1Define.dsLCard; + return super.load(); } /** @@ -47,8 +49,8 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R rLoad() { - SwMap bean = doLoadCard(LCLC1Define.dsRCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, bean)); + cardDsName = LCLC1Define.dsRCard; + return super.load(); } /** @@ -57,8 +59,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R lList() { - DynRetBean list = doList(LCLC1Define.dsLList); - return R.success(list); + return super.list(LCLC1Define.dsLCard); } /** @@ -67,8 +68,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R rList() { - DynRetBean list = doList(LCLC1Define.dsRList); - return R.success(list); + return super.list(LCLC1Define.dsRCard); } /** @@ -77,7 +77,7 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R getLTotal() { - return doTotal(LCLC1Define.dsLList); + return super.getTotal(LCLC1Define.dsLList); } /** @@ -86,6 +86,6 @@ public class LCLC1LoadHandler extends AbsLoadHandler { * @return */ public R getRTotal() { - return doTotal(LCLC1Define.dsRList); + return super.getTotal(LCLC1Define.dsRList); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java index 457330d..2e7f6cc 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java @@ -4,20 +4,21 @@ import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.db.impl.DefaultEntity; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.AbsSaveHandler; import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelHelper; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; /** * @Author:lip * @Date : 2022/9/2 11:44 */ -public class LCLC1SaveHandler extends AbsSaveHandler { +public class LCLC1SaveHandler extends ModelSaveHandler { /** * 左表保存 * * @return */ public R lSave() { - DefaultEntity bean = doSave(LCLC1Define.dsLCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsLCard, bean.getData())); + cardDsName = LCLC1Define.dsLCard; + return super.save(); } /** @@ -26,7 +27,7 @@ public class LCLC1SaveHandler extends AbsSaveHandler { * @return */ public R rSave() { - DefaultEntity bean = doSave(LCLC1Define.dsRCard); - return R.success(ModelHelper.buildRetData(LCLC1Define.dsRCard, bean.getData())); + cardDsName = LCLC1Define.dsRCard; + return super.save(); } } diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java index 1df7f21..4b4ed97 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java @@ -7,33 +7,30 @@ import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.mvc.service.AbstractHandler; import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelDelHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelLoadHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelSaveHandler; +import cc.smtweb.system.bpm.web.engine.model.listcard.abshandler.ModelService; /** * @Author:lip * @Date : 2022/9/2 11:34 */ @SwService -public class LCLC1Service extends DynPageService { - protected final static String TYPE_MODEL_LIST = "modelList"; - protected final static String TYPE_MODEL_ADD = "modelAdd"; - protected final static String TYPE_MODEL_LOAD = "modelLoad"; - protected final static String TYPE_MODEL_SAVE = "modelSave"; - protected final static String TYPE_MODEL_DEL = "modelDel"; - - // +public class LCLC1Service extends ModelService { @Override - protected AbstractHandler createHandler(String type) { - switch (type) { - case TYPE_MODEL_LIST: - case TYPE_MODEL_LOAD: - case TYPE_MODEL_ADD: - return new LCLC1LoadHandler(); - case TYPE_MODEL_SAVE: - return new LCLC1SaveHandler(); - case TYPE_MODEL_DEL: - return new LCLC1DelHandler(); - } - return super.createHandler(type); + protected ModelSaveHandler getSaveHandler() { + return new LCLC1SaveHandler(); + } + + @Override + protected ModelLoadHandler getLoadHandler() { + return new LCLC1LoadHandler(); + } + + @Override + protected ModelDelHandler getDelHandler() { + return new LCLC1DelHandler(); } //保存 @@ -53,12 +50,12 @@ public class LCLC1Service extends DynPageService { //删除 public R modelLLDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).lLDel()); + return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).lDel()); } //删除 public R modelLCDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).lCDel()); + return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).lDel()); } //列表数据 @@ -89,12 +86,12 @@ public class LCLC1Service extends DynPageService { //删除 public R modelRLDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).rLDel()); + return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).rDel()); } //删除 public R modelRCDel(@SwBody SwMap params, UserSession us) { - return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).rCDel()); + return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCLC1DelHandler) handler).rDel()); } //列表数据 diff --git a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java index 891fe09..a4149f5 100644 --- a/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java +++ b/smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java @@ -6,7 +6,7 @@ package cc.smtweb.framework.core.common; public interface SwConsts { class SysParam { //开发调试模式 - public static boolean SYS_DEBUG = false; + public static boolean SYS_DEBUG = true; //系统启动完成 public static boolean SYS_STARTED = false; //运行的项目,多个用半角逗号分隔