|
@@ -0,0 +1,58 @@
|
|
|
+package org.jeecg.modules.activiti.web;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.modules.activiti.entity.TbTableInfo;
|
|
|
+import org.jeecg.modules.activiti.service.ITbTableInfoService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tbTableInfo")
|
|
|
+@Slf4j
|
|
|
+@Transactional
|
|
|
+public class TbTableInfoController {
|
|
|
+ @Autowired
|
|
|
+ private ITbTableInfoService tbTableInfoService;
|
|
|
+
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/list")
|
|
|
+ public Result<Object> list(){
|
|
|
+ List<TbTableInfo> list = tbTableInfoService.list();
|
|
|
+ for(TbTableInfo t : list){
|
|
|
+ Object obj = JSONObject.parseObject(t.getContent());
|
|
|
+ t.setJsonContent(obj);
|
|
|
+ t.setRouteName("外部表单test_demo1");
|
|
|
+ }
|
|
|
+ return Result.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc
|
|
|
+ */
|
|
|
+ @PostMapping("/add")
|
|
|
+ public Result<Object> add(@RequestBody TbTableInfo tbTableInfo){
|
|
|
+ TbTableInfo tableInfo = tbTableInfoService.getOne(new QueryWrapper<TbTableInfo>().eq("business_table", tbTableInfo.getBusinessTable()));
|
|
|
+ String jsonContent = JSON.toJSONString(tbTableInfo.getJsonContent());
|
|
|
+ tbTableInfo.setContent(jsonContent);
|
|
|
+ if(tableInfo != null){
|
|
|
+ //修改
|
|
|
+ tbTableInfoService.updateById(tbTableInfo);
|
|
|
+ return Result.ok("修改成功");
|
|
|
+ } else {
|
|
|
+ //新增
|
|
|
+
|
|
|
+ tbTableInfoService.save(tbTableInfo);
|
|
|
+ return Result.ok("新增成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|