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
  8. 2
      Cis.Core/CoreConfig.json

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

@ -20,8 +20,8 @@ public class CbCameraBO
/// </summary>
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;
CbCameraParams cameraParams = await _cbCameraParamsRep.GetByIdAsync(camera.CbCameraParamsId);
if (cameraParams == null) return null;
CbCameraBO bo = CbCameraBO.New(camera.Id, camera, cameraParams);
CbCameraBO bo = CbCameraBO.New(camera, cameraParams);
return bo;
}
@ -162,8 +162,7 @@ public class CbCameraService : ServiceBase<CbCamera>, ITransient
List<CbCameraBO> boList = new();
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;
}

31
Cis.Application/Cis.Application.xml

@ -1223,6 +1223,21 @@
SysDataType 表描述
</summary>
</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">
<summary>
系统字典值表
@ -1233,9 +1248,9 @@
字典类型Id
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.Value">
<member name="P:Cis.Application.Sys.SysDictData.Name">
<summary>
名称
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.Code">
@ -1243,6 +1258,11 @@
编码
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.Value">
<summary>
</summary>
</member>
<member name="P:Cis.Application.Sys.SysDictData.Order">
<summary>
排序
@ -1342,5 +1362,12 @@
<param name="pagination">index,size</param>
<returns></returns>
</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>
</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; }
/// <summary>
///
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "值", Length = 128)]
[Required, MaxLength(128)]
public string Value { get; set; }
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public string Name { get; set; }
/// <summary>
/// 编码
@ -28,6 +28,13 @@ public class SysDictData : EntityBase
[Required, MaxLength(64)]
public string Code { get; set; }
/// <summary>
/// 值
/// </summary>
[SugarColumn(ColumnDescription = "值", Length = 128)]
[Required, MaxLength(128)]
public string Value { get; set; }
/// <summary>
/// 排序
/// </summary>

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

@ -6,17 +6,17 @@ public class SysDictDataSeedData : ISqlSugarEntitySeedData<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=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=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, 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, 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=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")},
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, 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, 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=358769934100022, SysDictTypeId=358728043100001, 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=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=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=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)]
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>
@ -97,4 +100,29 @@ public class SysDictTypeService : ServiceBase<SysDictType>, ITransient
.ToPageListAsync(pageObj.Index, pageObj.Size);
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
}

2
Cis.Core/CoreConfig.json

@ -11,7 +11,7 @@
//"ConnectionString": "HOST=127.0.0.1;PORT=5432;USER ID=pgsql;PASSWORD=123456;DATABASE=cis;",
"EnableInitDb": false //
}
]
]
},
"Redis": {
"ConnectionString": "192.168.1.119:6379,password=123456,defaultDatabase=2"

Loading…
Cancel
Save