修改用户、职位查询,增加职位搜索用户功能

optimize
jianghaiqing 2 years ago
parent c80c93cc54
commit d0ffbb94ea

@ -11893,6 +11893,14 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.DjyWebsiteAccountConfigService.GetAccountConfig(System.String,System.Int64)">
<summary>
获取接口Key 个人或公司
</summary>
<param name="TypeCode"></param>
<param name="UserId"></param>
<returns></returns>
</member>
<member name="T:Myshipping.Core.Service.DjyWebsiteAccountConfigInput">
<summary>
网站账号维护输入参数
@ -12523,6 +12531,18 @@
职位名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.EmpPosOutput.SysEmpName">
<summary>
员工名称
</summary>
</member>
<member name="M:Myshipping.Core.Service.ISysEmpPosService.GetAllEmpByPos(System.Collections.Generic.List{System.String})">
<summary>
通过职位代码列表获取人员ID信息
</summary>
<param name="posCodeList">职位代码列表</param>
<returns>返回人员ID列表</returns>
</member>
<member name="T:Myshipping.Core.Service.SysEmpExtOrgPosService">
<summary>
员工附属机构和职位服务
@ -12595,6 +12615,13 @@
<param name="empId"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysEmpPosService.GetAllEmpByPos(System.Collections.Generic.List{System.String})">
<summary>
通过职位代码列表获取人员ID信息
</summary>
<param name="posCodeList">职位代码列表</param>
<returns>返回人员ID列表</returns>
</member>
<member name="T:Myshipping.Core.Service.SysEmpService">
<summary>
员工服务
@ -15527,6 +15554,14 @@
<param name="TenantId">默认0 获取当前用户,可不传 传租户id获取当前租户</param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysUserService.QueryUserByPos(System.String,System.String)">
<summary>
获取租户下的用户
</summary>
<param name="name"></param>
<param name="pos">职位代码 PCDD-调度</param>
<returns>返回用户详情</returns>
</member>
<member name="T:Myshipping.Core.DjyEdiSettingDto">
<summary>
EDI参数设置输出参数

@ -23,4 +23,9 @@ public class EmpPosOutput
/// 职位名称
/// </summary>
public string PosName { get; set; }
/// <summary>
/// 员工名称
/// </summary>
public string SysEmpName { get; set; }
}

@ -10,4 +10,12 @@ public interface ISysEmpPosService
Task<List<EmpPosOutput>> GetEmpPosList(long empId);
Task<List<EmpPosOutput>> GetEmpPosList(List<long> empIds);
Task<bool> HasPosEmp(long posId);
/// <summary>
/// 通过职位代码列表获取人员ID信息
/// </summary>
/// <param name="posCodeList">职位代码列表</param>
/// <returns>返回人员ID列表</returns>
Task<List<EmpPosOutput>> GetAllEmpByPos(List<string> posCodeList);
}

@ -15,10 +15,12 @@ namespace Myshipping.Core.Service;
public class SysEmpPosService : ISysEmpPosService, ITransient
{
private readonly SqlSugarRepository<SysEmpPos> _sysEmpPosRep; // 员工职位表仓储
private readonly SqlSugarRepository<SysPos> _sysPosRep;
public SysEmpPosService(SqlSugarRepository<SysEmpPos> sysEmpPosRep)
public SysEmpPosService(SqlSugarRepository<SysEmpPos> sysEmpPosRep, SqlSugarRepository<SysPos> sysPosRep)
{
_sysEmpPosRep = sysEmpPosRep;
_sysPosRep = sysPosRep;
}
/// <summary>
@ -105,4 +107,27 @@ public class SysEmpPosService : ISysEmpPosService, ITransient
{
await _sysEmpPosRep.DeleteAsync(u => u.SysEmpId == empId);
}
/// <summary>
/// 通过职位代码列表获取人员ID信息
/// </summary>
/// <param name="posCodeList">职位代码列表</param>
/// <returns>返回人员ID列表</returns>
public async Task<List<EmpPosOutput>> GetAllEmpByPos(List<string> posCodeList)
{
var query = _sysPosRep.AsQueryable().Where(a => posCodeList.Contains(a.Code));
var list = await query.InnerJoin<SysEmpPos>((l,r)=>l.Id == r.SysPosId)
.InnerJoin<SysUser>((l,r,x)=> r.SysEmpId == x.Id)
.Select((l, r,x) => new EmpPosOutput
{
PosId = l.Id,
PosCode = l.Code,
PosName = l.Name,
SysEmpId = x.Id,
SysEmpName = x.Name
}).ToListAsync();
return list;
}
}

@ -37,13 +37,15 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
private readonly ISysEmpService _sysEmpService;
private readonly ISysUserDataScopeService _sysUserDataScopeService;
private readonly ISysUserRoleService _sysUserRoleService;
private readonly ISysEmpPosService _sysEmpPosService;
public SysUserService(SqlSugarRepository<SysUser> sysUserRep,
ISysCacheService sysCacheService,
ISysEmpService sysEmpService,
ISysUserDataScopeService sysUserDataScopeService,
ISysUserRoleService sysUserRoleService,
ISysConfigService sysConfigService)
ISysConfigService sysConfigService,
ISysEmpPosService sysEmpPosService)
{
_sysUserRep = sysUserRep;
_sysCacheService = sysCacheService;
@ -51,6 +53,7 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
_sysUserDataScopeService = sysUserDataScopeService;
_sysUserRoleService = sysUserRoleService;
_sysConfigService = sysConfigService;
_sysEmpPosService = sysEmpPosService;
}
/// <summary>
@ -597,4 +600,26 @@ public class SysUserService : ISysUserService, IDynamicApiController, ITransient
throw Oops.Bah("没有权限");
}
/// <summary>
/// 通过职位获取用户信息
/// </summary>
/// <param name="name"></param>
/// <param name="pos">职位代码 PCDD-调度</param>
/// <returns>返回用户详情</returns>
[HttpGet("/sysUser/QueryUserByPos")]
public async Task<List<EmpPosOutput>> QueryUserByPos([FromQuery] string name, [FromQuery] string pos)
{
if (string.IsNullOrWhiteSpace(pos))
Oops.Oh("没有权限");
var allList = await _sysEmpPosService.GetAllEmpByPos(new List<string> { pos });
if (allList.Count > 0 && !string.IsNullOrWhiteSpace(name))
{
allList = allList.Where(a => a.SysEmpName.Contains(name.Trim())).ToList();
}
return allList;
}
}

Loading…
Cancel
Save