save<T extends IModel> static method

Future<ResponseStatus> save<T extends IModel>(
  1. String formId,
  2. T model, {
  3. bool isDeleteEntry = true,
  4. bool isAutoSubmitAndAudit = false,
  5. List<String>? needUpDateFields,
  6. List<String>? needReturnFields,
})

Directly save json data.

T The type of a model, which should implement IModel to implement the toJson method. formId The formId of the bill or basedata. model Data. isDeleteEntry Before saving, it is wheter delete the entry. isAutoSubmitAndAudit Whehter to automatic audit.

@return A response result by parsing json.

Implementation

static Future<ResponseStatus> save<T extends IModel>(
  String formId, T model,
  {
    bool isDeleteEntry=true,
    bool isAutoSubmitAndAudit=false,
    List<String>? needUpDateFields,
    List<String>? needReturnFields,
  }) async {
  var resp = await K3Client.getInstance().operate(
    SaveParam.builder()
      .formId(formId)
      .isDeleteEntry(isDeleteEntry)
      .isAutoSubmitAndAudit(isAutoSubmitAndAudit)
      .needUpDateFields(needUpDateFields)
      .needReturnFields(needReturnFields)
      .model(model.toJson())
      .build()
  );
  return ResponseStatus.fromJson(resp);
}