已删除1个文件
已重命名4个文件
已修改19个文件
已添加5个文件
| | |
| | | config.ForType<AddRunAnalyConfigureInput, Model.RunAnalyConfigure>(); |
| | | config.ForType<UpdateRunAnalyConfigureInput, Model.RunAnalyConfigure>(); |
| | | config.ForType<Model.RunAnalyConfigure, RunAnalyConfigureDto>(); |
| | | config.ForType<SetRunAnalyConfigureInput, Model.RunAnalyConfigure>(); |
| | | |
| | | config.ForType<SetRunAnalyConfigureInput, Model.RunAnalyConfigurePure>(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | namespace Yw.Application |
| | | using Mapster; |
| | | |
| | | namespace Yw.Application |
| | | { |
| | | /// <summary> |
| | | /// RunAnalyConfigure |
| | |
| | | #region Set |
| | | |
| | | /// <summary> |
| | | /// æå
¥ææ´æ° |
| | | /// </summary> |
| | | [Route("InsertOrUpdate@V1.0")] |
| | | [HttpPost] |
| | | public long InsertOrUpdate([Required] SetRunAnalyConfigureInput input) |
| | | { |
| | | var pure = input.Adapt<SetRunAnalyConfigureInput, Model.RunAnalyConfigurePure>(); |
| | | var id = _service.InsertOrUpdate(pure); |
| | | return id; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | [Route("Set@V1.0")] |
| | | [HttpPost] |
| | | public bool Set(List<SetRunAnalyConfigureInput> input) |
| | | { |
| | | var list = input?.Select(x => x.Adapt<SetRunAnalyConfigureInput, Model.RunAnalyConfigure>()).ToList(); |
| | | var bol = _service.Set(list); |
| | | var list = input?.Select(x => x.Adapt<SetRunAnalyConfigureInput, Model.RunAnalyConfigurePure>()).ToList(); |
| | | var bol = _service.Set(list, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.V001, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | |
| | | #region Delete |
| | | |
| | | /// <summary> |
| | | /// å é¤ |
| | | /// éè¿ ID å é¤ |
| | | /// </summary> |
| | | [Route("DeleteByID@V1.0")] |
| | | [HttpDelete] |
| | |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID å é¤ |
| | | /// </summary> |
| | | [Route("DeleteByObjectTypeAndObjectID@V1.0")] |
| | | [HttpDelete] |
| | | public bool DeleteByObjectTypeAndObjectID([FromQuery][Required] ObjectInput input) |
| | | { |
| | | var bol = _service.DeleteByObjectTypeAndObjectID(input.ObjectType, input.ObjectID, out string Msg); |
| | | if (!bol) |
| | | { |
| | | throw YOops.Oh(eResultCode.Alert, InternalErrorCodes.D999, Msg); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2024-06-19T11:43:45.0619480Z;True|2024-05-31T15:22:21.0299608+08:00;True|2024-05-13T09:49:32.7865121+08:00;True|2024-05-08T14:57:38.9700807+08:00;True|2024-04-30T13:48:09.3970916+08:00;True|2024-04-26T11:52:38.6381832+08:00;True|2024-04-01T11:40:26.8126073+08:00;True|2024-03-26T09:54:08.7672773+08:00;True|2024-02-01T15:13:33.2518157+08:00;True|2024-01-27T11:05:20.5193198+08:00;True|2024-01-21T14:54:51.3939785+08:00;True|2024-01-08T17:00:51.0941947+08:00;True|2023-12-16T15:43:21.8065953+08:00;True|2023-12-11T11:56:46.3121435+08:00;True|2023-12-11T11:27:23.3317604+08:00;True|2023-12-11T11:27:14.6709240+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> |
| | | <History>True|2024-07-17T04:30:25.7307989Z;True|2024-06-19T19:43:45.0619480+08:00;True|2024-05-31T15:22:21.0299608+08:00;True|2024-05-13T09:49:32.7865121+08:00;True|2024-05-08T14:57:38.9700807+08:00;True|2024-04-30T13:48:09.3970916+08:00;True|2024-04-26T11:52:38.6381832+08:00;True|2024-04-01T11:40:26.8126073+08:00;True|2024-03-26T09:54:08.7672773+08:00;True|2024-02-01T15:13:33.2518157+08:00;True|2024-01-27T11:05:20.5193198+08:00;True|2024-01-21T14:54:51.3939785+08:00;True|2024-01-08T17:00:51.0941947+08:00;True|2023-12-16T15:43:21.8065953+08:00;True|2023-12-11T11:56:46.3121435+08:00;True|2023-12-11T11:27:23.3317604+08:00;True|2023-12-11T11:27:14.6709240+08:00;True|2023-07-13T12:10:11.2591498+08:00;True|2023-05-25T18:02:16.3580168+08:00;True|2023-05-25T15:44:32.4909866+08:00;</History> |
| | | <LastFailureDetails /> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | <RootNamespace>Yw.Application</RootNamespace> |
| | | <GenerateDocumentationFile>True</GenerateDocumentationFile> |
| | | <GeneratePackageOnBuild>True</GeneratePackageOnBuild> |
| | | <Version>3.1.1</Version> |
| | | <Version>3.1.2</Version> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.Application.Core" Version="3.0.8" /> |
| | | <PackageReference Include="Yw.Dto.Run.Core" Version="3.1.1" /> |
| | | <PackageReference Include="Yw.Application.Core" Version="3.1.0" /> |
| | | <PackageReference Include="Yw.Dto.Run.Core" Version="3.1.2" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | /// </summary> |
| | | public class SetRunAnalyConfigureInput |
| | | { |
| | | /// <summary> |
| | | /// id |
| | | /// </summary> |
| | | [Required] |
| | | public long ID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®ç±»å |
| | |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2024-06-19T11:42:59.0063910Z;True|2024-05-31T15:21:48.4686744+08:00;True|2024-05-13T09:48:52.9024655+08:00;True|2024-05-08T14:56:51.2185908+08:00;True|2024-05-08T14:25:43.7997185+08:00;True|2024-04-30T13:46:18.9575803+08:00;True|2024-04-30T11:29:49.6927256+08:00;True|2024-04-26T11:51:11.4880401+08:00;True|2024-04-26T11:50:49.7392651+08:00;True|2024-04-26T11:50:39.7372723+08:00;True|2024-04-01T11:39:12.7290526+08:00;True|2024-03-26T09:51:34.4055575+08:00;</History> |
| | | <History>True|2024-07-17T04:25:21.0318008Z;True|2024-06-19T19:42:59.0063910+08:00;True|2024-05-31T15:21:48.4686744+08:00;True|2024-05-13T09:48:52.9024655+08:00;True|2024-05-08T14:56:51.2185908+08:00;True|2024-05-08T14:25:43.7997185+08:00;True|2024-04-30T13:46:18.9575803+08:00;True|2024-04-30T11:29:49.6927256+08:00;True|2024-04-26T11:51:11.4880401+08:00;True|2024-04-26T11:50:49.7392651+08:00;True|2024-04-26T11:50:39.7372723+08:00;True|2024-04-01T11:39:12.7290526+08:00;True|2024-03-26T09:51:34.4055575+08:00;</History> |
| | | <LastFailureDetails /> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | <TargetFramework>net6.0</TargetFramework> |
| | | <ImplicitUsings>enable</ImplicitUsings> |
| | | <Nullable>disable</Nullable> |
| | | <Version>3.1.1</Version> |
| | | <Version>3.1.2</Version> |
| | | <GeneratePackageOnBuild>True</GeneratePackageOnBuild> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.Dto.Core" Version="3.0.8" /> |
| | | <PackageReference Include="Yw.Service.Run.Core" Version="3.0.9" /> |
| | | <PackageReference Include="Yw.Dto.Core" Version="3.1.0" /> |
| | | <PackageReference Include="Yw.Service.Run.Core" Version="3.1.0" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | private List<IJobHelper> _jobHelpers = new List<IJobHelper>() |
| | | { |
| | | new EquipmentRunAnalyServiceJobHelper(), |
| | | new EMWSRunAnalyServiceJobHelper() |
| | | //new EMWSRunAnalyServiceJobHelper() |
| | | }; |
| | | |
| | | /// <summary> |
| | |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <Compile Remove="02-emws\**" /> |
| | | <EmbeddedResource Remove="02-emws\**" /> |
| | | <None Remove="02-emws\**" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.Quartz.Core" Version="3.0.0" /> |
| | | <PackageReference Include="Yw.Service.Assets.Core" Version="3.1.2" /> |
| | | <PackageReference Include="Yw.Service.Basic.Core" Version="3.0.7" /> |
| | | <PackageReference Include="Yw.Service.EMWS.Core" Version="3.0.2" /> |
| | | <PackageReference Include="Yw.Service.Monitor.Core" Version="3.3.0" /> |
| | | <PackageReference Include="Yw.Service.MonitorRelation.Core" Version="3.0.9" /> |
| | | <PackageReference Include="Yw.Service.Assets.Core" Version="3.2.0" /> |
| | | <PackageReference Include="Yw.Service.EMWS.Core" Version="3.0.6" /> |
| | | <PackageReference Include="Yw.Service.Monitor.Core" Version="3.6.0" /> |
| | | <PackageReference Include="Yw.Service.MonitorRelation.Core" Version="3.2.1" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | { |
| | | get |
| | | { |
| | | //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; ä¸åæºå¨é
ç½®çå¯ä¸æ°å; // åæå¡å¨ä¸éè¦æå® |
| | | return new ConnectionConfig() |
| | | ConnectionConfig connectConfig = null; |
| | | switch (RunParasHelper.Run.DataBase.DbType) |
| | | { |
| | | DbType = SqlSugar.DbType.PostgreSQL,//æ°æ®åºç±»å |
| | | ConnectionString = RunParasHelper.Run.DataBase.PostgreSql.ConnectString, |
| | | IsAutoCloseConnection = true,//æ¯å¦èªå¨å
³é |
| | | MoreSettings = new ConnMoreSettings() |
| | | { |
| | | //PgSqlIsAutoToLower = false //æ°æ®åºåå¨å¤§ååæ®µç ï¼éè¦æè¿ä¸ªè®¾ä¸ºfalse ï¼å¹¶ä¸å®ä½ååæ®µåç§°è¦ä¸æ · |
| | | }, |
| | | AopEvents = new AopEvents |
| | | { |
| | | OnLogExecuting = (sql, p) => |
| | | case DbType.PostgreSql: |
| | | { |
| | | // var sqlString = UtilMethods.GetNativeSql(sql, p); |
| | | //LogHelper.Debug(sqlString); |
| | | // Console.WriteLine(sql); |
| | | connectConfig = PostgreSqlConnectionConfig; |
| | | } |
| | | } |
| | | }; |
| | | break; |
| | | case DbType.SQLite: |
| | | { |
| | | connectConfig = SQLiteConnectionConfig; |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | return connectConfig; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | get |
| | | { |
| | | //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; ä¸åæºå¨é
ç½®çå¯ä¸æ°å; // åæå¡å¨ä¸éè¦æå® |
| | | return new ConnectionConfig() |
| | | ConnectionConfig connectConfig = null; |
| | | switch (RunParasHelper.Run.DataBase.DbType) |
| | | { |
| | | DbType = SqlSugar.DbType.PostgreSQL,//æ°æ®åºç±»å |
| | | ConnectionString = RunParasHelper.Run.DataBase.PostgreSql.RecordConnectString, |
| | | IsAutoCloseConnection = true,//æ¯å¦èªå¨å
³é |
| | | MoreSettings = new ConnMoreSettings() |
| | | { |
| | | //PgSqlIsAutoToLower = false //æ°æ®åºåå¨å¤§ååæ®µç ï¼éè¦æè¿ä¸ªè®¾ä¸ºfalse ï¼å¹¶ä¸å®ä½ååæ®µåç§°è¦ä¸æ · |
| | | }, |
| | | AopEvents = new AopEvents |
| | | { |
| | | OnLogExecuting = (sql, p) => |
| | | case DbType.PostgreSql: |
| | | { |
| | | //var sqlString = UtilMethods.GetNativeSql(sql, p); |
| | | // LogHelper.Debug(sqlString); |
| | | // Console.WriteLine(sql); |
| | | connectConfig = PostgreSqlRecordConnectionConfig; |
| | | } |
| | | } |
| | | }; |
| | | break; |
| | | case DbType.SQLite: |
| | | { |
| | | connectConfig = SQLiteRecordConnectionConfig; |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | return connectConfig; |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Run |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | internal class DbType |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public const string SQLite = "SQLite"; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public const string PostgreSql = "PostgreSql"; |
| | | } |
| | | } |
ÎļþÃû´Ó Yw.Service.Run.Core/01-entity/RunAnalyConfigure.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public RunAnalyConfigure(RunAnalyConfigurePure rhs) |
| | | { |
| | | this.ObjectType = rhs.ObjectType; |
| | | this.ObjectID = rhs.ObjectID; |
| | | this.Frequency = rhs.Frequency; |
| | | this.ChangeTimes = rhs.ChangeTimes; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public RunAnalyConfigure(RunAnalyConfigure rhs) : base(rhs) |
| | | { |
| | | this.ObjectType = rhs.ObjectType; |
| | | this.ObjectID = rhs.ObjectID; |
| | | this.Frequency = rhs.Frequency; |
| | | this.ChangeTimes = rhs.ChangeTimes; |
| | | this.Description = rhs.Description; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éç½® |
| | | /// </summary> |
| | | public void Reset(RunAnalyConfigurePure rhs) |
| | | { |
| | | this.ObjectType = rhs.ObjectType; |
| | | this.ObjectID = rhs.ObjectID; |
| | |
| | | /// <summary> |
| | | /// æ°æ®ç±»å |
| | | /// </summary> |
| | | [SugarColumn(Length = 50, IsNullable = true)] |
| | | public string ObjectType { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] |
| | | public string Description { get; set; } |
| | | |
| | | /// <summary> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Entity |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class RunAnalyConfigurePure |
| | | { |
| | | /// <summary> |
| | | /// æ°æ®ç±»å |
| | | /// </summary> |
| | | public string ObjectType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®id |
| | | /// </summary> |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç ï¼ç§ï¼ |
| | | /// </summary> |
| | | public int Frequency { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ¢æ¬¡æ° |
| | | /// </summary> |
| | | public int ChangeTimes { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Model |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class RunAnalyConfigurePure |
| | | { |
| | | /// <summary> |
| | | /// æ°æ®ç±»å |
| | | /// </summary> |
| | | public string ObjectType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°æ®id |
| | | /// </summary> |
| | | public long ObjectID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæé¢ç (ç§) |
| | | /// </summary> |
| | | public int Frequency { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ¢æ¬¡æ° |
| | | /// </summary> |
| | | public int ChangeTimes { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 说æ |
| | | /// </summary> |
| | | public string Description { get; set; } |
| | | } |
| | | } |
| | |
| | | public interface IRunAnalyConfigure : IBaseDAL<Entity.RunAnalyConfigure> |
| | | { |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID è·å |
| | | /// </summary> |
| | | Entity.RunAnalyConfigure GetByObjectTypeAndObjectID(string ObjectType, long ObjectID); |
| | | |
| | | /// <summary> |
| | | /// æå
¥ææ´æ° |
| | | /// </summary> |
| | | long InsertOrUpdate(Entity.RunAnalyConfigurePure pure); |
| | | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | bool Set(List<Entity.RunAnalyConfigure> entityList); |
| | | bool Set(List<Entity.RunAnalyConfigurePure> pureList); |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID å é¤ |
| | | /// </summary> |
| | | bool DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID); |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public Entity.RunAnalyConfigure GetByObjectTypeAndObjectID(string ObjectType, long ObjectID) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID) |
| | | .First(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public long InsertOrUpdate(Entity.RunAnalyConfigurePure pure) |
| | | { |
| | | if (pure == null) |
| | | { |
| | | return default; |
| | | } |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | var entity = db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == pure.ObjectType && x.ObjectID == pure.ObjectID) |
| | | .First(); |
| | | if (entity == null) |
| | | { |
| | | entity = new Entity.RunAnalyConfigure(pure); |
| | | } |
| | | else |
| | | { |
| | | entity.Reset(pure); |
| | | } |
| | | |
| | | if (entity.ID < 1) |
| | | { |
| | | entity.ID = db.Insertable(entity).ExecuteReturnSnowflakeId(); |
| | | if (entity.ID < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var bol = db.Updateable(entity).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | } |
| | | return entity.ID; |
| | | } |
| | | catch |
| | | { |
| | | db.RollbackTran(); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | public bool Set(List<Entity.RunAnalyConfigure> entityList) |
| | | public bool Set(List<Entity.RunAnalyConfigurePure> pureList) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | var ids = new List<long>(); |
| | | if (entityList != null && entityList.Count > 0) |
| | | if (pureList != null && pureList.Count > 0) |
| | | { |
| | | foreach (var entity in entityList) |
| | | foreach (var pure in pureList) |
| | | { |
| | | var entity = db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == pure.ObjectType && x.ObjectID == pure.ObjectID) |
| | | .First(); |
| | | if (entity == null) |
| | | { |
| | | entity = new Entity.RunAnalyConfigure(pure); |
| | | } |
| | | else |
| | | { |
| | | entity.Reset(pure); |
| | | } |
| | | |
| | | if (entity.ID < 1) |
| | | { |
| | | entity.ID = db.Insertable(entity).ExecuteReturnSnowflakeId(); |
| | |
| | | return false; |
| | | } |
| | | } |
| | | ids.Add(entity.ID); |
| | | } |
| | | } |
| | | |
| | | db.Deleteable<Entity.RunAnalyConfigure>().Where(x => !ids.Contains(x.ID)).ExecuteCommandHasChange(); |
| | | db.CommitTran(); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID å é¤ |
| | | /// </summary> |
| | | public bool DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Deleteable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID) |
| | | .ExecuteCommandHasChange(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public Entity.RunAnalyConfigure GetByObjectTypeAndObjectID(string ObjectType, long ObjectID) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID) |
| | | .First(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public long InsertOrUpdate(Entity.RunAnalyConfigurePure pure) |
| | | { |
| | | if (pure == null) |
| | | { |
| | | return default; |
| | | } |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | var entity = db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == pure.ObjectType && x.ObjectID == pure.ObjectID) |
| | | .First(); |
| | | if (entity == null) |
| | | { |
| | | entity = new Entity.RunAnalyConfigure(pure); |
| | | } |
| | | else |
| | | { |
| | | entity.Reset(pure); |
| | | } |
| | | |
| | | if (entity.ID < 1) |
| | | { |
| | | entity.ID = db.Insertable(entity).ExecuteReturnSnowflakeId(); |
| | | if (entity.ID < 1) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var bol = db.Updateable(entity).ExecuteCommandHasChange(); |
| | | if (!bol) |
| | | { |
| | | db.RollbackTran(); |
| | | return default; |
| | | } |
| | | } |
| | | return entity.ID; |
| | | } |
| | | catch |
| | | { |
| | | db.RollbackTran(); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | public bool Set(List<Entity.RunAnalyConfigure> entityList) |
| | | public bool Set(List<Entity.RunAnalyConfigurePure> pureList) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | try |
| | | { |
| | | db.BeginTran(); |
| | | var ids = new List<long>(); |
| | | if (entityList != null && entityList.Count > 0) |
| | | if (pureList != null && pureList.Count > 0) |
| | | { |
| | | foreach (var entity in entityList) |
| | | foreach (var pure in pureList) |
| | | { |
| | | var entity = db.Queryable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == pure.ObjectType && x.ObjectID == pure.ObjectID) |
| | | .First(); |
| | | if (entity == null) |
| | | { |
| | | entity = new Entity.RunAnalyConfigure(pure); |
| | | } |
| | | else |
| | | { |
| | | entity.Reset(pure); |
| | | } |
| | | |
| | | if (entity.ID < 1) |
| | | { |
| | | entity.ID = db.Insertable(entity).ExecuteReturnSnowflakeId(); |
| | |
| | | return false; |
| | | } |
| | | } |
| | | ids.Add(entity.ID); |
| | | } |
| | | } |
| | | |
| | | db.Deleteable<Entity.RunAnalyConfigure>().Where(x => !ids.Contains(x.ID)).ExecuteCommandHasChange(); |
| | | db.CommitTran(); |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID å é¤ |
| | | /// </summary> |
| | | public bool DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID) |
| | | { |
| | | using (var db = new SqlSugarClient(ConnectionConfig)) |
| | | { |
| | | return db.Deleteable<Entity.RunAnalyConfigure>() |
| | | .Where(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID) |
| | | .ExecuteCommandHasChange(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Service.Run |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static class RunAnalyConfigureExtensions |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static List<Entity.RunAnalyConfigurePure> ToEntityList(this List<Model.RunAnalyConfigurePure> modelList) |
| | | { |
| | | if (modelList == null || modelList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.RunAnalyConfigurePure, Entity.RunAnalyConfigurePure>() |
| | | ).CreateMapper(); |
| | | var entityList = mapper.Map<List<Model.RunAnalyConfigurePure>, List<Entity.RunAnalyConfigurePure>>(modelList); |
| | | return entityList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static Entity.RunAnalyConfigurePure ToEntity(this Model.RunAnalyConfigurePure model) |
| | | { |
| | | if (model == null) |
| | | { |
| | | return default; |
| | | } |
| | | var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.RunAnalyConfigurePure, Entity.RunAnalyConfigurePure>() |
| | | ).CreateMapper(); |
| | | |
| | | var entity = mapper.Map<Model.RunAnalyConfigurePure, Entity.RunAnalyConfigurePure>(model); |
| | | return entity; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | namespace Yw.Service.Run |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class DbFirstHelper |
| | | { |
| | | /// <summary> |
| | | /// åå§å |
| | | /// </summary> |
| | | public static bool Initial(out string msg) |
| | | { |
| | | msg = string.Empty; |
| | | try |
| | | { |
| | | |
| | | var connectConfig = Yw.Run.ConfigHelper.DefaultConnectionConfig; |
| | | if (connectConfig == null) |
| | | { |
| | | msg = "è¿æ¥é
ç½®åå§å失败"; |
| | | return false; |
| | | } |
| | | |
| | | connectConfig.ConfigureExternalServices = new ConfigureExternalServices() |
| | | { |
| | | EntityService = (property, column) => |
| | | { |
| | | //é¤ä¸»é®å¤å
¶ä»åé½å¯ç©º |
| | | if (!column.IsPrimarykey) |
| | | { |
| | | column.IsNullable = true; |
| | | } |
| | | if (column.DataType == StaticConfig.CodeFirst_BigString) |
| | | { |
| | | if (RunParasHelper.Run.DataBase.DbType == Yw.Run.DbType.PostgreSql) |
| | | { |
| | | column.DataType = "character varying"; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | var typeList = new List<Type>() |
| | | { |
| | | typeof(Entity.RunAnalyConfigure) |
| | | }; |
| | | |
| | | using (var db = new SqlSugarClient(connectConfig)) |
| | | { |
| | | //设置å符串é»è®¤é¿åº¦ |
| | | //db.CodeFirst.SetStringDefaultLength(250); |
| | | //db.CodeFirst.SetStringDefaultLength(int.MaxValue); |
| | | //建åºï¼å¦æä¸åå¨åå»ºæ°æ®åºåå¨ä¸ä¼éå¤å建 createdb;注æ ï¼Oracleå个å«å½äº§åºé䏿¯æè¯¥æ¹æ³ï¼éè¦æå¨å»ºåº |
| | | db.DbMaintenance.CreateDatabase(); |
| | | db.CodeFirst.InitTables |
| | | ( |
| | | typeList.ToArray() |
| | | ); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | msg = ex.Message; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //ç§»é¤ç¼å |
| | | private static void RemoveCacheByObjectTypeAndObjectID(string ObjectType, long ObjectID) |
| | | { |
| | | var all = GetCache(); |
| | | all.RemoveAll(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID); |
| | | RunAnalyConfigureCacheHelper.Trigger(); |
| | | } |
| | | |
| | | //ç§»é¤ç¼å |
| | | private static void RemoveCache() |
| | | { |
| | | RunAnalyConfigureCacheHelper.Remove(); |
| | |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå
¥ææ´æ° |
| | | /// </summary> |
| | | public long InsertOrUpdate(Model.RunAnalyConfigurePure pure) |
| | | { |
| | | if (pure == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>(); |
| | | var entity = pure.ToEntity(); |
| | | var id = dal.InsertOrUpdate(entity); |
| | | if (id > 0) |
| | | { |
| | | UpdateCache(id); |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Update |
| | |
| | | { |
| | | if (model == null) |
| | | { |
| | | return default; |
| | | return false; |
| | | } |
| | | if (model.ID < 1) |
| | | { |
| | | return default; |
| | | return false; |
| | | } |
| | | var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>(); |
| | | var entity = Model2Entity(model); |
| | |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return default; |
| | | return false; |
| | | } |
| | | if (list.ToList().Exists(x => x.ID < 1)) |
| | | if (list.Exists(x => x.ID < 1)) |
| | | { |
| | | return default; |
| | | return false; |
| | | } |
| | | var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>(); |
| | | var entity_list = Model2Entities(list.ToList()); |
| | | var entity_list = Model2Entities(list); |
| | | var bol = dal.Updates(entity_list); |
| | | if (bol) |
| | | { |
| | |
| | | return bol; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿ ObjectType å ObjectID å é¤ |
| | | /// </summary> |
| | | public bool DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID, out string Msg) |
| | | { |
| | | Msg = string.Empty; |
| | | var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>(); |
| | | var bol = dal.DeleteByObjectTypeAndObjectID(ObjectType, ObjectID); |
| | | if (bol) |
| | | { |
| | | RemoveCacheByObjectTypeAndObjectID(ObjectType, ObjectID); |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Set |
| | |
| | | /// <summary> |
| | | /// 设置 |
| | | /// </summary> |
| | | public bool Set(List<Model.RunAnalyConfigure> list) |
| | | public bool Set(List<Model.RunAnalyConfigurePure> list, out string Msg) |
| | | { |
| | | var entityList = Model2Entities(list); |
| | | Msg = string.Empty; |
| | | if (list == null || list.Count < 1) |
| | | { |
| | | return false; |
| | | } |
| | | var entityList = list.ToEntityList(); |
| | | var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>(); |
| | | var bol = dal.Set(entityList); |
| | | if (bol) |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2024-06-19T11:42:06.2329654Z;True|2024-05-31T15:21:11.9622287+08:00;True|2024-05-08T14:21:37.5917430+08:00;True|2024-04-30T13:45:44.5067765+08:00;True|2024-04-30T11:25:45.6839060+08:00;True|2024-04-30T11:25:41.5354173+08:00;True|2024-04-26T11:47:42.9605330+08:00;True|2024-04-01T11:38:17.4702370+08:00;True|2024-03-26T09:45:14.8395625+08:00;True|2024-01-21T14:51:15.9123805+08:00;True|2024-01-08T16:59:10.2219250+08:00;True|2023-12-16T15:42:50.6196932+08:00;True|2023-12-11T11:51:25.0044564+08:00;True|2023-12-11T11:25:16.9392998+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> |
| | | <History>True|2024-07-17T04:22:58.4192354Z;True|2024-06-19T19:42:06.2329654+08:00;True|2024-05-31T15:21:11.9622287+08:00;True|2024-05-08T14:21:37.5917430+08:00;True|2024-04-30T13:45:44.5067765+08:00;True|2024-04-30T11:25:45.6839060+08:00;True|2024-04-30T11:25:41.5354173+08:00;True|2024-04-26T11:47:42.9605330+08:00;True|2024-04-01T11:38:17.4702370+08:00;True|2024-03-26T09:45:14.8395625+08:00;True|2024-01-21T14:51:15.9123805+08:00;True|2024-01-08T16:59:10.2219250+08:00;True|2023-12-16T15:42:50.6196932+08:00;True|2023-12-11T11:51:25.0044564+08:00;True|2023-12-11T11:25:16.9392998+08:00;True|2023-07-13T11:54:33.7989040+08:00;True|2023-07-13T11:54:23.3967174+08:00;True|2023-07-06T09:49:52.7407983+08:00;True|2023-05-25T15:37:23.5406830+08:00;False|2023-05-25T15:36:09.3589239+08:00;</History> |
| | | <LastFailureDetails /> |
| | | </PropertyGroup> |
| | | </Project> |
| | |
| | | <RootNamespace>Yw</RootNamespace> |
| | | <GenerateDocumentationFile>True</GenerateDocumentationFile> |
| | | <GeneratePackageOnBuild>True</GeneratePackageOnBuild> |
| | | <Version>3.0.9</Version> |
| | | <Version>3.1.0</Version> |
| | | <Description>å¼ç¨å级</Description> |
| | | </PropertyGroup> |
| | | |
| | |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Yw.DAL.PostgreSql.Core" Version="3.0.6" /> |
| | | <PackageReference Include="Yw.DAL.SQLite.Core" Version="3.0.6" /> |
| | | <PackageReference Include="Yw.DALFactory.Core" Version="3.0.1" /> |
| | | <PackageReference Include="Yw.ExchangeFactory.Core" Version="3.0.1" /> |
| | | <PackageReference Include="Yw.LCacheFactory.Core" Version="3.0.1" /> |
| | | <PackageReference Include="Yw.DAL.PostgreSql.Core" Version="3.0.7" /> |
| | | <PackageReference Include="Yw.DAL.SQLite.Core" Version="3.0.7" /> |
| | | <PackageReference Include="Yw.DALFactory.Core" Version="3.0.2" /> |
| | | <PackageReference Include="Yw.ExchangeFactory.Core" Version="3.0.2" /> |
| | | <PackageReference Include="Yw.LCacheFactory.Core" Version="3.0.2" /> |
| | | <PackageReference Include="Yw.Medis.Core" Version="3.0.0" /> |
| | | <PackageReference Include="Yw.MemoryQueue.Core" Version="3.0.0" /> |
| | | <PackageReference Include="Yw.QueueFactory.Core" Version="3.0.1" /> |
| | | <PackageReference Include="Yw.QueueFactory.Core" Version="3.0.2" /> |
| | | <PackageReference Include="Yw.RabbitMq.Core" Version="3.0.0" /> |
| | | <PackageReference Include="Yw.Redis.Core" Version="3.0.0" /> |
| | | <PackageReference Include="Yw.Service.Core" Version="3.0.3" /> |
| | | <PackageReference Include="Yw.Service.Core" Version="3.0.6" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | "CAL": { |
| | | "CALType": "HttpClient", //HttpClient/LocalClient |
| | | "HttpClient": { |
| | | "HttpUrl": "http://101.133.133.173:97" |
| | | "HttpUrl": "" |
| | | }, |
| | | "LocalClient": { |
| | | } |
| | |
| | | using Topshelf; |
| | | |
| | | //SZJT |
| | | HostFactory.Run(x => |
| | | { |
| | | x.Service<Service>(); |
| | | x.RunAsLocalSystem(); |
| | | x.SetDescription("æºæ
§æ³µç«Coreçè¿è¡åæç¨åº(SZJT)"); |
| | | x.SetDisplayName("IStation.Core.Server.Run.SZJT"); |
| | | x.SetServiceName("IStation.Core.Server.Run.SZJT"); |
| | | x.EnableServiceRecovery(r => r.RestartService(TimeSpan.FromSeconds(120))); |
| | | x.StartAutomatically(); |
| | | }); |
| | | |
| | | |
| | | //SMI |
| | | //HostFactory.Run(x => |
| | | //{ |
| | | // x.Service<Service>(); |
| | | // x.RunAsLocalSystem(); |
| | | // x.SetDescription("æºæ
§æ³µç«Coreçè¿è¡åæç¨åº(SMI)"); |
| | | // x.SetDisplayName("IStation.Core.Server.Run.SMI"); |
| | | // x.SetServiceName("IStation.Core.Server.Run.SMI"); |
| | | // x.SetDescription("æºæ
§æ³µç«Coreçè¿è¡åæç¨åº(SZJT)"); |
| | | // x.SetDisplayName("IStation.Core.Server.Run.SZJT"); |
| | | // x.SetServiceName("IStation.Core.Server.Run.SZJT"); |
| | | // x.EnableServiceRecovery(r => r.RestartService(TimeSpan.FromSeconds(120))); |
| | | // x.StartAutomatically(); |
| | | //}); |
| | | |
| | | |
| | | //SMI |
| | | HostFactory.Run(x => |
| | | { |
| | | x.Service<Service>(); |
| | | x.RunAsLocalSystem(); |
| | | x.SetDescription("æºæ
§æ³µç«Coreçè¿è¡åæç¨åº(SMI)"); |
| | | x.SetDisplayName("IStation.Core.Server.Run.SMI"); |
| | | x.SetServiceName("IStation.Core.Server.Run.SMI"); |
| | | x.EnableServiceRecovery(r => r.RestartService(TimeSpan.FromSeconds(120))); |
| | | x.StartAutomatically(); |
| | | }); |
| | | |
| | | |
| | | //PHM |
| | | //HostFactory.Run(x => |
| | | //{ |
| | |
| | | --> |
| | | <Project> |
| | | <PropertyGroup> |
| | | <History>True|2024-05-10T03:12:55.4519037Z;True|2024-05-09T17:33:36.3181674+08:00;True|2024-05-04T21:41:10.0872570+08:00;True|2024-04-26T13:38:39.5183442+08:00;False|2024-04-26T13:36:48.1771029+08:00;True|2024-04-04T16:12:48.6153997+08:00;</History> |
| | | <History>True|2024-06-22T15:59:23.5776860Z;True|2024-06-21T11:37:51.0791047+08:00;True|2024-05-10T11:12:55.4519037+08:00;True|2024-05-09T17:33:36.3181674+08:00;True|2024-05-04T21:41:10.0872570+08:00;True|2024-04-26T13:38:39.5183442+08:00;False|2024-04-26T13:36:48.1771029+08:00;True|2024-04-04T16:12:48.6153997+08:00;</History> |
| | | <LastFailureDetails /> |
| | | </PropertyGroup> |
| | | </Project> |