/// <summary> /// 递归删除岗位节点 /// </summary> /// <param name="PK_ROLE_ID"></param> /// <param name="isPost"></param> /// <returns></returns> public bool DeletePosts(int PK_ROLE_ID) { StringBuilder strSql=new StringBuilder(); strSql.Append(" WITH post(PK_ROLE_ID, ROLE_FATHER, ROLE_NAME) AS "); strSql.Append(" ( "); strSql.Append(" SELECT R.PK_ROLE_ID, R.ROLE_FATHER, R.ROLE_NAME"); strSql.Append(" FROM [ROLE] R WHERE PK_ROLE_ID=@PK_ROLE_ID"); strSql.Append(" UNIon ALL"); strSql.Append(" SELECT sub.PK_ROLE_ID, sub.ROLE_FATHER, sub.ROLE_NAME"); strSql.Append(" FROM [ROLE] sub, post super"); strSql.Append(" WHERE sub.ROLE_FATHER = super.PK_ROLE_ID"); strSql.Append(" )"); strSql.Append(" delete from [ROLE] where PK_ROLE_ID in("); strSql.Append(" select PK_ROLE_ID from post"); strSql.Append(" )"); SqlParameter[] parameters = { new SqlParameter("@PK_ROLE_ID", SqlDbType.Int,4) }; parameters[0].Value = PK_ROLE_ID; int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); if (rows > 0) { return true; } else { return false; } }