From a86dd288c2c6245a9666ecdbd67b3497a432ef4e Mon Sep 17 00:00:00 2001 From: PhilPan Date: Mon, 17 Apr 2023 14:48:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9=E4=B8=BAtianyi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihost/Tnb.API.Entry/Configurations/Cache.json | 2 +- .../Tnb.API.Entry/Configurations/ConnectionStrings.json | 2 +- system/Tnb.Systems/System/DbLinkService.cs | 8 +------- visualdev/Tnb.VisualDev/CodeGenService.cs | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/apihost/Tnb.API.Entry/Configurations/Cache.json b/apihost/Tnb.API.Entry/Configurations/Cache.json index 77f3c33b..8f0ff1f3 100644 --- a/apihost/Tnb.API.Entry/Configurations/Cache.json +++ b/apihost/Tnb.API.Entry/Configurations/Cache.json @@ -4,6 +4,6 @@ "ip": "localhost", "port": 6379, "password": "05jWEoJa8v", - "RedisConnectionString": "{0}:{1},password={2}, poolsize=500,ssl=false,defaultDatabase=6" + "RedisConnectionString": "{0}:{1},password={2}, poolsize=500,ssl=false,defaultDatabase=7" } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json index 2b96adcf..aeadd7ea 100644 --- a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json +++ b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json @@ -4,7 +4,7 @@ "DBType": "PostgreSQL", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite; "Host": "localhost", "Port": "5432", - "DBName": "tnb_bas", + "DBName": "tianyi_bas", "UserName": "totong", "Password": "IPANyxGSKxIXg0dBM", //SqlServer diff --git a/system/Tnb.Systems/System/DbLinkService.cs b/system/Tnb.Systems/System/DbLinkService.cs index 60fc9d88..6a337e44 100644 --- a/system/Tnb.Systems/System/DbLinkService.cs +++ b/system/Tnb.Systems/System/DbLinkService.cs @@ -318,13 +318,7 @@ public class DbLinkService : IDbLinkService, IDynamicApiController, ITransient [NonAction] public async Task GetInfo(string id) { - var model = await _memCache.GetOrCreateAsync($"DbLink_{id}", async entry => - { - //entry.AbsoluteExpiration = DateTime.Now.AddMinutes(60); - //entry.SlidingExpiration = TimeSpan.FromSeconds(-1); - return await _repository.AsSugarClient().CopyNew().Queryable().FirstAsync(m => m.Id == id && m.DeleteMark == null); - }); - return model; + return await _repository.AsSugarClient().CopyNew().Queryable().FirstAsync(m => m.Id == id && m.DeleteMark == null); } #endregion } \ No newline at end of file diff --git a/visualdev/Tnb.VisualDev/CodeGenService.cs b/visualdev/Tnb.VisualDev/CodeGenService.cs index aa36153b..9d9a205d 100644 --- a/visualdev/Tnb.VisualDev/CodeGenService.cs +++ b/visualdev/Tnb.VisualDev/CodeGenService.cs @@ -1513,7 +1513,7 @@ public class CodeGenService : IDynamicApiController, ITransient IsFixed = frondEndGenConfig.IsFixed, }, builderAction: builder => { - builder.AddUsing("Tnb.VisualDev.Engine.Model.CodeGen"); + builder.AddUsing("JNPF.VisualDev.Engine.Model.CodeGen"); builder.AddAssemblyReferenceByName("Tnb.VisualDev.Engine"); }); var dirPath = new DirectoryInfo(targetPathList[i]).Parent.FullName; From b8873eac2e19f050cb4b6c8cfa1a2f5a8b88f7eb Mon Sep 17 00:00:00 2001 From: PhilPan Date: Wed, 19 Apr 2023 10:32:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=86=99?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=8E=A5=E5=8F=A3=E7=9A=84sample?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/Tnb.Systems/Common/SampleService.cs | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 system/Tnb.Systems/Common/SampleService.cs diff --git a/system/Tnb.Systems/Common/SampleService.cs b/system/Tnb.Systems/Common/SampleService.cs new file mode 100644 index 00000000..ede4cc05 --- /dev/null +++ b/system/Tnb.Systems/Common/SampleService.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Aspose.Cells; +using JNPF.Common.Core.Manager; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; +using NPOI.Util; +using SqlSugar; +using JNPF.Systems.Entitys.Permission; +using Mapster; +using JNPF.Common.Filter; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Tnb.BasicData +{ + /// + /// 应急管理局:安全生产监管 + /// + [ApiDescriptionSettings(Name = "Test", Order = 306)] + [Route("api")] + [OverideVisualDev(ModelId)] + public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient + { + //要重写默认接口的功能Id,关联的是在线开发-功能设计里功能 + private const string ModelId = "377972195550300357"; + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + + public SampleService( + IUserManager userManager, + ISqlSugarRepository repository) + { + _userManager = userManager; + _repository = repository; + //要重写的默认接口 + OverideFuncs.GetListAsync = GetList; + } + + /// + /// 获取数据列表. + /// + /// 分页查询条件. + /// + private async Task GetList(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + var ls = await db.Queryable().Where(a => a.DeleteMark == null).ToPagedListAsync(input.currentPage, input.pageSize); + return new PageResult + { + pagination = ls.pagination.Adapt(), + list = ls.list.ToList() + }; + } + + } +} \ No newline at end of file