From b8873eac2e19f050cb4b6c8cfa1a2f5a8b88f7eb Mon Sep 17 00:00:00 2001 From: PhilPan Date: Wed, 19 Apr 2023 10:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=86=99=E9=BB=98?= =?UTF-8?q?=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