|
@@ -1106,48 +1106,7 @@ namespace GxPress.Repository.Implement
|
|
|
/// <returns></returns>
|
|
|
public async Task<IEnumerable<GroupUserListResult>> GetGroupUserAsync(GroupUserFindRequest request)
|
|
|
{
|
|
|
- string sqlStr = string.Empty;
|
|
|
- if (!string.IsNullOrEmpty(request.KeyWord))
|
|
|
- {
|
|
|
- sqlStr += $@" AND (b.Name LIKE '%{request.KeyWord}%'
|
|
|
- OR b.Phone LIKE '%{request.KeyWord}%'
|
|
|
- OR b.Email LIKE '%{request.KeyWord}%')";
|
|
|
- }
|
|
|
- if (request.TypeId == 1)
|
|
|
- sqlStr += " AND a.GroupUserRoleId IN (1,2)";
|
|
|
- if (request.TypeId == 2)
|
|
|
- sqlStr += " AND a.GroupUserRoleId=3";
|
|
|
- string sql = $@"SELECT
|
|
|
- a.Id,
|
|
|
- a.GroupUserRoleId,
|
|
|
- a.CreatedDate,
|
|
|
- a.GroupId,
|
|
|
- b.Id AS UserId,
|
|
|
- b.Name,
|
|
|
- b.AvatarUrl,
|
|
|
- b.Email,
|
|
|
- b.ImId,
|
|
|
- c.Name AS DepartmentName
|
|
|
- FROM
|
|
|
- tede_group_user a
|
|
|
- INNER JOIN
|
|
|
- tede_user b ON a.UserId = b.Id
|
|
|
- INNER JOIN
|
|
|
- tede_department c ON b.DepartmentId = c.Id
|
|
|
- WHERE
|
|
|
- a.GroupId = {request.GroupId}
|
|
|
- {sqlStr}
|
|
|
- ORDER BY a.GroupUserRoleId";
|
|
|
- var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
- var database = new Database(databaseType, _connectionString);
|
|
|
- var connection = database.GetConnection();
|
|
|
- var result = await connection.QueryAsync<GroupUserListResult>(sql);
|
|
|
- foreach (var item in result)
|
|
|
- {
|
|
|
- item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
|
|
|
- item.Email = string.IsNullOrEmpty(item.Email) ? string.Empty : item.Email;
|
|
|
- }
|
|
|
- return result;
|
|
|
+ return await GetGroupUsersAsync(request);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1157,10 +1116,9 @@ namespace GxPress.Repository.Implement
|
|
|
/// <returns></returns>
|
|
|
public async Task<IEnumerable<GroupUserListResult>> GetGroupUsersAsync(GroupUserFindRequest request)
|
|
|
{
|
|
|
- var enjoy = new SqlKata.Query("tede_user_middle");
|
|
|
- enjoy.Where("MiddleType", 10);
|
|
|
- enjoy.Where("SourceId", 855);
|
|
|
- enjoy.ForMySql(n => n.SelectRaw("GROUP_CONCAT(SourceName Separator'、')"));
|
|
|
+ // var enjoy = new SqlKata.Query("tede_user_middle");
|
|
|
+ // enjoy.Where("MiddleType", 10);
|
|
|
+ // enjoy.SelectRaw("GROUP_CONCAT(SourceName Separator'、')");
|
|
|
var userCount = new SqlKata.Query("tede_user");
|
|
|
userCount.Where("Id", ">", 0).AsCount("Id");
|
|
|
var query = new SqlKata.Query("tede_user");
|
|
@@ -1178,7 +1136,7 @@ namespace GxPress.Repository.Implement
|
|
|
"tede_user.{Id AS UserId, Name, AvatarUrl,Email,ImId}",
|
|
|
"a.{Name AS DepartmentName}");
|
|
|
query.Select(userCount, "UserCount");
|
|
|
- query.Select(enjoy, "EnjoyName");
|
|
|
+ //query.Select(enjoy, "EnjoyName");
|
|
|
var result = await _repository.GetAllAsync<GroupUserListResult>(query);
|
|
|
foreach (var item in result)
|
|
|
{
|