招聘后台
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

using Dapper;
using System.Collections.Generic;
using System.Linq;
using Znyc.Recruitment.Admin.Commons.IDbContext;
using Znyc.Recruitment.Admin.Commons.Repositories;
using Znyc.Recruitment.Admin.Security.Dtos;
using Znyc.Recruitment.Admin.Security.Entitys;
using Znyc.Recruitment.Admin.Security.IRepositories;
namespace Znyc.Recruitment.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();
}
}
}