From 72d11306f68b9a6786f85151310218b50fcfd1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87=E9=98=B3=20=E9=82=B9?= Date: Wed, 1 Nov 2023 10:27:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=8B=E5=B8=88=E9=98=85?= =?UTF-8?q?=E5=8D=B7=E4=BB=8E2.0=E7=B3=BB=E7=BB=9F=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/LawyerArchivesController.cs | 86 ++++++++----------- 1 file changed, 37 insertions(+), 49 deletions(-) diff --git a/24Hour/Controllers/Common/LawyerArchivesController.cs b/24Hour/Controllers/Common/LawyerArchivesController.cs index 145191e..a575e2c 100644 --- a/24Hour/Controllers/Common/LawyerArchivesController.cs +++ b/24Hour/Controllers/Common/LawyerArchivesController.cs @@ -374,26 +374,30 @@ namespace _24Hour.Controllers.Common if (reponse.IsSucceed == true) { var a = reponse.result; - var data = new[] + var datd = new + { + id = a.Id, + lable = a.jzmc, + children = a.jzml.Where(x => x.fmlbh == null).OrderBy(x => x.mlsxh).Select(x => new { - new { - id = a.jzbh, - lable = a.jzmc, - children = a?.jzml?.OrderBy(x=>x.mlsxh).Select(x => new - { - id = x.mlbh, - lable = x.mlxsmc, - children = x.jzwj.OrderBy(x=>x.wjsxh).Select(q => new - { - id = q.wjxh, - lable = q.wjxsmc, - filepath = q.jpgwjlj - }) - }) - } - }; + id = x.Id, + lable = x.mlxsmc, + children = a.jzml.Where(q => q.fmlbh == x.mlbh).OrderBy(q => q.mlsxh).Select(q => new + { + id = q.Id, + lable = q.mlxsmc, + children = q.jzwj.OrderBy(e => e.wjsxh).Select(e => new + { + id = e.wjxh, + lable = e.wjxsmc, + filepath = e.jpgwjlj + }) + }) + }) + }; + result.IsSucceed = true; - result.result = data; + result.result = datd; } else { @@ -415,52 +419,33 @@ namespace _24Hour.Controllers.Common .Includes(x => x.jzml.OrderBy(x => x.mlsxh).ToList()) .Includes(x => x.jzml, x => x.jzwj.OrderBy(x => x.wjsxh).ToList()) .FirstAsync(x => x.Id == jzid); - if (list!=null) + if (list != null) { var a = mapper.Map(list); - var datd = new { id = a.Id, lable = a.jzmc, children = a.jzml.Where(x => x.fmlbh == null).OrderBy(x => x.mlsxh).Select(x => new { - id=x.Id, - lable=x.mlxsmc, - children = a.jzml.Where(q => q.fmlbh == x.mlbh).OrderBy(q => q.mlsxh).Select(q =>new + id = x.mlbh, + lable = x.mlxsmc, + children = a.jzml.Where(q => q.fmlbh == x.mlbh).OrderBy(q => q.mlsxh).Select(q => new { - id=q.Id, - lable=q.mlxsmc, + id = q.mlbh, + lable = q.mlxsmc, children = q.jzwj.OrderBy(e => e.wjsxh).Select(e => new { - id=e.Id, - lable=e.wjxsmc, + id = e.wjxh, + lable = e.wjxsmc, filepath = e.jpgwjlj }) }) }) }; - var data = new[] - { - new { - id = a.jzbh, - lable = a.jzmc, - children = a?.jzml?.OrderBy(x=>x.mlsxh).Select(x => new - { - id = x.mlbh, - lable = x.mlxsmc, - children = x.jzwj.OrderBy(x=>x.wjsxh).Select(q => new - { - id = q.wjxh, - lable = q.wjxsmc, - filepath = q.jpgwjlj - }) - }) - } - }; result.IsSucceed = true; - result.result = data; + result.result = datd; } else { @@ -498,8 +483,13 @@ namespace _24Hour.Controllers.Common } //再排除没有文件的目录信息 //这样筛选后获取的数据就可以保证不会出现空子节点的父节点 - dto.jzml = dto.jzml.Where(x => x.jzwj.Any()).ToList(); + //dto.jzml = dto.jzml.Where(x => x.jzwj.Any() || x.fmlbh == null).ToList(); + //var fml = dto.jzml.Where(x => x.fmlbh == null); + + var hasfileslist = dto.jzml.Where(x => x.jzwj.Any()).ToList(); + var fmllist = dto.jzml.Where(x => string.IsNullOrEmpty(x.fmlbh) && hasfileslist.Any(q => q != null && q.fmlbh == x.mlbh)); + dto.jzml = hasfileslist.Concat(fmllist).Distinct().ToList(); var insert = await AddArchivesInfo(dto); result.result = insert.result.Id; result.IsSucceed = true; @@ -588,10 +578,8 @@ namespace _24Hour.Controllers.Common try { var data = mapper.Map(dto); - var mls = dto.jzml.ToList(); var vloum = mapper.Map>(mls); - var wjs = dto.jzml.SelectMany(x => x.jzwj).ToList(); var files = mapper.Map>(wjs);