自定义表头参数接收

This commit is contained in:
zhn
2023-01-09 09:18:37 +08:00
parent 43af0f8c23
commit 91a3c16956
@@ -1,9 +1,13 @@
package com.jero.modules.head.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.head.entity.HeadCustomEO;
@@ -76,13 +80,21 @@ public class HeadCustomEOController extends JeroController<HeadCustomEO, IHeadCu
/**
* 添加
*
* @param headCustomEOList
* @param jsonObject
* @return
*/
@AutoLog(value = "自定义表头-添加")
@ApiOperation(value="自定义表头-添加", notes="自定义表头-添加")
@PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody List<HeadCustomEO> headCustomEOList) {
public Result<?> add(@RequestBody JSONObject jsonObject) {
JSONArray headCustomEOArr = jsonObject.getJSONArray("headCustomEOList");
List<HeadCustomEO> headCustomEOList = new ArrayList<>();
HeadCustomEO headCustomEO = null;
for (Object headCustom : headCustomEOArr) {
headCustomEO = JSONObject.parseObject(JSONObject.toJSONString(headCustom),HeadCustomEO.class);
headCustomEOList.add(headCustomEO);
}
headCustomEOService.add(headCustomEOList);
return Result.OK("添加成功!");
}