From bf57a578cd5cc8aa1191e4c13e47b0e15f64ab9b Mon Sep 17 00:00:00 2001 From: douhandong Date: Thu, 6 Jun 2024 10:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DjyUserConfig/DjyUserConfigService.cs | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs b/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs index 8be71fb7..f85184a8 100644 --- a/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs +++ b/Myshipping.Core/Service/DjyUserConfig/DjyUserConfigService.cs @@ -104,8 +104,42 @@ namespace Myshipping.Core.Service [HttpGet("/DjyUserConfig/multi")] public async Task> Multi(string[] typeArr) { - return await _rep.ToListAsync(u => u.CreatedUserId == UserManager.UserId && typeArr.Contains(u.Type)); + //return await _rep.ToListAsync(u => u.CreatedUserId == UserManager.UserId && typeArr.Contains(u.Type)); + + List data = new List(); + + string[] typelist = { "BC", "PER_BILL", "TRUCK_DISPATCH", "CUT_MODIFY", "ROLLING_NOMINATION", "DRAFT", "ROUTE_CUT_CHANGE", "CAUTION_NOTICE", "POD_DISCHARGE_FULL" }; + + + foreach (var type in typeArr) + { + + if (typelist.Contains(type)) + { + var datainfo = _rep.Where(u => u.CreatedUserId == UserManager.UserId && u.Type == type).First(); + if (datainfo == null) + { + data.Add(_rep.Where(u =>u.Type ==(type+"_default")).First()); + } + else + { + if (datainfo != null) data.Add(datainfo); + } + + } + else + { + var userconfig = _rep.Where(u => u.CreatedUserId == UserManager.UserId && u.Type == type).First(); + + if (userconfig != null) + { + data.Add(userconfig); + } + } + } + + return data; } } }