车型项目库法规清单关联平台件表-批量添加
This commit is contained in:
+12
-3
@@ -1,5 +1,7 @@
|
||||
package com.jero.modules.project.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -27,6 +29,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -96,14 +99,20 @@ public class LawsInventoryPlatformEOController extends JeroController<LawsInvent
|
||||
/**
|
||||
* 批量添加
|
||||
*
|
||||
* @param lawsInventoryPlatformEOList
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "车型项目库法规清单关联平台件表-批量添加")
|
||||
@ApiOperation(value="车型项目库法规清单关联平台件表-批量添加", notes="车型项目库法规清单关联平台件表-批量添加")
|
||||
@PostMapping(value = "/addBatch")
|
||||
public Result<?> addBatch(@Validated @RequestBody List<LawsInventoryPlatformEO> lawsInventoryPlatformEOList) {
|
||||
lawsInventoryPlatformEOService.addBatch(lawsInventoryPlatformEOList);
|
||||
public Result<?> addBatch(@Validated @RequestBody JSONObject json) {
|
||||
JSONArray dataList = json.getJSONArray("list");
|
||||
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
|
||||
for (Object data : dataList) {
|
||||
LawsInventoryPlatformEO inventoryPlatformEO = JSONObject.parseObject(JSONObject.toJSONString(data), LawsInventoryPlatformEO.class);
|
||||
lawsInventoryPlatformEOS.add(inventoryPlatformEO);
|
||||
}
|
||||
lawsInventoryPlatformEOService.addBatch(lawsInventoryPlatformEOS);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user