procedure TAcptkController.CreateAdvancePayment; var Acptk: TAcptk; Acptks: TObjectList<TAcptk>; begin if Context.Request.QueryStringParam('Batch').ToLower() = 'true' then begin Acptks := Context.Request.BodyAsListOf<TAcptk>; try for Acptk in Acptks do begin //必须先关闭 Acptk.PrimaryKeyIsAutogenerated := False; Acptk.Insert; end; Render201Created('/api/AdvancePayment/' + 'AdvancePayment Create'); finally FreeAndNil(Acptks); end; end else begin Acptk := Context.Request.BodyAs<TAcptk>; try //必须先关闭 Acptk.PrimaryKeyIsAutogenerated := False; Acptk.Insert; Render(201, 'Create Successfully'); finally FreeAndNil(Acptk); end; end; end;
标签:Acptks,Acptk,end,批量,Request,begin,插入,Context,表带 From: https://www.cnblogs.com/redhat588/p/16951970.html