You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
59 lines
2.0 KiB
2 years ago
|
using Dapper;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using Znyc.Cloudcar.Admin.Commons.IDbContext;
|
||
|
using Znyc.Cloudcar.Admin.Commons.Repositories;
|
||
|
using Znyc.Cloudcar.Admin.Security.Dtos;
|
||
|
using Znyc.Cloudcar.Admin.Security.Entitys;
|
||
|
using Znyc.Cloudcar.Admin.Security.IRepositories;
|
||
|
|
||
|
namespace Znyc.Cloudcar.Admin.Security.Repositories
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Ӧ�òִ�ʵ��
|
||
|
/// </summary>
|
||
|
public class APPRepository : BaseRepository<APPEntity, long>, IAPPRepository
|
||
|
{
|
||
|
public APPRepository()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public APPRepository(IDbContextCore context) : base(context)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// ��ȡapp����
|
||
|
/// </summary>
|
||
|
/// <param name="appid">Ӧ��ID</param>
|
||
|
/// <param name="secret">Ӧ����ԿAppSecret</param>
|
||
|
/// <returns></returns>
|
||
|
public APPEntity GetAPP(string appid, string secret)
|
||
|
{
|
||
|
string sql = @"SELECT * FROM sys_app t WHERE t.AppId = @AppId and AppSecret=@AppSecret and IsDeleted=0";
|
||
|
return DapperConnRead.QueryFirstOrDefault<APPEntity>(sql, new { AppId = appid, AppSecret = secret });
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// ��ȡapp����
|
||
|
/// </summary>
|
||
|
/// <param name="appid">Ӧ��ID</param>
|
||
|
/// <returns></returns>
|
||
|
public APPEntity GetAPP(string appid)
|
||
|
{
|
||
|
string sql = @"SELECT * FROM sys_app t WHERE t.AppId = @AppId and IsDeleted=0";
|
||
|
return DapperConnRead.QueryFirstOrDefault<APPEntity>(sql, new { AppId = appid });
|
||
|
}
|
||
|
|
||
|
public IList<AppOutputDto> SelectApp()
|
||
|
{
|
||
|
const string query =
|
||
|
@"select a.*,u.id as Id,u.UserName,u.Account,u.HeadIcon from sys_app a,sys_adminuser u where a.CreatedUserId=u.Id ";
|
||
|
return DapperConnRead.Query<AppOutputDto, AdminUserEntity, AppOutputDto>(query, (app, user) =>
|
||
|
{
|
||
|
app.UserInfo = user;
|
||
|
return app;
|
||
|
}).ToList();
|
||
|
}
|
||
|
}
|
||
|
}
|