获取机构修改

dev
cjy 2 months ago
parent 5441b21e18
commit 5adbb97c5c

@ -15,3 +15,20 @@ public class ApiSelectViewModel
/// </summary> /// </summary>
public long Value { get; set; } public long Value { get; set; }
} }
/// <summary>
/// 机构远程Api 下拉选项
/// </summary>
public class OrgApiSelectViewModel
{
/// <summary>
///
/// </summary>
public string Label { get; set; }
/// <summary>
///
/// </summary>
public long Id { get; set; }
}

@ -101,7 +101,7 @@ public interface ICommonService
/// 获取机构下拉列表 /// 获取机构下拉列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
DataResult<List<ApiSelectViewModel>> GetOrgList(string queryKey = ""); DataResult<List<OrgApiSelectViewModel>> GetOrgList(string queryKey = "");
/// <summary> /// <summary>
/// 获取商品类型下拉列表 /// 获取商品类型下拉列表
/// </summary> /// </summary>

@ -967,19 +967,19 @@ public class CommonService : ICommonService
/// 获取机构下拉列表 /// 获取机构下拉列表
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public DataResult<List<ApiSelectViewModel>> GetOrgList(string queryKey = "") public DataResult<List<OrgApiSelectViewModel>> GetOrgList(string queryKey = "")
{ {
var list = db.Queryable<SysOrg>().Where(a => a.Status == StatusEnum.Enable && a.IsDepartment == false) var list = db.Queryable<SysOrg>().Where(a => a.Status == StatusEnum.Enable && a.IsDepartment == false)
.WhereIF(!string.IsNullOrEmpty(queryKey), a => (a.OrgName.Contains(queryKey) || a.OrgFullName.Contains(queryKey) || a.OrgEnName.Contains(queryKey))) .WhereIF(!string.IsNullOrEmpty(queryKey), a => (a.OrgName.Contains(queryKey) || a.OrgFullName.Contains(queryKey) || a.OrgEnName.Contains(queryKey)))
.Select(a => new ApiSelectViewModel .Select(a => new OrgApiSelectViewModel
{ {
Label = a.OrgName, Label = a.OrgName,
Value = a.Id, Id = a.Id,
}) })
.Take(20) .Take(20)
.WithCache($"{SqlSugarCacheConst.Org}{user.TenantId}") .WithCache($"{SqlSugarCacheConst.Org}{user.TenantId}")
.ToList(); .ToList();
return DataResult<List<ApiSelectViewModel>>.Success("获取数据成功!", list); return DataResult<List<OrgApiSelectViewModel>>.Success("获取数据成功!", list);
} }
#endregion 获取机构下拉列表 #endregion 获取机构下拉列表

@ -164,7 +164,7 @@ public class CommonController : ApiController
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
[Route("GetOrgList")] [Route("GetOrgList")]
public DataResult<List<ApiSelectViewModel>> GetOrgList([FromQuery] string queryKey = "") public DataResult<List<OrgApiSelectViewModel>> GetOrgList([FromQuery] string queryKey = "")
{ {
var res = _invokeService.GetOrgList(queryKey); var res = _invokeService.GetOrgList(queryKey);
return res; return res;

Loading…
Cancel
Save