///////////////////////////////////////////////////////////////////////////////// // 宁波拓通e智造平台 ToTong Next Builder // // https://git.tuotong-tech.com/tnb/tnb.server // ///////////////////////////////////////////////////////////////////////////////// using JNPF.Common.Security; using Mapster; using Tnb.Core; namespace Tnb.Vengine.Domain; public class VmBaseInput { /// /// 附加参数 /// public object? extra { get; set; } } public class VmGetInput : VmBaseInput { /// /// 要获取数据的id /// public string? id { get; set; } /// /// 过滤条件 /// public string? q { get; set; } /// /// 输出字段 /// public string o { get; set; } = "*"; /// /// 转换为QueryInput /// /// /// public VmQueryInput ToQueryInput(string primaryKey) { VmQueryInput arg = this.Adapt(); if (!string.IsNullOrEmpty(id)) { if (arg.q == null) arg.q = new DObject(); arg.q.Add(primaryKey, id); } return arg; } } public class VmGetListInput : VmBaseInput { /// /// 当前页数 /// public int pnum { get; set; } /// /// 每页记录数 /// public int psize { get; set; } /// /// 排序 /// public string? sort { get; set; } = null; /// /// 模糊查询 /// public string? k { get; set; } /// /// 过滤条件 /// public string? q { get; set; } /// /// 输出字段 /// public string o { get; set; } = "*"; /// /// 转换为QueryInput /// /// public VmQueryInput ToQueryInput() { VmQueryInput arg = this.Adapt(); if (!string.IsNullOrEmpty(q)) { arg.q = q.ToObject(); } return arg; } } /// /// 获取多条数据输入参数 /// public class VmQueryInput : VmGetListInput { /// /// 查询条件 /// public new DObject? q { get; set; } } /// /// 新增数据输入参数 /// public class VmCreateInput : VmBaseInput { /// /// 数据 /// public DObject? data { get; set; } /// /// 批量添加 /// public List? items { get; set; } } /// /// 修改数据输入参数 /// public class VmUpdateInput : VmCreateInput { ///// ///// 要更新的数据id ///// //public string? id { get; set; } } /// /// 删除数据输入参数 /// public class VmDeleteInput : VmBaseInput { /// /// 要删除的数据id /// public string? id { get; set; } /// /// 要删除的id列表 /// public List? ids { get; set; } } public class PagedOutput { public int total { get; set; } public object? extra { get; set; } public static PagedOutput Create(int totalNum, List ls) { return new PagedOutput(totalNum, ls); } } /// /// 分页列表输出对象 /// /// public class PagedOutput : PagedOutput { public List items { get; set; } = new List(); public PagedOutput() { } public PagedOutput(int totalNum, List ls) { total = totalNum; items = ls; } } /// /// 动态分页列表输出对象 /// public class VmPagedOutput : PagedOutput { public PagedOutput ToPagedOutput() { return new PagedOutput() { total = total, items = items.Adapt>() }; } }