This commit is contained in:
2023-04-23 16:46:36 +08:00
35 changed files with 1967 additions and 814 deletions

View File

@@ -52,4 +52,9 @@ public class DepartmentCrInput
/// 组织类型
/// </summary>
public string category { get; set; }
/// <summary>
/// 组织类型名称
/// added by ly on 20230421
/// </summary>
public string typeName { get; set; }
}

View File

@@ -62,4 +62,8 @@ public class DepartmentInfoOutput
/// added by ly on 20230420
/// </summary>
public string category { get; set; }
/// <summary>
/// 组织类型名称
/// </summary>
public string categoryName { get; set; }
}

View File

@@ -73,4 +73,9 @@ public class OrganizeListOutput : TreeModel
/// 集团名 (组织树最后一个).
/// </summary>
public string lastFullName { get; set; }
/// <summary>
/// 组织类型名称
/// added by ly on 20230421
/// </summary>
public string categoryName { get; set; }
}

View File

@@ -31,4 +31,11 @@ public interface IDictionaryDataService
/// <param name="key"></param>
/// <returns></returns>
Task<Dictionary<string, object>> GetDicByKey(string key);
/// <summary>
/// 根据typeId获取字典
/// </summary>
/// <param name="typeId"></param>
/// <returns></returns>
Task<Dictionary<string, object>> GetDicByTypeId(string typeId);
}

View File

@@ -9,6 +9,7 @@ using JNPF.Systems.Entitys.Dto.Department;
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;
@@ -212,6 +213,9 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
var res = entity.Adapt<DepartmentInfoOutput>();
if (entity.ParentId.Equals("-1")) res.organizeIdTree = new List<string>() { res.id };
else res.organizeIdTree = (await _repository.GetSingleAsync(p => p.Id == entity.ParentId)).OrganizeIdTree.Split(",").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);
res.categoryName = dic.ContainsKey(res.category) ? dic[res.category].ToString() : "";
return res;
}
@@ -578,7 +582,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
/// <returns></returns>
public async Task<List<OrganizeEntity>> GetCompanyAllDep(string id)
{
return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null);
return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null);
}
#endregion
}

View File

@@ -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();
}

View File

@@ -420,8 +420,8 @@ public class DataBaseService : IDynamicApiController, ITransient
sugarClient.MappingTables.Add(entityName, item.Name);
foreach (var col in sugarClient.DbMaintenance.GetColumnInfosByTableName(item.Name))
{
var colName = CustomFormatName(col.DbColumnName);
sugarClient.MappingColumns.Add(colName /*类的属性首字母大写*/, col.DbColumnName, entityName);
//var colName = CustomFormatName(col.DbColumnName);
sugarClient.MappingColumns.Add(col.DbColumnName /*类的属性首字母大写*/, col.DbColumnName, entityName);
}
}
sugarClient.DbFirst.Where(input.TableName)

View File

@@ -1,4 +1,5 @@
using JNPF.Common.Core.Manager;
using JNPF.ClayObject.Extensions;
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Manager.Files;
using JNPF.Common.Enums;
using JNPF.Common.Manager;
@@ -338,9 +339,15 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll
return await _repository.AsSugarClient().Queryable<DictionaryDataEntity>()
.LeftJoin<DictionaryTypeEntity>((a, b) => a.DictionaryTypeId == b.Id)
.Where((a, b) => b.EnCode == key && b.DeleteMark == null)
.ToDictionaryAsync((it)=>it.EnCode,it=>it.FullName);
.ToDictionaryAsync((it) => it.EnCode, it => it.FullName);
}
public async Task<Dictionary<string, object>> GetDicByTypeId(string typeId) =>
await _repository.AsQueryable().Where(x => x.DictionaryTypeId == typeId && x.DeleteMark == null).ToDictionaryAsync(x => x.EnCode, x => x.FullName);
#endregion
#region PrivateMethod