private SQuery _SQ_GetInGroupResources(params int[] pgidS) { if (pgidS.Length == 0) { throw new BCFException("GetInGroupResources(pgdiS)::@pgidS长度必须大于0"); } Resource_LinkedM rl = new Resource_LinkedM(); rl.IncludeAll(false); rl.LK_OBJT.IsInc = true; rl.P_Express.IsInc = true; ResourceExView rv = new ResourceExView(false); SQuery SQ = NewSQ(); SQ.From(rv) .InnerJoin(rl) .On(rv.RSID == rl.RSID) .Where(rl.LK_OBJT == Group.LK_OBJT) .And(rl.LK_OBJT_ID.In(pgidS)) .And(rv.Is_Disabled == false) .And(rv.PKG_Is_Disabled == false); this._Sort(SQ, rv); return(SQ); }
/// <summary> /// /// </summary> /// <param name="rsid"></param> /// <param name="puid"></param> /// <returns></returns> public static PExpress ExpressOfUser(int rsid, int puid) { if (rsid < 1 || puid < 1) { return(PExpress.Null); } SQuery SQ = BCF_PARAMS.NewSQ(); ResourceExView rv = new ResourceExView(true); Resource_LinkedM rl = new Resource_LinkedM(); //------>>找出属于用户所在组(部门,角色) QView tempView = GroupService.G.GetInGroupsSQ(puid, false, true).SubSelect().As("A"); //-------<< //------>>找出属于用户个人所有的RSID tempView = SQ.From(rl) .Where(rl.RSID == rsid) .BeginAnd() .Begin(rl.LK_OBJT == User.LK_OBJT) .And(rl.LK_OBJT_ID == puid) .End() .BeginOr(rl.LK_OBJT == Group.LK_OBJT) .And(rl.LK_OBJT_ID.In(tempView)) .End() .End() .SubSelect(rl.RSID, rl.P_Express).As(rl.AsName); //------<< int pex = SQ.From(rv) .Join(tempView, JoinType.Inner) .On(rv.RSID == rl.RSID) .Where(rv.Is_Disabled != 1).And(rv.PKG_Is_Disabled != true) .SelectValue <int>(rl.P_Express.Max(), 0); //------<< //-------------------------------------------------------------------------- switch (pex) { case 1: return(PExpress.ReadOnly); case 2: return(PExpress.Write); case 4: return(PExpress.Control); default: return(PExpress.Null); } }
private SQuery _SQ_GetInUserResources(int puid, params int[] packageIds) { if (puid <= 0) { throw new BCFException("GetInUserResources(puid)::@puid 必须大于0"); } ResourceExView rv = new ResourceExView(false); Resource_LinkedM rl = new Resource_LinkedM(); SQuery SQ = NewSQ(); //------>>找出属于用户所在组(部门,角色) QView tempView = GroupService.G.GetInGroupsSQ(puid, false, true).SubSelect(); //-------<< //------>>找出属于用户个人所有的RSID tempView = SQ.From(rl) .BeginWhere(rl.LK_OBJT == User.LK_OBJT) .And(rl.LK_OBJT_ID == puid) .End() .BeginOr(rl.LK_OBJT == Group.LK_OBJT) .And(rl.LK_OBJT_ID.In(tempView)) .End() .SubSelect(rl.RSID, rl.LK_OBJT, rl.P_Express).As("RL"); //------<< SQ.From(rv) .Join(tempView, JoinType.Inner) .On(rv.RSID == tempView.Column(rl.RSID)) .Where(rv.Is_Disabled != 1) .And(rv.PKG_Is_Disabled == false); if (packageIds.Length > 0) { SQ.And(rv.PGID.In(packageIds)); } SQ.Distinct(); this._Sort(SQ, rv); return(SQ); }
private void _Sort(SQuery sq, ResourceExView rv) { sq.OrderBy(rv.PKG_Order_Index).And(rv.Order_Index); }