Skip to content

Commit

Permalink
feat:新增租户搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
YNNiu623 committed Dec 31, 2024
1 parent 0044878 commit 8d6740b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions XCode/Membership/用户.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,29 @@ public static IList<User> Search(Int32[] roleIds, Int32[] departmentIds, Int32[]

return FindAll(exp, page);
}
public static IList<User>? SearchWithTenant(Int32 tencentId, Int32[] roleIds, Int32[] departmentIds, Int32[] areaIds, Boolean? enable, DateTime start, DateTime end, String key, PageParameter page)
{
var exp = TenantUser._.TenantId == tencentId;
if (roleIds != null && roleIds.Length > 0)
{
var exp2 = new WhereExpression();
exp2 |= _.RoleID.In(roleIds);
foreach (var rid in roleIds)
{
exp2 |= _.RoleIds.Contains("," + rid + ",");
}
exp &= exp2;
}
if (departmentIds != null && departmentIds.Length > 0) exp &= _.DepartmentID.In(departmentIds);
if (areaIds != null && areaIds.Length > 0) exp &= _.AreaId.In(areaIds);
if (enable != null) exp &= _.Enable == enable.Value;
exp &= _.LastLogin.Between(start, end);
if (!key.IsNullOrEmpty()) exp &= _.Code.StartsWith(key) | _.Name.StartsWith(key) | _.DisplayName.StartsWith(key) | _.Mobile.StartsWith(key) | _.Mail.StartsWith(key);

var sql = $"SELECT User.* FROM User INNER JOIN TenantUser ON User.ID= TenantUser.UserId where {exp} ";

return Meta.Session.Dal.Query<User>(sql, null, page)?.ToList();
}
#endregion

#region 扩展操作
Expand Down

0 comments on commit 8d6740b

Please sign in to comment.