@@ -7,7 +7,6 @@ import java.util.Map; | |||||
//一个sql及其参数,具名参数 | //一个sql及其参数,具名参数 | ||||
public class SqlNamedPara extends SqlPara { | public class SqlNamedPara extends SqlPara { | ||||
public String sql = ""; | |||||
public SwMap mapParas = new SwMap(); | public SwMap mapParas = new SwMap(); | ||||
//字段别名 | //字段别名 | ||||
public Map<String, String> mapFieldAlias = new HashMap<>(); | public Map<String, String> mapFieldAlias = new HashMap<>(); | ||||
@@ -159,6 +159,7 @@ public class DynPageHelper { | |||||
*/ | */ | ||||
private static String buildDynCondSql(PageDataset dataSet, PageDatasetDynCond dynCond, Map<String, Object> params, SwMap args, Set<String> setFixedFilter) { | private static String buildDynCondSql(PageDataset dataSet, PageDatasetDynCond dynCond, Map<String, Object> params, SwMap args, Set<String> setFixedFilter) { | ||||
if (dynCond.isCondOpt()) {//是and/or | if (dynCond.isCondOpt()) {//是and/or | ||||
if (dynCond.children == null || dynCond.children.isEmpty()) return ""; | |||||
StringBuilder sql = new StringBuilder(256); | StringBuilder sql = new StringBuilder(256); | ||||
boolean b = false; | boolean b = false; | ||||
//递归调用 | //递归调用 | ||||
@@ -52,9 +52,9 @@ public class DynPageListHandler extends AbstractListHandler { | |||||
List<SwMap> list; | List<SwMap> list; | ||||
SqlNamedPara sp = (SqlNamedPara)sqlPara; | SqlNamedPara sp = (SqlNamedPara)sqlPara; | ||||
if (sqlPara.page > 0 && sqlPara.rows > 0) { | if (sqlPara.page > 0 && sqlPara.rows > 0) { | ||||
list = DbEngine.getInstance().pagedQueryN(sqlPara.sql, SwMap.class, (sqlPara.page - 1) * sqlPara.rows, sqlPara.rows, sp.mapParas); | |||||
list = DbEngine.getInstance().pagedQueryN(sql, SwMap.class, (sqlPara.page - 1) * sqlPara.rows, sqlPara.rows, sp.mapParas); | |||||
} else { | } else { | ||||
list = DbEngine.getInstance().queryN(sqlPara.sql, sp.mapParas, SwMap.class); | |||||
list = DbEngine.getInstance().queryN(sql, sp.mapParas, SwMap.class); | |||||
} | } | ||||
ModelTable masterTable = ModelTableCache.getInstance().get(pageDataSet.masterTable); | ModelTable masterTable = ModelTableCache.getInstance().get(pageDataSet.masterTable); | ||||
EntityHelper.loadBeanLink(masterTable.getName(), list, sp.mapFieldAlias); | EntityHelper.loadBeanLink(masterTable.getName(), list, sp.mapFieldAlias); | ||||
@@ -30,7 +30,9 @@ public class DynPageLoadHandler extends AbstractDynPageHandler { | |||||
//列表工具类 | //列表工具类 | ||||
public DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { | public DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { | ||||
return new DynPageListHandler(pageId, filter, pageDataSet); | |||||
DynPageListHandler listHandler = new DynPageListHandler(pageId, filter, pageDataSet); | |||||
listHandler.init(params, us); | |||||
return listHandler; | |||||
} | } | ||||
//新增操作,初始化定义的数据集 | //新增操作,初始化定义的数据集 | ||||
@@ -71,7 +73,7 @@ public class DynPageLoadHandler extends AbstractDynPageHandler { | |||||
public R loadOne() { | public R loadOne() { | ||||
//过滤条件 | //过滤条件 | ||||
SwMap filter = (SwMap) params.get("filter"); | |||||
SwMap filter = params.readMap("filter"); | |||||
//对应的数据集定义 | //对应的数据集定义 | ||||
PageDataset pageDataSet = readParamDs(); | PageDataset pageDataSet = readParamDs(); | ||||
@@ -96,7 +98,7 @@ public class DynPageLoadHandler extends AbstractDynPageHandler { | |||||
//数据集 | //数据集 | ||||
PageDataset pageDataSet = readParamDs(); | PageDataset pageDataSet = readParamDs(); | ||||
//过滤条件 | //过滤条件 | ||||
SwMap filter = (SwMap) params.get("filter"); | |||||
SwMap filter = params.readMap("filter"); | |||||
return getListWorker(filter, pageDataSet).getTotal(); | return getListWorker(filter, pageDataSet).getTotal(); | ||||
} | } | ||||
@@ -36,7 +36,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler { | |||||
public R saveOne() { | public R saveOne() { | ||||
//数据集 | //数据集 | ||||
String dbName = params.readString("dataset"); | String dbName = params.readString("dataset"); | ||||
SwMap filter = (SwMap) params.get("filter"); | |||||
SwMap filter = params.readMap("filter"); | |||||
//待保存数据 | //待保存数据 | ||||
SwMap data = params.readMap("data"); | SwMap data = params.readMap("data"); | ||||
if (data == null) throw new SwException("没有收到待保存的的数据:" + dbName + "!"); | if (data == null) throw new SwException("没有收到待保存的的数据:" + dbName + "!"); | ||||
@@ -77,7 +77,7 @@ public class DynPageSaveHandler extends AbstractDynPageHandler { | |||||
public R saveAll() { | public R saveAll() { | ||||
SwMap data = params.readMap("data"); | SwMap data = params.readMap("data"); | ||||
if (data == null) throw new SwException("没有收到待保存的的数据!"); | if (data == null) throw new SwException("没有收到待保存的的数据!"); | ||||
SwMap filter = (SwMap) params.get("filter"); | |||||
SwMap filter = params.readMap("filter"); | |||||
Map<String, DefaultEntity> map = new LinkedHashMap<>(); | Map<String, DefaultEntity> map = new LinkedHashMap<>(); | ||||
for (PageDataset pageDataSet : datasets.list) { | for (PageDataset pageDataSet : datasets.list) { | ||||
@@ -2,11 +2,13 @@ package cc.smtweb.system.bpm.web.engine.dynPage; | |||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; | ||||
import cc.smtweb.framework.core.mvc.service.SwListData; | import cc.smtweb.framework.core.mvc.service.SwListData; | ||||
import lombok.Data; | |||||
/** | /** | ||||
* Created by Akmm at 2022/4/21 19:26 | * Created by Akmm at 2022/4/21 19:26 | ||||
* 动态页面加载 | * 动态页面加载 | ||||
*/ | */ | ||||
@Data | |||||
public class DynRetBean { | public class DynRetBean { | ||||
//单个表单 | //单个表单 | ||||
private SwMap form = null; | private SwMap form = null; | ||||