71 lines
2.4 KiB
C#
71 lines
2.4 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 自定义开发服务示例
|
|
/// </summary>
|
|
[ApiDescriptionSettings(Tag = "ProductionMgr", Area = "production", Order = 503)]
|
|
[Route("api/[area]/[controller]/[action]")]
|
|
[OverideVisualDev(ModelId)]
|
|
public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient
|
|
{
|
|
//要重写默认接口的功能Id,关联的是在线开发-功能设计里功能
|
|
private const string ModelId = "377972195550300357";
|
|
private readonly ISqlSugarRepository<UserEntity> _repository;
|
|
private readonly IUserManager _userManager;
|
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
|
|
|
public SampleService(
|
|
IUserManager userManager,
|
|
ISqlSugarRepository<UserEntity> repository)
|
|
{
|
|
_userManager = userManager;
|
|
_repository = repository;
|
|
//要重写的默认接口
|
|
OverideFuncs.GetListAsync = GetList;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取数据列表.
|
|
/// </summary>
|
|
/// <param name="input">分页查询条件.</param>
|
|
/// <returns></returns>
|
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
|
{
|
|
var db = _repository.AsSugarClient();
|
|
var ls = await db.Queryable<UserEntity>().Where(a => a.DeleteMark == null).ToPagedListAsync(input.currentPage, input.pageSize);
|
|
return new PageResult<UserEntity>
|
|
{
|
|
pagination = ls.pagination.Adapt<JNPF.Common.Filter.PageResult>(),
|
|
list = ls.list.ToList()
|
|
};
|
|
}
|
|
|
|
[HttpPost]
|
|
public Task<int> SendSampleData(VisualDevModelListQueryInput input)
|
|
{
|
|
return Task.FromResult(1);
|
|
}
|
|
|
|
}
|
|
} |