| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import 'package:json_annotation/json_annotation.dart';
- import 'list_result.dart';
- part 'list_response.g.dart';
- /// 统一返回+通用分页 数据结构
- @JsonSerializable(
- genericArgumentFactories: true,
- // fieldRename: FieldRename.snake,
- )
- class BaseListResponse<T> {
- /// 调用接口业务相关代码
- @JsonKey(name: 'code')
- int code;
- /// 调用接口是否成功
- @JsonKey(name: 'success')
- bool success;
- /// 调用接口提示语
- @JsonKey(name: 'msg')
- String? msg;
- /// 日志id
- @JsonKey(name: 'log_id')
- String? logId;
- /// 调用接口返回数据
- @JsonKey(name: 'data')
- BaseListResult<T> data;
- BaseListResponse(
- {required this.code,
- required this.success,
- this.msg,
- this.logId,
- required this.data});
- factory BaseListResponse.fromJson(
- Map<String, dynamic> json, T Function(dynamic json) fromJsonT) =>
- _$BaseListResponseFromJson(json, fromJsonT);
- Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
- _$BaseListResponseToJson(this, toJsonT);
- }
|