| | |
| | | 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(); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | } |