|
@@ -480,34 +480,29 @@ namespace GxPress.Repository.Implement
|
|
|
/// <returns></returns>
|
|
|
public async Task<IEnumerable<UserGroupList>> GetAllByUserIdAsync(int userId)
|
|
|
{
|
|
|
+ var groupConstValue = AllTypeConst.Group.GetHashCode();
|
|
|
string sql = $@"SELECT
|
|
|
- Id,
|
|
|
- Name,
|
|
|
- AvatarUrl,
|
|
|
+ b.*,
|
|
|
(SELECT
|
|
|
COUNT(1)
|
|
|
FROM
|
|
|
tede_group_user
|
|
|
WHERE
|
|
|
- GroupId = a.Id) AS UserCount
|
|
|
+ GroupId = a.MiddleId) AS UserCount
|
|
|
FROM
|
|
|
- tede_group a
|
|
|
+ tede_middle a
|
|
|
+ INNER JOIN
|
|
|
+ tede_group b ON a.MiddleId = b.Id
|
|
|
WHERE
|
|
|
- a.id IN (SELECT
|
|
|
- GroupId
|
|
|
- FROM
|
|
|
- ccpph_tede.tede_group_user
|
|
|
- WHERE
|
|
|
- UserId = {userId}) ORDER BY a.CreatedDate DESC";
|
|
|
+ a.FolderType ={groupConstValue} AND a.UserId ={userId}
|
|
|
+ AND a.IsDelete = 0";
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|
|
|
var connection = database.GetConnection();
|
|
|
var items = await connection
|
|
|
.QueryAsync<UserGroupList>(sql);
|
|
|
foreach (var item in items)
|
|
|
- {
|
|
|
item.AvatarUrl = StringUtils.AddDomain(item.AvatarUrl);
|
|
|
- }
|
|
|
return items;
|
|
|
}
|
|
|
/// <summary>
|