| | |
| | | { |
| | | func = Biz.Db.Queryable<SYS_MENU>().Where(x=>x.FUNC_NAME == menuName).First(); |
| | | } |
| | | string rootCode = func == null ? "0" : func.FUNC_CODE; |
| | | 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) |
| | | { |
| | | List<SYS_MENU> entities = items.OrderBy(x => x.SEQ_NO).ToList().FindAll(t => t.PFUNC_CODE == "0"); |
| | | List<SYS_MENU> entities = items.OrderBy(x => x.SEQ_NO).ToList().FindAll(t => t.PFUNC_CODE == rootCode); |
| | | foreach (var item in entities) |
| | | { |
| | | MenuItem menuItem = new(); |
| | |
| | | menuItem.doMethod = item.DO_METHOD; |
| | | menuItem.parentMenu = item.PFUNC_CODE; |
| | | menuItem.orderNo= item.SEQ_NO; |
| | | menuItem.children = new(); |
| | | 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; |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |