feat: SchTree 客户端对接 SchGroup/GetTeaTree,升版 1.0.0-preview.2
- 补齐 4226b04 未入库的 3 个新文件(TeaTreeVo/SchClassSchTreeClient/契约测试),修复该提交编译不过
- 版本升至 1.0.0-preview.2:Nexus nuget-hosted 禁止重传(ALLOW_ONCE),同版本不递增会被查重跳过
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Yh.SchClass.OpenApi.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 学校教师组树节点视图对象(镜像 Java <c>com.yunhai.bschclassmanage.model.oa.TeaTreeVO</c>)。
|
||||
/// <para>
|
||||
/// Java 侧为 Lombok <c>@Data</c> + <c>@JsonInclude(NON_NULL)</c>:教师叶子节点的
|
||||
/// <c>children</c> 为 null 会被省略;本客户端大小写不敏感反序列化,按 Java 字段原名锚定即可双向兼容。
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class TeaTreeVo
|
||||
{
|
||||
/// <summary>节点 ID(学校/组为组中心 ID,教师为 teaId,未分组兜底节点为 -1)</summary>
|
||||
[JsonPropertyName("id")] public int? Id { get; set; }
|
||||
|
||||
/// <summary>节点名称</summary>
|
||||
[JsonPropertyName("name")] public string? Name { get; set; }
|
||||
|
||||
/// <summary>父节点 ID(根节点为 0)</summary>
|
||||
[JsonPropertyName("pid")] public int? Pid { get; set; }
|
||||
|
||||
/// <summary>排序号(组=组中心 sort,教师=0)</summary>
|
||||
[JsonPropertyName("no")] public int? No { get; set; }
|
||||
|
||||
/// <summary>节点类型(1=组节点,2=教师叶子)</summary>
|
||||
[JsonPropertyName("type")] public int? Type { get; set; }
|
||||
|
||||
/// <summary>是否父节点(组=true,教师=false)</summary>
|
||||
[JsonPropertyName("isParent")] public bool? IsParent { get; set; }
|
||||
|
||||
/// <summary>头像(Java 侧固定空串)</summary>
|
||||
[JsonPropertyName("photo")] public string? Photo { get; set; }
|
||||
|
||||
/// <summary>子节点(组节点保证非 null;教师叶子为 null)</summary>
|
||||
[JsonPropertyName("children")] public List<TeaTreeVo>? Children { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Yh.SchClass.OpenApi.Model;
|
||||
|
||||
namespace Yh.SchClass.OpenApi;
|
||||
|
||||
/// <summary>
|
||||
/// 学校教师组树客户端(镜像 Java <c>SchGroupController</c>,路径前缀 <c>/oapi/SchGroup/</c>)。
|
||||
/// </summary>
|
||||
public class SchClassSchTreeClient : SchClassClientBase
|
||||
{
|
||||
private const string Root = Prefix + "/SchGroup/";
|
||||
|
||||
public SchClassSchTreeClient(HttpClient httpClient, SchClassOpenApiOptions options)
|
||||
: base(httpClient, options)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取学校教师组树(<c>GET /oapi/SchGroup/GetTeaTree</c>)。
|
||||
/// 返回单元素数组(根 = 学校节点,type=1),其下为教师组层级挂教师叶子(type=2)。
|
||||
/// <paramref name="schId"/> 与 <paramref name="schSerId"/> 至少提供一个(服务端 schId 优先),
|
||||
/// 都缺时服务端返回空数组(本方法返回空列表,与 Java 行为一致)。
|
||||
/// </summary>
|
||||
/// <param name="schSerId">学校外部序列号(Java 参数名 <c>SchSerID</c>)。</param>
|
||||
/// <param name="schId">学校内部 ID(Java 参数名 <c>schId</c>,优先使用)。</param>
|
||||
public Task<List<TeaTreeVo>> GetTeaTreeAsync(string? schSerId = null, int? schId = null, CancellationToken ct = default)
|
||||
=> ResolveListAsync<TeaTreeVo>(HttpMethod.Get, Root + "GetTeaTree",
|
||||
Params(("SchSerID", schSerId), ("schId", schId)), ct: ct);
|
||||
}
|
||||
Reference in New Issue
Block a user