Java web开发如何同时提交入多条信息

https://img1.mukewang.com/5bb5fd190001440409100231.jpg

用的是Springmvc+mybatis 多条数据同时插入如何做到 数据如何绑定

GCT1015
浏览 627回答 1
1回答

Smart猫小萌

@ResourceMapping("queryRackLists")public RpcResult<Rack> queryRackLists(@JsonParam("rackOlds")List<RackVo> rackList, ErrorContext error) {&nbsp; &nbsp; RpcResult<Rack> dataResult = new RpcResult<Rack>();&nbsp; &nbsp; try {&nbsp; &nbsp; &nbsp; &nbsp; List<Rack> list = rackBo.getRackList(rackList);&nbsp; &nbsp; &nbsp; &nbsp; dataResult.setDataList(list);&nbsp; &nbsp; } catch (Exception e) {&nbsp; &nbsp; &nbsp; &nbsp; logger.error("queryRackLists rackList={}, err : ", JSON.toJSONString(rackList), e);&nbsp; &nbsp; &nbsp; &nbsp; dataResult.setSuccess(false);&nbsp; &nbsp; &nbsp; &nbsp; if (e instanceof ServiceException) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addError(error, e);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataResult.setInfo(e.getMessage());&nbsp; &nbsp; &nbsp; &nbsp; } else {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addError(error, ErrorCode.Query_Error);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataResult.setInfo(ErrorCode.Query_Error.getMsg());&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }&nbsp; &nbsp; return dataResult;}类似于这种,传入JSONArray,用list来接收。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript