|
@@ -7,8 +7,10 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.modules.activiti.entity.ActNode;
|
|
|
import org.jeecg.modules.activiti.entity.TbTableInfo;
|
|
|
import org.jeecg.modules.activiti.service.ITbTableInfoService;
|
|
|
+import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -24,6 +26,8 @@ import java.util.Map;
|
|
|
public class TbTableInfoController {
|
|
|
@Autowired
|
|
|
private ITbTableInfoService tbTableInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ActNodeServiceImpl actNodeService;
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/list")
|
|
@@ -89,15 +93,37 @@ public class TbTableInfoController {
|
|
|
* @desc 条件查询
|
|
|
*/
|
|
|
@RequestMapping("/query")
|
|
|
- public Result<Object> query(String businessTable){
|
|
|
- QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
|
|
|
-
|
|
|
+ public Result<Object> query(String businessTable,String taskNodeId){
|
|
|
+ boolean isSave=false;
|
|
|
+ QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
|
|
|
+ //查询任务节点是否关联表
|
|
|
+ List<ActNode> actNodeList= actNodeService.list(new QueryWrapper<ActNode>().eq("node_id",taskNodeId));
|
|
|
+ if(actNodeList!=null&&actNodeList.size()>0&&StringUtils.isNotBlank(actNodeList.get(0).getTbTableInfoId())){
|
|
|
+ //如果任务节点id不为空则根据任务节点id查询
|
|
|
+ queryWrapper.eq("task_node_id",taskNodeId);
|
|
|
+ isSave=true;//分流程节点填写不同内容的表单 强制给到前台解除保存按钮禁用状态
|
|
|
+ }else{//没有关联表则不把流程节点id当作查询条件
|
|
|
+ queryWrapper.and(qw->qw.eq("is_initial","1").or().isNull("is_initial"));
|
|
|
+ }
|
|
|
TbTableInfo tableInfo = tbTableInfoService.getOne(queryWrapper);
|
|
|
if(tableInfo==null) {
|
|
|
return Result.error("未找到实体");
|
|
|
}
|
|
|
Object obj = JSONObject.parseObject(tableInfo.getContent());
|
|
|
tableInfo.setJsonContent(obj);
|
|
|
+ if(isSave){
|
|
|
+ tableInfo.setIsSave(isSave);
|
|
|
+ }
|
|
|
+ //获取当前表名称所有的表单数据
|
|
|
+ QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
|
|
|
+ List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
|
|
|
+ if(tbTableInfoList!=null){
|
|
|
+ for(TbTableInfo t:tbTableInfoList){
|
|
|
+ Object obj2 = JSONObject.parseObject(t.getContent());
|
|
|
+ t.setJsonContent(obj2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tableInfo.setTbTableInfoList(tbTableInfoList);
|
|
|
return Result.ok(tableInfo);
|
|
|
}
|
|
|
|