ApiJsonService.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using APIJSON.NET.Services;
  2. using Newtonsoft.Json.Linq;
  3. namespace Admin.NET.Core.Service.ApiJson;
  4. /// <summary>
  5. /// 系统数据库管理服务
  6. /// </summary>
  7. [ApiDescriptionSettings(Order = 251)]
  8. public class ApiJsonService : IDynamicApiController, ITransient
  9. {
  10. private SelectTable selectTable;
  11. private readonly ISqlSugarClient _db;
  12. private readonly IViewEngine _viewEngine;
  13. private readonly CodeGenOptions _codeGenOptions;
  14. //private readonly ApiJsnOptions _roles;
  15. private readonly IIdentityService _identitySvc;
  16. private ITableMapper _tableMapper;
  17. public ApiJsonService(ISqlSugarClient db,
  18. IViewEngine viewEngine,
  19. IOptions<CodeGenOptions> codeGenOptions,
  20. IOptions<ApiJsonOptions> adaOptions,
  21. IIdentityService identityService,
  22. ITableMapper tableMapper)
  23. {
  24. _db = db;
  25. _viewEngine = viewEngine;
  26. //_codeGenOptions = codeGenOptions.Value;
  27. //_roles = roles.Value;
  28. _tableMapper = tableMapper;
  29. _identitySvc = identityService;
  30. selectTable = new SelectTable(_identitySvc, _tableMapper, _db);
  31. }
  32. /// <summary>
  33. /// ApiJson 统一入口
  34. /// </summary>
  35. /// <param name="jobject"></param>
  36. /// <returns></returns>
  37. public JObject Post([FromBody] JObject jobject)
  38. {
  39. JObject resultJobj = new SelectTable(_identitySvc, _tableMapper, _db).Query(jobject);
  40. return resultJobj;
  41. }
  42. }