|
|
@ -16,7 +16,7 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
/// <summary>
|
|
|
|
/// 获取实体类
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,code,id,isDelete; between:[startTime,endTime];</param>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,id,isDelete; like:name,code; between:[startTime,endTime];</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet] |
|
|
|
public override async Task<SysDictData> GetByQ([Required] string queryJson) |
|
|
@ -28,8 +28,10 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
exp.And(it => it.SysDictTypeId.Equals(sysDictTypeId)); |
|
|
|
if (queryObj.TryGetValue("Id", StringComparison.OrdinalIgnoreCase, out JToken Id)) |
|
|
|
exp.And(it => it.Id.Equals(Id)); |
|
|
|
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) |
|
|
|
exp.And(it => it.Name.Contains(name.ToString())); |
|
|
|
if (queryObj.TryGetValue("code", StringComparison.OrdinalIgnoreCase, out JToken code)) |
|
|
|
exp.And(it => it.Code.Equals(code)); |
|
|
|
exp.And(it => it.Code.Contains(code.ToString())); |
|
|
|
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) |
|
|
|
exp.And(it => it.IsDelete.Equals(isDelete)); |
|
|
|
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime) |
|
|
@ -38,6 +40,7 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
|
|
|
|
var entity = await _baseRep.AsQueryable() |
|
|
|
.Where(exp.ToExpression()) |
|
|
|
.OrderBy(it => new { it.SysDictTypeId, it.Order }) |
|
|
|
.FirstAsync(); |
|
|
|
return entity; |
|
|
|
} |
|
|
@ -45,7 +48,7 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
/// <summary>
|
|
|
|
/// 批量获取实体类
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,code,isDelete; between:[startTime,endTime];</param>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,isDelete; like:name,code; between:[startTime,endTime];</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet] |
|
|
|
public override async Task<List<SysDictData>> GetList(string queryJson = "") |
|
|
@ -55,8 +58,10 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
var exp = Expressionable.Create<SysDictData>(); |
|
|
|
if (queryObj.TryGetValue("sysDictTypeId", StringComparison.OrdinalIgnoreCase, out JToken sysDictTypeId)) |
|
|
|
exp.And(it => it.SysDictTypeId.Equals(sysDictTypeId)); |
|
|
|
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) |
|
|
|
exp.And(it => it.Name.Contains(name.ToString())); |
|
|
|
if (queryObj.TryGetValue("code", StringComparison.OrdinalIgnoreCase, out JToken code)) |
|
|
|
exp.And(it => it.Code.Equals(code)); |
|
|
|
exp.And(it => it.Code.Contains(code.ToString())); |
|
|
|
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) |
|
|
|
exp.And(it => it.IsDelete.Equals(isDelete)); |
|
|
|
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime) |
|
|
@ -64,7 +69,8 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime()); |
|
|
|
|
|
|
|
var list = await _baseRep.AsQueryable() |
|
|
|
.Where(exp.ToExpression()).OrderBy(it => it.Order) |
|
|
|
.Where(exp.ToExpression()) |
|
|
|
.OrderBy(it => new { it.SysDictTypeId, it.Order }) |
|
|
|
.ToListAsync(); |
|
|
|
return list; |
|
|
|
} |
|
|
@ -72,20 +78,22 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
/// <summary>
|
|
|
|
/// 批量获取分页实体类
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,code,isDelete; between:[startTime,endTime];</param>
|
|
|
|
/// <param name="queryJson">equal:sysDictTypeId,isDelete; like:name,code; between:[startTime,endTime];</param>
|
|
|
|
/// <param name="pagination">index,size</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet] |
|
|
|
public override async Task<List<SysDictData>> GetPageList([Required] string pagination, string queryJson = "") |
|
|
|
{ |
|
|
|
JObject queryObj = queryJson.ToJObject(); |
|
|
|
Pagination pageObj = pagination.ToObject<Pagination>(); |
|
|
|
JObject queryObj = queryJson.ToJObject(); |
|
|
|
|
|
|
|
var exp = Expressionable.Create<SysDictData>(); |
|
|
|
if (queryObj.TryGetValue("sysDictTypeId", StringComparison.OrdinalIgnoreCase, out JToken sysDictTypeId)) |
|
|
|
exp.And(it => it.SysDictTypeId.Equals(sysDictTypeId)); |
|
|
|
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name)) |
|
|
|
exp.And(it => it.Name.Contains(name.ToString())); |
|
|
|
if (queryObj.TryGetValue("code", StringComparison.OrdinalIgnoreCase, out JToken code)) |
|
|
|
exp.And(it => it.Code.Equals(code)); |
|
|
|
exp.And(it => it.Code.Contains(code.ToString())); |
|
|
|
if (queryObj.TryGetValue("IsDelete", StringComparison.OrdinalIgnoreCase, out JToken isDelete)) |
|
|
|
exp.And(it => it.IsDelete.Equals(isDelete)); |
|
|
|
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime) |
|
|
@ -93,7 +101,8 @@ public class SysDictDataService : ServiceBase<SysDictData>, ITransient |
|
|
|
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime()); |
|
|
|
|
|
|
|
var list = await _baseRep.AsQueryable() |
|
|
|
.Where(exp.ToExpression()).OrderBy(it => it.Order) |
|
|
|
.Where(exp.ToExpression()) |
|
|
|
.OrderBy(it => new { it.SysDictTypeId, it.Order }) |
|
|
|
.ToPageListAsync(pageObj.Index, pageObj.Size); |
|
|
|
return list; |
|
|
|
} |
|
|
|