Example #1
0
 public ActionResult GetSysModuleList()
 {
     try
     {
         var result = _wctSysmoduleMstrRepository.GetSysModuleList();
         return(Success("获取成功", result));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }
Example #2
0
        /// <summary>
        /// 获取功能模块子菜单
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public ReturnMsg GetAppItemInfo(string appId)
        {
            var rm              = new ReturnMsg();
            var selectAppInfo   = new List <WctSysmoduleMstrModel>();
            var unSelectAppInfo = new List <WctSysmoduleMstrModel>();
            var appList         = new List <WctAppMstr>();

            appList = _wctAppMstrRepository.GetAllList(c => c.WCT_MODULE_TYPE == "1" && c.DEL_FLAG == 1 && c.BU_NO == AbpSession.ORG_NO);
            var allSecondMoudle = _wctSysmoduleMstrRepository.GetSysModuleList(new List <string>(), "secondary");
            var allAppIdList    = allSecondMoudle.Select(c => c.SYSM_ID).ToList();

            if (!string.IsNullOrEmpty(appId))
            {
                if (appList.Count == 0)
                {
                    rm.IsSuccess = false;
                    rm.msg       = "数据检索异常";
                    return(rm);
                }
                var appMstr = appList.FirstOrDefault(c => c.Id == appId && c.DEL_FLAG == 1);
                if (appMstr == null)
                {
                    rm.IsSuccess = false;
                    rm.msg       = "一级菜单不存在";
                    return(rm);
                }
                var childSelectAppIds = appMstr.SYS_MODULE_IDS.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                selectAppInfo = allSecondMoudle.Where(c => childSelectAppIds.Contains(c.SYSM_ID)).ToList();
            }
            var selectAppIds    = string.Join(',', appList.Select(c => c.SYS_MODULE_IDS));
            var selectAppIdList = selectAppIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var unSelectAppIds  = allAppIdList.Except(selectAppIdList).ToList();

            if (unSelectAppIds.Count > 0)
            {
                unSelectAppInfo = allSecondMoudle.Where(c => unSelectAppIds.Contains(c.SYSM_ID)).ToList();
            }

            var dic = new Dictionary <string, object>();

            dic.Add("SelectAppInfo", selectAppInfo);
            dic.Add("UnSelectAppInfo", unSelectAppInfo);

            rm.IsSuccess = true;
            rm.result    = JsonConvert.SerializeObject(dic);

            return(rm);
        }