2018-04-13 17:25:49 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2020-12-17 23:04:04 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2021-10-18 00:42:29 +08:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2020-10-22 14:59:36 +08:00
|
|
|
|
using OpenAuth.App.Interface;
|
2018-04-13 17:25:49 +08:00
|
|
|
|
using OpenAuth.App.Request;
|
2020-12-29 23:52:06 +08:00
|
|
|
|
using OpenAuth.Repository;
|
2018-04-13 17:25:49 +08:00
|
|
|
|
using OpenAuth.Repository.Domain;
|
2020-10-22 14:59:36 +08:00
|
|
|
|
using OpenAuth.Repository.Interface;
|
2023-08-27 00:23:45 +08:00
|
|
|
|
using SqlSugar;
|
2018-04-13 17:25:49 +08:00
|
|
|
|
|
|
|
|
|
namespace OpenAuth.App
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2023-08-27 00:23:45 +08:00
|
|
|
|
/// 应用管理
|
2018-04-13 17:25:49 +08:00
|
|
|
|
/// </summary>
|
2023-08-27 00:23:45 +08:00
|
|
|
|
public class AppManager : SqlSugarBaseApp<Application>
|
2018-04-13 17:25:49 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
public AppManager(ISqlSugarClient client) : base(client, null)
|
2021-04-17 17:06:48 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2023-08-27 00:23:45 +08:00
|
|
|
|
public void Add(Application application)
|
2018-04-13 17:25:49 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
if (string.IsNullOrEmpty(application.Id))
|
2018-04-13 17:25:49 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
application.Id = Guid.NewGuid().ToString();
|
2018-04-13 17:25:49 +08:00
|
|
|
|
}
|
2021-04-17 17:06:48 +08:00
|
|
|
|
|
2023-08-27 00:23:45 +08:00
|
|
|
|
Repository.Insert(application);
|
2018-04-13 17:25:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-27 00:23:45 +08:00
|
|
|
|
public void Update(Application application)
|
2018-04-13 17:25:49 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
Repository.Update(application);
|
2018-04-13 17:25:49 +08:00
|
|
|
|
}
|
2023-08-27 00:23:45 +08:00
|
|
|
|
|
2020-12-17 23:04:04 +08:00
|
|
|
|
public async Task<List<Application>> GetList(QueryAppListReq request)
|
2018-04-13 17:25:49 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
var applications = Repository.GetListAsync();
|
2021-04-17 17:06:48 +08:00
|
|
|
|
|
2023-08-27 00:23:45 +08:00
|
|
|
|
return await applications;
|
2018-04-13 17:25:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-17 17:06:48 +08:00
|
|
|
|
|
|
|
|
|
public Application GetByAppKey(string modelAppKey)
|
2020-10-22 14:59:36 +08:00
|
|
|
|
{
|
2023-08-27 00:23:45 +08:00
|
|
|
|
return Repository.GetFirst(u => u.AppSecret == modelAppKey);
|
|
|
|
|
}
|
2023-09-17 11:41:42 +08:00
|
|
|
|
|
2018-04-13 17:25:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|