修改任务查询数据范围

optimize
jianghaiqing 2 years ago
parent 49fd73074f
commit d86fc2b623

@ -650,12 +650,10 @@ namespace Myshipping.Application
//菜单375504048771141=我的任务台账 //菜单375504048771141=我的任务台账
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141); List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141);
if (userlist == null || userlist.Count == 0) bool isAdmin = userlist == null;
userlist = new List<long> { UserManager.UserId };
//任务列表分组统计 //任务列表分组统计
var groupList = _taskBaseInfoRepository.AsQueryable() var groupList = _taskBaseInfoRepository.AsQueryable()
.Where(t => (userlist.Contains(t.CreatedUserId) && t.IS_PUBLIC == 0) || (t.TenantId == userTendInfo.Tend.Id && t.IS_PUBLIC == 1)) .Where(t => isAdmin || (userlist.Contains(t.CreatedUserId) && t.IS_PUBLIC == 0) || (t.TenantId == userTendInfo.Tend.Id && t.IS_PUBLIC == 1))
.GroupBy(p => new { p.TASK_TYPE, p.STATUS, p.IS_EXCEPT, p.IS_PUBLIC }) .GroupBy(p => new { p.TASK_TYPE, p.STATUS, p.IS_EXCEPT, p.IS_PUBLIC })
.Select(p => new .Select(p => new
{ {
@ -904,11 +902,8 @@ namespace Myshipping.Application
//菜单375504048771141=我的任务台账 //菜单375504048771141=我的任务台账
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141); List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141);
if (userlist == null || userlist.Count == 0)
userlist = new List<long> { UserManager.UserId };
var entities = await _taskBaseInfoRepository.AsQueryable() var entities = await _taskBaseInfoRepository.AsQueryable()
.Where(t=> userlist.Contains(t.CreatedUserId)) .Where(t=> userlist == null || userlist.Contains(t.CreatedUserId))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.MBlNo), t => mblList.Any(p => p.Contains(t.MBL_NO, StringComparison.OrdinalIgnoreCase))) .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.MBlNo), t => mblList.Any(p => p.Contains(t.MBL_NO, StringComparison.OrdinalIgnoreCase)))
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.TaskRecvName), t => t.CreatedUserName.Contains(QuerySearch.TaskRecvName.Trim(), StringComparison.OrdinalIgnoreCase)) .WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.TaskRecvName), t => t.CreatedUserName.Contains(QuerySearch.TaskRecvName.Trim(), StringComparison.OrdinalIgnoreCase))
.WhereIF(etdBegin != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value >= etdBegin) .WhereIF(etdBegin != DateTime.MinValue, t => t.ETD.HasValue && t.ETD.Value >= etdBegin)

Loading…
Cancel
Save