Просмотр исходного кода

对外暴露覆盖json_data更新方法

wangming 1 год назад
Родитель
Сommit
4744de304f

+ 15 - 0
luckysheet/src/main/java/com/xc/luckysheet/controller/JfGridFileController.java

@@ -5,6 +5,7 @@ import com.xc.common.api.ResponseVO;
 import com.xc.common.utils.JsonUtil;
 import com.xc.luckysheet.db.server.JfGridFileGetService;
 import com.xc.luckysheet.db.server.JfGridUpdateService;
+import com.xc.luckysheet.dto.CoverageUpdateJsonDataRequest;
 import com.xc.luckysheet.entity.LuckySheetGridModel;
 import com.xc.luckysheet.entity.enummodel.OperationTypeEnum;
 import com.xc.luckysheet.entity.project.ProjectSummaryParamExcelDto;
@@ -166,6 +167,20 @@ public class JfGridFileController {
         return responseVO;
     }
 
+    /**
+     * 覆盖更新json
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "覆盖更新json",notes = "覆盖更新json")
+    @PostMapping("/updateCoverageJsonData")
+    public ResponseVO updateCoverageJsonData(@RequestBody CoverageUpdateJsonDataRequest req) {
+        jfGridUpdateService.updateCoverageJsonData(req);
+        ResponseVO responseVO = ResponseVO.successInstance();
+        responseVO.setCode("200");
+        return responseVO;
+    }
+
     /**
      * 文档权限的检查
      * @param request

+ 17 - 0
luckysheet/src/main/java/com/xc/luckysheet/db/server/JfGridUpdateService.java

@@ -11,6 +11,7 @@ import com.xc.luckysheet.db.IRecordDataInsertHandle;
 import com.xc.luckysheet.db.IRecordDataUpdataHandle;
 import com.xc.luckysheet.db.IRecordDelHandle;
 import com.xc.luckysheet.db.IRecordSelectHandle;
+import com.xc.luckysheet.dto.CoverageUpdateJsonDataRequest;
 import com.xc.luckysheet.entity.ConfigMergeModel;
 import com.xc.luckysheet.entity.GridRecordDataModel;
 import com.xc.luckysheet.entity.LuckySheetGridModel;
@@ -93,6 +94,22 @@ public class JfGridUpdateService {
         return recordDataInsertHandle.InsertIntoBatch(dbObject);
     }
 
+    /**
+     * 覆盖更新参数
+     *
+     * @param req
+     */
+    public void updateCoverageJsonData(CoverageUpdateJsonDataRequest req) {
+
+        if(req.getValue() == null) {
+            return ;
+        }
+
+        recordDataUpdataHandle.updateCellDataListValue(req.getAndWhereObj()
+                , req.getKey(), req.getPosition()
+                , req.getValue().toString(SerializerFeature.WriteMapNullValue));
+    }
+
     /**
      * 生成luckysheet excel
      *

+ 38 - 0
luckysheet/src/main/java/com/xc/luckysheet/dto/CoverageUpdateJsonDataRequest.java

@@ -0,0 +1,38 @@
+package com.xc.luckysheet.dto;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.*;
+
+/**
+ * 覆盖更新参数
+ */
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class CoverageUpdateJsonDataRequest {
+
+    /**
+     * where条件,and连接
+     *
+     */
+    private JSONObject andWhereObj;
+
+    /**
+     * 路径
+     */
+    private String key;
+
+    /**
+     * 更新数组时使用
+     */
+    private String position;
+
+    /**
+     * 需要修改的值
+     *
+     */
+    private JSONObject value;
+
+}