Ver a proveniência

系统:模型代码调整

4.0
郑根木 há 2 anos
ascendente
cometimento
2ff242165d
8 ficheiros alterados com 61 adições e 78 eliminações
  1. +2
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java
  2. +4
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java
  3. +3
    -2
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java
  4. +9
    -27
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java
  5. +15
    -15
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java
  6. +6
    -5
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java
  7. +21
    -24
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java
  8. +1
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java

+ 2
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelDelHandler.java Ver ficheiro

@@ -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);



+ 4
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelLoadHandler.java Ver ficheiro

@@ -18,11 +18,12 @@ import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
*/
public class ModelLoadHandler<T extends DefaultEntity> 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<T extends DefaultEntity> 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,并加到返回值


+ 3
- 2
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/abshandler/ModelSaveHandler.java Ver ficheiro

@@ -33,6 +33,7 @@ import java.util.Map;
public class ModelSaveHandler<T extends DefaultEntity> extends AbstractDynPageHandler {
private Map<String, List<? extends DefaultEntity>> 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<T extends DefaultEntity> 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<T extends DefaultEntity> extends AbstractDynPageHa
*/
protected void readFromPage(SwMap pageData, SwMap filter) {
//读取待保存的bean
bean = readBeanFromPage(ModelHelper.DATASET_NAME_CARD, pageData, filter);
bean = readBeanFromPage(cardDsName, pageData, filter);
}

//给子类使用的工具方法:从页面读取一个bean


+ 9
- 27
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1DelHandler.java Ver ficheiro

@@ -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();
}
}

+ 15
- 15
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1LoadHandler.java Ver ficheiro

@@ -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<DefaultEntity> {
/**
* 左表新增
*
* @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);
}
}

+ 6
- 5
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1SaveHandler.java Ver ficheiro

@@ -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<DefaultEntity> {
/**
* 左表保存
*
* @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();
}
}

+ 21
- 24
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/lclc1/LCLC1Service.java Ver ficheiro

@@ -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());
}

//列表数据


+ 1
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/common/SwConsts.java Ver ficheiro

@@ -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;
//运行的项目,多个用半角逗号分隔


Carregando…
Cancelar
Guardar