服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-19 befe8d30755ce91989155ad8e8ae8337ac0908eb
Tiger.Business/SYS/Biz.SYS_MENU.cs
@@ -121,16 +121,15 @@
            SYS_MENU func = null;
            if (!string.IsNullOrEmpty(menuName))
            {
                func = Biz.Db.Queryable<SYS_MENU>().Where(x=>x.FUNC_NAME == menuName).First();
                func = Biz.Db.Queryable<SYS_MENU>().Where(x => x.FUNC_NAME == menuName).First();
            }
            var items = await Biz.Db.Queryable<SYS_MENU>()
                .WhereIF(!string.IsNullOrEmpty(status),q=>q.IS_USE == status)
                .OrderBy(x => x.SEQ_NO)
                .Distinct().ToListAsync();
            //没有查询的时候
            if (func == null)
            if (func != null)
            {
                List<SYS_MENU> entities = items.OrderBy(x => x.SEQ_NO).ToList().FindAll(t => t.PFUNC_CODE == "0");
                var items = await Biz.Db.Queryable<SYS_MENU>()
                    .WhereIF(!string.IsNullOrEmpty(status), q => q.IS_USE == status)
                    .OrderBy(x => x.SEQ_NO)
                    .Distinct().ToListAsync();
                List<SYS_MENU> entities = items.OrderBy(x => x.SEQ_NO).ToList().FindAll(t => t.PFUNC_CODE == func.FUNC_CODE);
                foreach (var item in entities)
                {
                    MenuItem menuItem = new();
@@ -174,19 +173,15 @@
                    menuItem.btnType = item.BUTTON_TYPE;
                    menuItem.doMethod = item.DO_METHOD;
                    menuItem.parentMenu = item.PFUNC_CODE;
                    menuItem.orderNo= item.SEQ_NO;
                    menuItem.children = new();
                    menuItem.orderNo = item.SEQ_NO;
                    menuItem.children = null;
                    GetMenuItem(items, item.FUNC_CODE, ref menuItem);
                    data.Add(menuItem);
                }
            }
            //有查询条件的时候
            else {
            }
            };
            //转换Json时,去除值为null的属性
            var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
            var jsonSetting = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore };
            var json = JsonConvert.SerializeObject(data, Formatting.Indented, jsonSetting);
            return json;
        }
@@ -325,7 +320,7 @@
                    menuItem.keepalive = item.IGNOREKEEPALIVE;
                    menuItem.show = item.SHOW;
                    menuItem.menuName = item.FUNC_NAME;
                    menuItem.createTime = item.CREATE_TIME;
                    menuItem.createTime = item.CREATE_TIME;
                    menuItem.icon = menuItem.meta.icon;
                    menuItem.func_type = item.FUNC_TYPE;
                    menuItem.btnType = item.BUTTON_TYPE;
@@ -333,8 +328,9 @@
                    menuItem.parentMenu = item.PFUNC_CODE;
                    menuItem.orderNo = item.SEQ_NO;
                    menuItem.status = item.IS_USE;
                    menuItem.children = new();
                    menuItem.children = null;
                    GetMenuItem(data, item.FUNC_CODE, ref menuItem);
                    if (pMenuItem.children == null) { pMenuItem.children = new(); }
                    pMenuItem.children.Add(menuItem);
                }
            }