/// <summary>
 /// 获取公司成员
 /// </summary>
 /// <param name="comId">公司ID</param>
 /// <returns>公司成员</returns>
 public List <PositionPersonnelData> LoadCom(int comId)
 {
     using (MySqlReadTableScope <PositionPersonnelData> .CreateScope(this, "V_OrgPosPersonnel"))
     {
         return(All(p => p.DataState < DataStateType.Delete && p.OrganizationId == comId));
     }
 }
 /// <summary>
 /// 获取组织成员信息
 /// </summary>
 /// <param name="orgId">组织ID</param>
 /// <returns>组织成员信息</returns>
 public List <PositionPersonnelData> LoadOrg(int orgId)
 {
     using (MySqlReadTableScope <PositionPersonnelData> .CreateScope(this, "V_OrgPosPersonnel"))
     {
         return(All(p => p.DataState < DataStateType.Delete && p.DepartmentId == orgId));
     }
 }
 /// <summary>
 /// 读取选择职位数据
 /// </summary>
 /// <param name="pid">职位ID</param>
 /// <param name="kw">查询关键字</param>
 /// <returns></returns>
 public List <PositionPersonnelData> LoadForSelect(int pid, string kw)
 {
     using (MySqlReadTableScope <PositionPersonnelData> .CreateScope(this, "dbo.QueryPositionPersonnel(@pid,@oid,@kw)"))
     {
         var sp1 = new MySqlParameter {
             ParameterName = "@kw", MySqlDbType = MySqlDbType.VarString, Size = kw.Length * 2 + 10, Value = kw
         };
         var sp2 = new MySqlParameter {
             ParameterName = "@pid", MySqlDbType = MySqlDbType.Int32, Value = pid
         };
         var sp3 = new MySqlParameter {
             ParameterName = "@oid", MySqlDbType = MySqlDbType.Int32, Value = 0
         };                                                                                                  //BusinessContext.Current.LoginUser.CompanyId
         var list = LoadData(null, sp1, sp2, sp3);
         list.ForEach(p => p.__IsSelected = p.Id > 0);
         return(list);
     }
 }
        /// <summary>
        ///     取得列表数据
        /// </summary>
        /// <remarks>安全检查有漏洞</remarks>
        protected override void GetListData()
        {
            var pid       = GetIntArg("pid", 0);
            var oid       = GetIntArg("oid", 0);
            var kw        = GetArg("keyWord");
            var condition = new LambdaItem <PositionPersonnelData>();

            if (!string.IsNullOrWhiteSpace(kw))
            {
                condition.Root = p => p.Personnel.Contains(kw) || p.Mobile.Contains(kw) || p.Tel.Contains(kw);
            }
            if (pid > 0)
            {
                condition.Root = p => p.OrganizePositionId == pid;
                base.GetListData(condition);
            }
            else if (oid > 1)
            {
                using (MySqlReadTableScope <PositionPersonnelData> .CreateScope(Business.Access, "view_sys_position_personnel_master"))
                {
                    condition.Root = p => p.master_id == oid;
                    base.GetListData(condition);
                }
            }
            else if (BusinessContext.Current.LoginUser.DepartmentId == 1)
            {
                base.GetListData(condition);
            }
            else
            {
                using (MySqlReadTableScope <PositionPersonnelData> .CreateScope(Business.Access, "view_sys_position_personnel_master"))
                {
                    condition.Root = p => p.master_id == BusinessContext.Current.LoginUser.DepartmentId;
                    base.GetListData(condition);
                }
            }
        }