ZrAdminNetCore/ZR.Repository/System/SysUserPostRepository.cs
不做码农 40026f596f 测试
2021-09-27 08:06:09 +08:00

28 lines
815 B
C#

using Infrastructure.Attribute;
using SqlSugar;
using System.Collections.Generic;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 用户岗位
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysUserPostRepository : BaseRepository<SysUserPost>
{
/// <summary>
/// 获取用户岗位
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<SysPost> SelectPostsByUserId(long userId)
{
return Context.Queryable<SysPost, SysUserPost>((p, up) => new JoinQueryInfos(
JoinType.Left, up.PostId == p.PostId
)).Where((p, up) => up.UserId == userId)
.Select<SysPost>().ToList();
}
}
}