生产管理
This commit is contained in:
@@ -12,6 +12,7 @@ using JNPF.LinqBuilder;
|
||||
using JNPF.Systems.Entitys.Dto.Organize;
|
||||
using JNPF.Systems.Entitys.Dto.SysConfig;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
@@ -88,6 +89,8 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
|
||||
// 获取分级管理组织
|
||||
var dataScope = _userManager.DataScope.Where(x => x.Select).Select(x => x.organizeId).Distinct().ToList();
|
||||
//modified by ly on 20230421 查询区域类型数据字典
|
||||
var dic = await _repository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(it => it.DictionaryTypeId == "24754619407381").ToDictionaryAsync(x => x.EnCode, x => x.FullName);
|
||||
|
||||
List<OrganizeListOutput>? data = await _repository.AsQueryable().Where(t => t.DeleteMark == null)
|
||||
.WhereIF(!_userManager.IsAdministrator, a => dataScope.Contains(a.Id))
|
||||
@@ -105,7 +108,9 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
sortCode = x.SortCode,
|
||||
icon = SqlFunc.IIF(x.Category.Equals("company"), "icon-ym icon-ym-tree-organization3", "icon-ym icon-ym-tree-department1"),
|
||||
type = x.Category
|
||||
}).ToListAsync();
|
||||
})
|
||||
.Mapper(x => x.categoryName = dic.ContainsKey(x.category) ? dic[x.category].ToString() : "")
|
||||
.ToListAsync();
|
||||
|
||||
if (!string.IsNullOrEmpty(input.keyword))
|
||||
data = data.TreeWhere(t => t.fullName.Contains(input.keyword) || t.enCode.Contains(input.keyword), t => t.id, t => t.parentId);
|
||||
@@ -290,19 +295,19 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
queryWhere = queryWhere.And(x => x.DeleteMark == null);
|
||||
List<OrganizeListOutput>? data = await _repository.AsQueryable().Where(queryWhere)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)).Select(a => new OrganizeListOutput
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
|
||||
// 获取所有组织
|
||||
List<OrganizeEntity>? allOrgList = GetOrgListTreeName();
|
||||
@@ -393,7 +398,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
});
|
||||
});
|
||||
|
||||
if(adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
#endregion
|
||||
|
||||
#region 第三方同步
|
||||
@@ -629,7 +634,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
[NonAction]
|
||||
public async Task<List<OrganizeEntity>> GetListAsync(Expression<Func<OrganizeEntity, bool>> expression = null)
|
||||
{
|
||||
var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression!=null, expression);
|
||||
var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression != null, expression);
|
||||
return await query.OrderBy(o => o.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user