Files
ww-jst/wmsjst/JSMachine.WMS.WebHost/Models/CommonQueryResult.cs
T

43 lines
1.1 KiB
C#
Raw Normal View History

2026-09-02 16:31:50 +08:00
namespace JSMachine.WMS.WebHost.Models
{
/// <summary>
/// webapi查询结果封装
/// </summary>
public class CommonQueryResult<T>
{
public CommonQueryResult() { }
public CommonQueryResult(bool isParamValid, bool isSucess, T result)
{
if (!isParamValid)
{
IsSucess = false;
ErrorCode = ErrorCode.InValidInputParam;
}
else
{
IsSucess = isSucess;
ErrorCode = isSucess ? ErrorCode.Sucess : ErrorCode.OperateFailed;
Result = result;
}
}
public bool IsSucess { get; set; }
public ErrorCode ErrorCode { get; set; }
/// <summary>
/// 返回数据(可以是bool也可是实体等等)
/// </summary>
public T Result { get; set; }
public string Msg { get; set; }
}
public enum ErrorCode
{
Sucess = 0,
OperateFailed = 1,
InValidInputParam = 2,
InternalServerError = 3,
UnknownError = 4
}
}