Browse Source

feat: 调整 SysDictType 实体类及服务

master
fajiao 2 years ago
parent
commit
5f300081bb
  1. 4
      Cis.Application/Cb/Entity/BO/CbCameraBO.cs
  2. 5
      Cis.Application/Cb/Service/CbCameraService.cs
  3. 31
      Cis.Application/Cis.Application.xml
  4. 24
      Cis.Application/Sys/Entity/BO/SysDictTypeBO.cs
  5. 15
      Cis.Application/Sys/Entity/SysDictData.cs
  6. 18
      Cis.Application/Sys/SeedData/SysDictDataSeedData.cs
  7. 30
      Cis.Application/Sys/Service/SysDictTypeService.cs

4
Cis.Application/Cb/Entity/BO/CbCameraBO.cs

@ -20,8 +20,8 @@ public class CbCameraBO
/// </summary> /// </summary>
public CbCameraParams CbCameraParams { get; set; } public CbCameraParams CbCameraParams { get; set; }
public static CbCameraBO New(long cbCameraId, CbCamera cbCamera, CbCameraParams cbCameraParams) public static CbCameraBO New(CbCamera cbCamera, CbCameraParams cbCameraParams)
{ {
return new() { Id = cbCameraId, CbCamera = cbCamera, CbCameraParams = cbCameraParams }; return new() { Id = cbCamera.Id, CbCamera = cbCamera, CbCameraParams = cbCameraParams };
} }
} }

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

@ -121,7 +121,7 @@ public class CbCameraService : ServiceBase<CbCamera>, ITransient
if (camera == null) return null; if (camera == null) return null;
CbCameraParams cameraParams = await _cbCameraParamsRep.GetByIdAsync(camera.CbCameraParamsId); CbCameraParams cameraParams = await _cbCameraParamsRep.GetByIdAsync(camera.CbCameraParamsId);
if (cameraParams == null) return null; if (cameraParams == null) return null;
CbCameraBO bo = CbCameraBO.New(camera.Id, camera, cameraParams); CbCameraBO bo = CbCameraBO.New(camera, cameraParams);
return bo; return bo;
} }
@ -162,8 +162,7 @@ public class CbCameraService : ServiceBase<CbCamera>, ITransient
List<CbCameraBO> boList = new(); List<CbCameraBO> boList = new();
foreach (var item in cameraList) foreach (var item in cameraList)
boList.Add(CbCameraBO.New(item.Id, item, paramsDict[item.CbCameraParamsId])); boList.Add(CbCameraBO.New(item, paramsDict[item.CbCameraParamsId]));
return boList; return boList;
} }

31
Cis.Application/Cis.Application.xml

@ -1223,6 +1223,21 @@
SysDataType 表描述 SysDataType 表描述
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Sys.SysDictTypeBO.Id">
<summary>
sysDictTypeId
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictTypeBO.SysDictType">
<summary>
sysDictType 实体类
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictTypeBO.SysDictDataList">
<summary>
sysDictData 实体类列表
</summary>
</member>
<member name="T:Cis.Application.Sys.SysDictData"> <member name="T:Cis.Application.Sys.SysDictData">
<summary> <summary>
系统字典值表 系统字典值表
@ -1233,9 +1248,9 @@
字典类型Id 字典类型Id
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Sys.SysDictData.Value"> <member name="P:Cis.Application.Sys.SysDictData.Name">
<summary> <summary>
名称
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Sys.SysDictData.Code"> <member name="P:Cis.Application.Sys.SysDictData.Code">
@ -1243,6 +1258,11 @@
编码 编码
</summary> </summary>
</member> </member>
<member name="P:Cis.Application.Sys.SysDictData.Value">
<summary>
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.Order"> <member name="P:Cis.Application.Sys.SysDictData.Order">
<summary> <summary>
排序 排序
@ -1342,5 +1362,12 @@
<param name="pagination">index,size</param> <param name="pagination">index,size</param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Cis.Application.Sys.SysDictTypeService.GetBOByCode(System.String)">
<summary>
获取实体类 BO
</summary>
<param name="code">sys_dict_type code</param>
<returns></returns>
</member>
</members> </members>
</doc> </doc>

24
Cis.Application/Sys/Entity/BO/SysDictTypeBO.cs

@ -0,0 +1,24 @@
namespace Cis.Application.Sys;
public class SysDictTypeBO
{
/// <summary>
/// sysDictTypeId
/// </summary>
public long Id { get; set; }
/// <summary>
/// sysDictType 实体类
/// </summary>
public SysDictType SysDictType { get; set; }
/// <summary>
/// sysDictData 实体类列表
/// </summary>
public List<SysDictData> SysDictDataList { get; set; }
public static SysDictTypeBO New(SysDictType sysDictType, List<SysDictData> sysDictDataList)
{
return new SysDictTypeBO() { Id = sysDictType.Id, SysDictType = sysDictType, SysDictDataList = sysDictDataList };
}
}

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

@ -15,11 +15,11 @@ public class SysDictData : EntityBase
public long SysDictTypeId { get; set; } public long SysDictTypeId { get; set; }
/// <summary> /// <summary>
/// /// 名称
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "值", Length = 128)] [SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(128)] [Required, MaxLength(64)]
public string Value { get; set; } public string Name { get; set; }
/// <summary> /// <summary>
/// 编码 /// 编码
@ -28,6 +28,13 @@ public class SysDictData : EntityBase
[Required, MaxLength(64)] [Required, MaxLength(64)]
public string Code { get; set; } public string Code { get; set; }
/// <summary>
/// 值
/// </summary>
[SugarColumn(ColumnDescription = "值", Length = 128)]
[Required, MaxLength(128)]
public string Value { get; set; }
/// <summary> /// <summary>
/// 排序 /// 排序
/// </summary> /// </summary>

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

@ -6,17 +6,17 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<SysDictData>
{ {
return new SysDictData[] return new SysDictData[]
{ {
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=358769934100001, SysDictTypeId=358728043100001, Name="海康", 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=358769934100002, SysDictTypeId=358728043100001, Name="大华", 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=358769934100003, SysDictTypeId=358728043100001, Name="宇视", Code="YuShi", Value="3", Order=100, Remark="宇视", 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=358769934100011, SysDictTypeId=358728043100002, Name="海康", 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=358769934100012, SysDictTypeId=358728043100002, Name="大华", 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")}, new(){Id=358769934100013, SysDictTypeId=358728043100002, Name="宇视", Code="YuShi", Value="8800", Order=100, Remark="宇视sdk端口", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100021, SysDictTypeId=358728043100001, Code="BulletCamera", Value="1", Order=100, Remark="枪机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100021, SysDictTypeId=358728043100003, Name="枪机", Code="BulletCamera", Value="1", Order=100, Remark="枪机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100022, SysDictTypeId=358728043100001, Code="DomeCamera", Value="2", Order=100, Remark="半球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100022, SysDictTypeId=358728043100003, Name="半球机", Code="DomeCamera", Value="2", Order=100, Remark="半球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
new(){Id=358769934100023, SysDictTypeId=358728043100001, Code="SpeedDomeCamera", Value="3", Order=100, Remark="球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")}, new(){Id=358769934100023, SysDictTypeId=358728043100003, Name="球机", Code="SpeedDomeCamera", Value="3", Order=100, Remark="球机", Status=StatusEnum.Enable, CreateTime=DateTime.Parse("2022-11-30 00:00:00")},
}; };
} }
} }

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

@ -9,8 +9,11 @@ namespace Cis.Application.Sys;
[ApiDescriptionSettings(SysInfo.GroupName, Order = SysInfo.SysDictTypeGroupOrder)] [ApiDescriptionSettings(SysInfo.GroupName, Order = SysInfo.SysDictTypeGroupOrder)]
public class SysDictTypeService : ServiceBase<SysDictType>, ITransient public class SysDictTypeService : ServiceBase<SysDictType>, ITransient
{ {
public SysDictTypeService(SqlSugarRepository<SysDictType> baseRep) : base(baseRep) protected readonly SqlSugarRepository<SysDictData> _sysDictDataRep;
public SysDictTypeService(SqlSugarRepository<SysDictType> baseRep, SqlSugarRepository<SysDictData> sysDictDataRep) : base(baseRep)
{ {
_sysDictDataRep = sysDictDataRep;
} }
/// <summary> /// <summary>
@ -97,4 +100,29 @@ public class SysDictTypeService : ServiceBase<SysDictType>, ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size); .ToPageListAsync(pageObj.Index, pageObj.Size);
return list; return list;
} }
#region BO
/// <summary>
/// 获取实体类 BO
/// </summary>
/// <param name="code">sys_dict_type code</param>
/// <returns></returns>
[HttpGet]
public async Task<SysDictTypeBO> GetBOByCode([Required] string code)
{
SysDictType type = await _baseRep.AsQueryable()
.Where(it => it.Code.Equals(code))
.FirstAsync();
if (type == null) return null;
List<SysDictData> dataList = await _sysDictDataRep.AsQueryable()
.Where(it => it.SysDictTypeId.Equals(type.Id))
.OrderBy(it => it.Order)
.ToListAsync();
SysDictTypeBO bo = SysDictTypeBO.New(type, dataList);
return bo;
}
#endregion BO
} }
Loading…
Cancel
Save