Beispiel #1
0
        public static List <SysMenuPoint> GetByMenuCode(string menuCode)
        {
            var sql = @"
Select *
From SysMenuPoint 
Where  MenuCode = @MenuCode
";

            return(DbHelper.GetModels <SysMenuPoint>(sql, new DbField("MenuCode", menuCode)));
        }
        public static List <SysMenu> GetMenus()
        {
            var sql = @"
Select menu.*
From SysMenu menu
Where menu.IsDeleted = 0;
";

            return(DbHelper.GetModels <SysMenu>(sql));
        }
Beispiel #3
0
        public static List <VideoMark> GetByMainId(string mainId)
        {
            var sql = @"
Select mark.*,owner.Name as _OwnerName
From VideoMark mark
Join BasOwner owner on owner.Id = mark.OwnerId
Where mark.MainId = @mainId
";

            return(DbHelper.GetModels <VideoMark>(sql, new DbField("mainId", mainId)));
        }
Beispiel #4
0
        public static List <VideoCommentUpdown> GetByCommentId(string commentId)
        {
            var sql = @"
Select updown.*,owner.Name as _OwnerName
From VideoCommentUpdown updown
Join BasOwner owner on owner.Id = updown.OwnerId
Where updown.CommentId = @commentId
";

            return(DbHelper.GetModels <VideoCommentUpdown>(sql, new DbField("commentId", commentId)));
        }
Beispiel #5
0
        public static List <VideoComment> GetByMainId(string mainId)
        {
            var sql = @"
Select comment.*,owner.Name as _OwnerName
From VideoComment comment
Join BasOwner owner on owner.Id = comment.OwnerId
Where comment.MainId = @mainId
";

            return(DbHelper.GetModels <VideoComment>(sql, new DbField("mainId", mainId)));
        }
Beispiel #6
0
        public static List <SysUser> GetUnSelectedUser(string roleId)
        {
            var sql = @"
select user.*
from SysUser user
left Join SysUserRole userRole on userRole.UserId = user.Id and userRole.RoleId = @roleId
where userRole.UserId is null
";

            return(DbHelper.GetModels <SysUser>(sql, new DbField("roleId", roleId)));
        }
        public static List <SysMenuPoint> GetByUserId(long userId)
        {
            var sql = @"
Select point.*
From SysMenuPoint point
Join SysRoleMenuPoint rolePoint On rolePoint.MenuCode = point.MenuCode And rolePoint.PointCode = point.Code
Join SysUserRole userRole On userRole.RoleId =  rolePoint.RoleId
Where userRole.UserId = @userId;
";

            return(DbHelper.GetModels <SysMenuPoint>(sql, new DbField("userId", userId)));
        }
Beispiel #8
0
        public static dynamic GetRoleRightMenu(string roleid)
        {
            List <dynamic> RightMenu = new List <dynamic>();
            var            sql1      = @"
select A.*, Case When ifnull(B.MenuCode,1) then 0 else 1 end as checked 
from SysMenu A 
left join SysRoleMenu B on A.Code=B.MenuCode and B.roleid=@roleid
order by A.Seq asc ";

            var sql2 = @"
select A.*, Case When ifnull(B.MenuCode,1) then 0 else 1 end as checked 
from SysMenuPoint A 
left join SysRoleMenuPoint B on A.MenuCode=B.MenuCode and A.Code=B.PointCode and B.RoleId=@roleid
order by A.Seq asc ";

            RightMenu.Add(DbHelper.GetModels <dynamic>(sql1, new DbField("roleid", roleid)));
            RightMenu.Add(DbHelper.GetModels <dynamic>(sql2, new DbField("roleid", roleid)));
            return(RightMenu);
        }
Beispiel #9
0
        public static List <SysMenuPoint> GetByUserId(long userId)
        {
            var user = new SysUserService().GetModel("Id", userId + "");

            var sql = @"
Select point.*
From SysMenuPoint point
Join SysRoleMenuPoint rolePoint On rolePoint.MenuCode = point.MenuCode And rolePoint.PointCode = point.Code
Join SysUserRole userRole On userRole.RoleId =  rolePoint.RoleId
Where userRole.UserId = @userId;
";

            if (user != null && user.Account == "admin")
            {
                sql = @"
Select *
From SysMenuPoint
";
            }

            return(DbHelper.GetModels <SysMenuPoint>(sql, new DbField("userId", userId)));
        }