public async Task <JsonResult> GetEdit([FromBody] FMIntId entity)
        {
            var jm = new AdminUiCallBack();

            var model = await _sysOrganizationServices.QueryByIdAsync(entity.id);

            if (model == null)
            {
                jm.msg = "不存在此信息";
                return(new JsonResult(jm));
            }

            var dict = await _sysDictionaryServices.QueryByClauseAsync(p => p.dictCode == "organization_type");

            var dictData = new List <SysDictionaryData>();

            if (dict != null)
            {
                dictData = await _sysDictionaryDataServices.QueryListByClauseAsync(p => p.dictId == dict.id);
            }
            jm.code = 0;
            jm.data = new
            {
                model,
                dictData
            };

            return(new JsonResult(jm));
        }
Пример #2
0
        public async Task <JsonResult> GetEditUserInfo()
        {
            var jm        = new AdminUiCallBack();
            var userModel = await _sysUserServices.QueryByIdAsync(_user.ID);

            if (userModel != null)
            {
                var roles = await _sysUserRoleServices.QueryListByClauseAsync(p => p.userId == userModel.id);

                if (roles.Any())
                {
                    var roleIds = roles.Select(p => p.roleId).ToList();
                    userModel.roles = await _sysRoleServices.QueryListByClauseAsync(p => roleIds.Contains(p.id));
                }

                if (userModel.organizationId != null && userModel.organizationId > 0)
                {
                    var organization = await _sysOrganizationServices.QueryByIdAsync(userModel.organizationId);

                    if (organization != null)
                    {
                        userModel.organizationName = organization.organizationName;
                    }
                }
            }

            jm.code = 0;
            jm.msg  = "数据获取正常";
            jm.data = userModel;
            return(new JsonResult(jm));
        }