Selaa lähdekoodia

修改模板和handler

4.0
lip 2 vuotta sitten
vanhempi
commit
e9926de544
5 muutettua tiedostoa jossa 120 lisäystä ja 84 poistoa
  1. +2
    -79
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsLoadHandler.java
  2. +89
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java
  3. +27
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java
  4. +1
    -1
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl
  5. +1
    -1
      smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl

+ 2
- 79
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/mastersub/LCMsLoadHandler.java Näytä tiedosto

@@ -1,88 +1,11 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.mastersub;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
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.DynPageHelper;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;
import org.springframework.util.Assert;
import cc.smtweb.system.bpm.web.engine.model.listcard.normal.LCNormalLoadHandler;

/**
* @Author:lip
* @Date : 2022/8/28 21:44
*/
public class LCMsLoadHandler extends AbstractDynPageHandler {
//新增卡片操作,初始化定义的数据集
public R add() {
String dataSet = params.readString("dataset");
PageDataset addDataSet = this.datasets.findByName(dataSet);
Assert.notNull(addDataSet, "未获取到数据集:" + dataSet);
SwMap data;
//懒加载,给个空对象
if (addDataSet.lazy) {
data = new SwMap();
} else {
data = DynPageHelper.createBean(addDataSet);
}
public class LCMsLoadHandler extends LCNormalLoadHandler {

return R.success(LCSingleHelper.buildRetData(addDataSet.name, data));
}

public R load() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset loadDataSet = this.datasets.findByName(dataSet);
Assert.notNull(loadDataSet, "未获取到数据集:" + dataSet);

SwMap data = provider.loadData(filter, loadDataSet);

return R.success(LCSingleHelper.buildRetData(loadDataSet.name, data));
}

private 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");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

DynRetBean bean = DynRetBean.createList(getListWorker(filter, listDataSet).buildListData());

return R.success(bean);
}

/**
* 计算分页数据
*
* @return
*/
public R getTotal() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

return getListWorker(filter, listDataSet).getTotal();
}
}

+ 89
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalLoadHandler.java Näytä tiedosto

@@ -0,0 +1,89 @@
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.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageHelper;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynRetBean;
import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleHelper;
import org.springframework.util.Assert;

/**
* @Author:lip
* @Date : 2022/8/29 14:37
*/
public class LCNormalLoadHandler extends AbstractDynPageHandler {

//新增卡片操作,初始化定义的数据集
public R add() {
String dataSet = params.readString("dataset");
PageDataset addDataSet = this.datasets.findByName(dataSet);
Assert.notNull(addDataSet, "未获取到数据集:" + dataSet);
SwMap data;
//懒加载,给个空对象
if (addDataSet.lazy) {
data = new SwMap();
} else {
data = DynPageHelper.createBean(addDataSet);
}

return R.success(LCSingleHelper.buildRetData(addDataSet.name, data));
}

public R load() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset loadDataSet = this.datasets.findByName(dataSet);
Assert.notNull(loadDataSet, "未获取到数据集:" + dataSet);

SwMap data = provider.loadData(filter, loadDataSet);

return R.success(LCSingleHelper.buildRetData(loadDataSet.name, data));
}

private 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");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

DynRetBean bean = DynRetBean.createList(getListWorker(filter, listDataSet).buildListData());

return R.success(bean);
}

/**
* 计算分页数据
*
* @return
*/
public R getTotal() {
//过滤条件
SwMap filter = params.readMap("filter");

//对应的数据集定义
String dataSet = params.readString("dataset");
PageDataset listDataSet = this.datasets.findByName(dataSet);
Assert.notNull(listDataSet, "未获取到数据集:" + dataSet);

return getListWorker(filter, listDataSet).getTotal();
}
}

+ 27
- 3
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/normal/LCNormalService.java Näytä tiedosto

@@ -14,11 +14,15 @@ import cc.smtweb.system.bpm.web.engine.model.listcard.single.LCSingleService;
*/
@SwService
public class LCNormalService extends LCSingleService {

@Override
protected AbstractHandler createHandler(String type) {
if (type.equals(TYPE_MODEL_DEL)){
return new LCNormalDelHandler();
switch (type) {
case TYPE_MODEL_LIST:
case TYPE_MODEL_LOAD:
case TYPE_MODEL_ADD:
return new LCNormalLoadHandler();
case TYPE_MODEL_DEL:
return new LCNormalDelHandler();
}
return super.createHandler(type);
}
@@ -27,4 +31,24 @@ public class LCNormalService extends LCSingleService {
public R modelDel(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_MODEL_DEL, handler -> ((LCNormalDelHandler)handler).del());
}

//读取
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());
}
}

+ 1
- 1
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_ms.ftl Näytä tiedosto

@@ -73,7 +73,7 @@
"props": {
"label": "返回",
"leftIcon": "return",
"action": "button:return"
"action": "button:backList"
},
"id": "${newId()}",
"events": {}


+ 1
- 1
smtweb-framework/bpm/src/main/resources/static/template/default/model_card_normal.ftl Näytä tiedosto

@@ -64,7 +64,7 @@
"props": {
"label": "返回",
"leftIcon": "return",
"action": "button:return"
"action": "button:backList"
},
"id": "${newId()}",
"events": {}


Ladataan…
Peruuta
Tallenna