Browse Source

update: 更新业务代码及业务调用说明

master
fajiao 2 years ago
parent
commit
2b80ce4f57
  1. 4
      Cis.Application/Cb/Entity/CbCamera.cs
  2. 7
      Cis.Application/Cb/Entity/CbCameraParams.cs
  3. 37
      Cis.Application/Cb/Service/CbCameraParamsService.cs
  4. 43
      Cis.Application/Cb/Service/CbCameraService.cs
  5. 97
      Cis.Application/Cis.Application.xml
  6. 33
      Cis.Application/Cm/Service/CmMarkGroupService.cs
  7. 47
      Cis.Application/Cm/Service/CmMarkLabelService.cs
  8. 2
      Cis.Application/Sys/Entity/SysDictData.cs
  9. 4
      Cis.Application/Sys/Entity/SysDictType.cs
  10. 12
      Cis.Application/Sys/SeedData/SysDictDataSeedData.cs
  11. 39
      Cis.Application/Sys/Service/SysDictDataService.cs
  12. 39
      Cis.Application/Sys/Service/SysDictTypeService.cs
  13. 2
      Cis.Core/Common/Extension/ObjectExtension.cs

4
Cis.Application/Cb/Entity/CbCamera.cs

@ -19,8 +19,8 @@ public class CbCamera : EntityBase
/// <summary>
/// ip 地址
/// </summary>
[SugarColumn(ColumnDescription = "ip地址", Length = 16)]
[Required, MaxLength(16)]
[SugarColumn(ColumnDescription = "ip地址", Length = 15)]
[Required, MaxLength(15)]
[DataValidation(ValidationTypes.IPv4)]
public string Ip { get; set; }

7
Cis.Application/Cb/Entity/CbCameraParams.cs

@ -41,4 +41,11 @@ public class CbCameraParams : EntityBase
[SugarColumn(ColumnDescription = "FocusY")]
[Required]
public double FocusY { get; set; }
/// <summary>
/// zoom变化函数
/// </summary>
[SugarColumn(ColumnDescription = "zoom变化函数", Length = 256)]
[Required, MaxLength(256)]
public string ZoomVaryFunc { get; set; }
}

37
Cis.Application/Cb/Service/CbCameraParamsService.cs

@ -40,21 +40,54 @@ public class CbCameraParamsService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cameraType; like:name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CbCameraParams>> GetList(string queryJson = "")
{
JObject queryObj = queryJson.ToJObject();
List<CbCameraParams> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CbCameraParams>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("cameraType", StringComparison.OrdinalIgnoreCase, out JToken cameraType))
exp.And(it => it.CameraType.Equals(cameraType));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cameraType; like:name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CbCameraParams>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<CbCameraParams> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CbCameraParams>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("cameraType", StringComparison.OrdinalIgnoreCase, out JToken cameraType))
exp.And(it => it.CameraType.Equals(cameraType));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

43
Cis.Application/Cb/Service/CbCameraService.cs

@ -40,21 +40,58 @@ public class CbCameraService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cbCameraParamsId; like:ip,name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CbCamera>> GetList(string queryJson = "")
{
JObject queryObj = queryJson.ToJObject();
List<CbCamera> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CbCamera>();
if (queryObj.TryGetValue("cbCameraParamsId", StringComparison.OrdinalIgnoreCase, out JToken cbCameraParamsId))
exp.And(it => it.CbCameraParamsId.Equals(cbCameraParamsId));
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("ip", StringComparison.OrdinalIgnoreCase, out JToken ip))
exp.And(it => it.Ip.Contains(ip.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cbCameraParamsId; like:ip,name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CbCamera>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<CbCamera> list = await _baseRep.AsQueryable()
Pagination pageObj = pagination.ToObject<Pagination>();
var exp = Expressionable.Create<CbCamera>();
if (queryObj.TryGetValue("cbCameraParamsId", StringComparison.OrdinalIgnoreCase, out JToken cbCameraParamsId))
exp.And(it => it.CbCameraParamsId.Equals(cbCameraParamsId));
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("ip", StringComparison.OrdinalIgnoreCase, out JToken ip))
exp.And(it => it.Ip.Contains(ip.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

97
Cis.Application/Cis.Application.xml

@ -104,16 +104,51 @@
FocusY
</summary>
</member>
<member name="P:Cis.Application.Cb.CbCameraParams.ZoomVaryFunc">
<summary>
zoom变化函数
</summary>
</member>
<member name="T:Cis.Application.Cb.CbCameraParamsService">
<summary>
相机参数服务
</summary>
</member>
<member name="M:Cis.Application.Cb.CbCameraParamsService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">equal:cameraType; like:name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Cb.CbCameraParamsService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">equal:cameraType; like:name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
<member name="T:Cis.Application.Cb.CbCameraService">
<summary>
相机服务
</summary>
</member>
<member name="M:Cis.Application.Cb.CbCameraService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">equal:cbCameraParamsId; like:ip,name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Cb.CbCameraService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">equal:cbCameraParamsId; like:ip,name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
<member name="T:Cis.Application.Cm.CmInfo">
<summary>
Cm -> Camera mark
@ -239,11 +274,41 @@
标记分组服务
</summary>
</member>
<member name="M:Cis.Application.Cm.CmMarkGroupService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">like:name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Cm.CmMarkGroupService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">like:name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
<member name="T:Cis.Application.Cm.CmMarkLabelService">
<summary>
标签服务
</summary>
</member>
<member name="M:Cis.Application.Cm.CmMarkLabelService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">equal:cbCameraId,cmMarkGroupId; like:name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Cm.CmMarkLabelService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">equal:cbCameraId,cmMarkGroupId; like:name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
<member name="P:Cis.Application.Core.CameraDataCenter.SearchResultListDict">
<summary>
{cameraId, List(MarkLabelCalcResult)}
@ -764,7 +829,7 @@
系统字典值表
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.DictTypeId">
<member name="P:Cis.Application.Sys.SysDictData.SysDictTypeId">
<summary>
字典类型Id
</summary>
@ -829,10 +894,40 @@
系统字典值服务
</summary>
</member>
<member name="M:Cis.Application.Sys.SysDictDataService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">equal:sysDictTypeId; like:code; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Sys.SysDictDataService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">equal:sysDictTypeId; like:code; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
<member name="T:Cis.Application.Sys.SysDictTypeService">
<summary>
系统字典类型服务
</summary>
</member>
<member name="M:Cis.Application.Sys.SysDictTypeService.GetList(System.String)">
<summary>
</summary>
<param name="queryJson">equal:code; like:name; between:[startTime,endTime];</param>
<returns></returns>
</member>
<member name="M:Cis.Application.Sys.SysDictTypeService.GetPageList(System.String,System.String)">
<summary>
</summary>
<param name="queryJson">equal:code; like:name; between:[startTime,endTime];</param>
<param name="pagination">index,size</param>
<returns></returns>
</member>
</members>
</doc>

33
Cis.Application/Cm/Service/CmMarkGroupService.cs

@ -40,21 +40,50 @@ public class CmMarkGroupService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">like:name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CmMarkGroup>> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List<CmMarkGroup> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CmMarkGroup>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">like:name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CmMarkGroup>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<CmMarkGroup> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CmMarkGroup>();
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

47
Cis.Application/Cm/Service/CmMarkLabelService.cs

@ -1,6 +1,4 @@
using Cis.Application.Core;
using Cis.Application.Core.Component.CameraSDK;
using Cis.Application.Core.Component.PtzServer;
using Cis.Application.Core.Component.PtzServer;
using EC.Helper.CameraSDK;
using Newtonsoft.Json.Linq;
@ -67,21 +65,58 @@ public class CmMarkLabelService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cbCameraId,cmMarkGroupId; like:name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CmMarkLabel>> GetList(string queryJson = "")
{
JObject queryObj = queryJson.ToJObject();
List<CmMarkLabel> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<CmMarkLabel>();
if (queryObj.TryGetValue("cbCameraId", StringComparison.OrdinalIgnoreCase, out JToken cbCameraId))
exp.And(it => it.CbCameraId.Equals(cbCameraId));
if (queryObj.TryGetValue("cmMarkGroupId", StringComparison.OrdinalIgnoreCase, out JToken cmMarkGroupId))
exp.And(it => it.CmMarkGroupId.Equals(cmMarkGroupId));
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:cbCameraId,cmMarkGroupId; like:name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<CmMarkLabel>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<CmMarkLabel> list = await _baseRep.AsQueryable()
Pagination pageObj = pagination.ToObject<Pagination>();
var exp = Expressionable.Create<CmMarkLabel>();
if (queryObj.TryGetValue("cbCameraId", StringComparison.OrdinalIgnoreCase, out JToken cbCameraId))
exp.And(it => it.CbCameraId.Equals(cbCameraId));
if (queryObj.TryGetValue("cmMarkGroupId", StringComparison.OrdinalIgnoreCase, out JToken cmMarkGroupId))
exp.And(it => it.CmMarkGroupId.Equals(cmMarkGroupId));
if (queryObj.TryGetValue("name", StringComparison.OrdinalIgnoreCase, out JToken name))
exp.And(it => it.Name.Contains(name.ToString()));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression())
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

2
Cis.Application/Sys/Entity/SysDictData.cs

@ -12,7 +12,7 @@ public class SysDictData : EntityBase
/// </summary>
[SugarColumn(ColumnDescription = "字典类型Id")]
[Required]
public long DictTypeId { get; set; }
public long SysDictTypeId { get; set; }
/// <summary>
/// 值

4
Cis.Application/Sys/Entity/SysDictType.cs

@ -1,6 +1,4 @@
using Cis.Application.Cm;
namespace Cis.Application.Sys;
namespace Cis.Application.Sys;
/// <summary>
/// 系统字典类型表

12
Cis.Application/Sys/SeedData/SysDictDataSeedData.cs

@ -6,13 +6,13 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
{
return new SysDictData[]
{
new(){Id=358769934100001, DictTypeId=358728043100001, Code="HiK", Value="1", Order=100, Remark="海康相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100002, DictTypeId=358728043100001, Code="DaHua", Value="2", Order=100, Remark="大华相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100003, DictTypeId=358728043100001, Code="YuShi", Value="3", Order=100, Remark="宇视相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100001, SysDictTypeId=358728043100001, Code="HiK", Value="1", Order=100, Remark="海康相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100002, SysDictTypeId=358728043100001, Code="DaHua", Value="2", Order=100, Remark="大华相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100003, SysDictTypeId=358728043100001, Code="YuShi", Value="3", Order=100, Remark="宇视相机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100011, DictTypeId=358728043100002, Code="HiK", Value="8000", Order=100, Remark="海康sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100012, DictTypeId=358728043100002, Code="DaHua", Value="37777", Order=100, Remark="大华sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100013, DictTypeId=358728043100002, Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100011, SysDictTypeId=358728043100002, Code="HiK", Value="8000", Order=100, Remark="海康sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100012, SysDictTypeId=358728043100002, Code="DaHua", Value="37777", Order=100, Remark="大华sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100013, SysDictTypeId=358728043100002, Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
};
}
}

39
Cis.Application/Sys/Service/SysDictDataService.cs

@ -40,21 +40,54 @@ public class SysDictDataService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:sysDictTypeId; like:code; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<SysDictData>> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List<SysDictData> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<SysDictData>();
if (queryObj.TryGetValue("sysDictTypeId", StringComparison.OrdinalIgnoreCase, out JToken sysDictTypeId))
exp.And(it => it.SysDictTypeId.Equals(sysDictTypeId));
if (queryObj.TryGetValue("code", StringComparison.OrdinalIgnoreCase, out JToken code))
exp.And(it => it.Code.Equals(code));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression()).OrderBy(it => it.Order)
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:sysDictTypeId; like:code; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<SysDictData>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<SysDictData> list = await _baseRep.AsQueryable()
Pagination pageObj = pagination.ToObject<Pagination>();
var exp = Expressionable.Create<SysDictData>();
if (queryObj.TryGetValue("sysDictTypeId", StringComparison.OrdinalIgnoreCase, out JToken sysDictTypeId))
exp.And(it => it.SysDictTypeId.Equals(sysDictTypeId));
if (queryObj.TryGetValue("code", StringComparison.OrdinalIgnoreCase, out JToken code))
exp.And(it => it.Code.Equals(code));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression()).OrderBy(it => it.Order)
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

39
Cis.Application/Sys/Service/SysDictTypeService.cs

@ -40,21 +40,54 @@ public class SysDictTypeService : IDynamicApiController, ITransient
return entity;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:code; like:name; between:[startTime,endTime];</param>
/// <returns></returns>
[HttpGet]
public async Task<List<SysDictType>> GetList(string queryJson)
{
JObject queryObj = queryJson.ToJObject();
List<SysDictType> list = await _baseRep.AsQueryable()
var exp = Expressionable.Create<SysDictType>();
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));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression()).OrderBy(it => it.Order)
.ToListAsync();
return list;
}
/// <summary>
///
/// </summary>
/// <param name="queryJson">equal:code; like:name; between:[startTime,endTime];</param>
/// <param name="pagination">index,size</param>
/// <returns></returns>
[HttpGet]
public async Task<List<SysDictType>> GetPageList(string queryJson, string pagination)
{
Pagination pageObj = pagination.ToObject<Pagination>();
JObject queryObj = queryJson.ToJObject();
List<SysDictType> list = await _baseRep.AsQueryable()
Pagination pageObj = pagination.ToObject<Pagination>();
var exp = Expressionable.Create<SysDictType>();
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));
if (queryObj.TryGetValue("StartTime", StringComparison.OrdinalIgnoreCase, out JToken startTime)
&& queryObj.TryGetValue("EndTime", StringComparison.OrdinalIgnoreCase, out JToken endTime))
exp.And(it => it.CreateTime >= startTime.ToDateTime() && it.CreateTime <= endTime.ToDateTime());
var list = await _baseRep.AsQueryable()
.Where(exp.ToExpression()).OrderBy(it => it.Order)
.ToPageListAsync(pageObj.Index, pageObj.Size);
return list;
}

2
Cis.Core/Common/Extension/ObjectExtension.cs

@ -125,7 +125,7 @@ public static class ObjectExtension
/// <returns></returns>
public static JObject ToJObject(this string Json)
{
return string.IsNullOrEmpty(Json) ? JObject.Parse("{}") : JObject.Parse(Json.Replace("&nbsp;", ""));
return !string.IsNullOrEmpty(Json) ? JObject.Parse(Json.Replace("&nbsp;", "")) : JObject.Parse("{}");
}
/// <summary>

Loading…
Cancel
Save