@@ -62,7 +62,13 @@ public class ModelProcService extends AbstractCompService { | |||||
ModelFormHelper.buildFieldInfo(table, field, col); | ModelFormHelper.buildFieldInfo(table, field, col); | ||||
ret.add(col); | ret.add(col); | ||||
} | } | ||||
SwMap col = new SwMap(); | |||||
col.put("name", "selTaskId"); | |||||
col.put("dataType", SwEnum.DataType.ID.value); | |||||
col.put("title", "选中的任务id"); | |||||
col.put("table", table.getId()); | |||||
col.put("table_text", table.getTitle()); | |||||
ret.add(col); | |||||
return R.success(ret); | return R.success(ret); | ||||
} | } | ||||
@@ -318,6 +318,7 @@ public class FlowInstance { | |||||
* 返回页面前的设置 | * 返回页面前的设置 | ||||
*/ | */ | ||||
public void setPageRetExtra(SwMap ret) { | public void setPageRetExtra(SwMap ret) { | ||||
procInst.setSelTaskId(actInst.getId()); | |||||
SwMap extra = ret.computeMapIfAbsent("extra", k -> new SwMap()); | SwMap extra = ret.computeMapIfAbsent("extra", k -> new SwMap()); | ||||
List<Task> listTask = adjustTasks(); | List<Task> listTask = adjustTasks(); | ||||
@@ -232,4 +232,11 @@ public class ProcInst extends DefaultEntity { | |||||
public void setUrl(String pri_url) { | public void setUrl(String pri_url) { | ||||
put("pri_url", pri_url); | put("pri_url", pri_url); | ||||
} | } | ||||
/** | |||||
* 当前选择的任务 | |||||
*/ | |||||
public void setSelTaskId(long selTaskId) { | |||||
put("selTaskId", selTaskId); | |||||
} | |||||
} | } |
@@ -28,9 +28,10 @@ public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoad | |||||
bean.setEntityId(flowInstance.getProcInst().getId()); | bean.setEntityId(flowInstance.getProcInst().getId()); | ||||
ret.put(cardDataset.name, DynRetBean.createBean(bean)); | ret.put(cardDataset.name, DynRetBean.createBean(bean)); | ||||
flowInstance.setPageRetExtra(ret); | |||||
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ||||
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ||||
flowInstance.setPageRetExtra(ret); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -47,9 +48,9 @@ public class FlowSingleLoadHandler<T extends DefaultEntity> extends LCSingleLoad | |||||
//加载流程信息 | //加载流程信息 | ||||
flowInstance = FlowInstance.createById(us, this, id, taskId); | flowInstance = FlowInstance.createById(us, this, id, taskId); | ||||
flowInstance.setPageRetExtra(ret); | |||||
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ||||
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.create(flowInstance.loadComment(), 0))); | ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.create(flowInstance.loadComment(), 0))); | ||||
flowInstance.setPageRetExtra(ret); | |||||
afterLoad(ret, bean); | afterLoad(ret, bean); | ||||
return R.success(ret); | return R.success(ret); | ||||
} | } | ||||
@@ -55,9 +55,9 @@ public class FlowSingleSaveHandler<T extends DefaultEntity> extends LCSingleSave | |||||
@Override | @Override | ||||
protected void afterSave(SwMap ret, T bean) { | protected void afterSave(SwMap ret, T bean) { | ||||
super.afterSave(ret, bean); | super.afterSave(ret, bean); | ||||
flowInstance.setPageRetExtra(ret); | |||||
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ||||
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ||||
flowInstance.setPageRetExtra(ret); | |||||
} | } | ||||
//单据编号,新增保存时调用 | //单据编号,新增保存时调用 | ||||
@@ -34,9 +34,10 @@ public class FlowTransHandler<T extends DefaultEntity> extends AbstractDynPageHa | |||||
private SwMap buildRetData() { | private SwMap buildRetData() { | ||||
SwMap ret = new SwMap(); | SwMap ret = new SwMap(); | ||||
ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); | ret.put(LCSingleHelper.DATASET_NAME_CARD, DynRetBean.createBean(bean)); | ||||
flowInstance.setPageRetExtra(ret); | |||||
ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ret.put(FlowHelper.DATASET_NAME_FLOW, DynRetBean.createBean(flowInstance.getProcInst())); | ||||
ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ret.put(FlowHelper.DATASET_NAME_COMMENT, DynRetBean.createList(SwListData.EMPTY)); | ||||
flowInstance.setPageRetExtra(ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -50,7 +50,7 @@ public class AuthService { | |||||
UserSession userSession = null; | UserSession userSession = null; | ||||
try { | try { | ||||
if ("admin".equals(loginPO.getUsername())) { | if ("admin".equals(loginPO.getUsername())) { | ||||
userSession = new UserSession(1); | |||||
userSession = UserSession.createSys(); | |||||
// user=new User(); | // user=new User(); | ||||
// return new UserSession(1); | // return new UserSession(1); | ||||
} else { | } else { | ||||
@@ -278,23 +278,6 @@ public class DbEngine extends JdbcEngine { | |||||
if (entities == null || entities.isEmpty()) { | if (entities == null || entities.isEmpty()) { | ||||
return null; | return null; | ||||
} | } | ||||
return findDao((Class<T>) entities.get(0).getClass()).batchInsertEntity(entities, null); | |||||
return findDao((Class<T>) entities.get(0).getClass()).batchInsertEntity(entities); | |||||
} | } | ||||
/** | |||||
* 批量插入单行数据 | |||||
* | |||||
* @param entities PO对象列表 | |||||
* @param fields 逗号分隔的字段列表 | |||||
* @param <T> 实体类型 | |||||
* @return 更新数量 | |||||
*/ | |||||
public <T> int[] batchInsertEntity(List<T> entities, String fields) { | |||||
if (entities == null || entities.isEmpty()) { | |||||
return null; | |||||
} | |||||
return findDao((Class<T>) entities.get(0).getClass()).batchInsertEntity(entities, fields); | |||||
} | |||||
} | } |
@@ -139,40 +139,18 @@ public class EntityDao<T> extends AbstractEntityDao<T> { | |||||
* 批量插入单行数据 | * 批量插入单行数据 | ||||
* | * | ||||
* @param entities PO对象列表 | * @param entities PO对象列表 | ||||
* @return 更新数量 | |||||
*/ | |||||
public int[] batchInsertEntity(Collection<T> entities) { | |||||
return batchInsertEntity(entities, null); | |||||
} | |||||
/** | |||||
* 批量插入单行数据 | |||||
* | |||||
* @param entities PO对象列表 | |||||
* @param fields 逗号分隔的字段列表 | * @param fields 逗号分隔的字段列表 | ||||
* @return 更新数量 | * @return 更新数量 | ||||
*/ | */ | ||||
public int[] batchInsertEntity(Collection<T> entities, String fields) { | |||||
public int[] batchInsertEntity(Collection<T> entities) { | |||||
StringBuilder sql = new StringBuilder(); | StringBuilder sql = new StringBuilder(); | ||||
sql.append("insert into ").append(modelTable.getSchemaTableName()).append("("); | sql.append("insert into ").append(modelTable.getSchemaTableName()).append("("); | ||||
List<String> listFields = adjustFields(fields, SwEnum.FieldType.CREATE_TIME.value, SwEnum.FieldType.LAST_TIME.value); | |||||
List<EntityColumn> insertColumns = new ArrayList<>(this.columns.size()); | List<EntityColumn> insertColumns = new ArrayList<>(this.columns.size()); | ||||
if (listFields == null) { | |||||
for (EntityColumn column : this.columns.values()) { | |||||
sql.append(column.getField().getName()).append(","); | |||||
insertColumns.add(column); | |||||
} | |||||
} else { | |||||
for (String name : listFields) { | |||||
EntityColumn column = this.columns.get(name.trim()); | |||||
sql.append(column.getField().getName()).append(","); | |||||
insertColumns.add(column); | |||||
} | |||||
for (EntityColumn column : this.columns.values()) { | |||||
sql.append(column.getField().getName()).append(","); | |||||
insertColumns.add(column); | |||||
} | } | ||||
sql.setCharAt(sql.length() - 1, ')'); | sql.setCharAt(sql.length() - 1, ')'); | ||||