lihao %!s(int64=4) %!d(string=hai) anos
pai
achega
2f310bcf8b

+ 1 - 0
gx_api/GxPress/Model/GxPress.Result/App/GroupUser/GroupUserListResult.cs

@@ -53,5 +53,6 @@ namespace GxPress.Result.App.GroupUser
         /// </summary>
         /// <value></value>
         public string Email { get; set; }
+    
     }
 }

+ 25 - 5
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -28,7 +28,7 @@ using GxPress.Common.Http;
 using GxPress.Repository.Interface.DepartmentUser;
 using GxPress.Request.App.GroupUser;
 using GxPress.Result.App.GroupUser;
-
+using SqlKata.Extensions;
 namespace GxPress.Repository.Implement
 {
     public class UserRepository : IUserRepository
@@ -866,9 +866,24 @@ namespace GxPress.Repository.Implement
             var noticeConstValue = AllTypeConst.Notice.GetHashCode();
             var missiveConstValue = AllTypeConst.Missive.GetHashCode();
             var anonymityConstValue = AllTypeConst.Anonymity.GetHashCode();
-            string sql = $@"select count(1) from tede_middle where FolderType={AllTypeConst.Inbox.GetHashCode()} 
-            and UserId={userId} and IsDelete=0 and 
-            MiddleId in (select SourceId from tede_addressee where UserId={userId} and IsRead=0 and IsDelete=0 and SourceType in({noticeConstValue},{missiveConstValue},{anonymityConstValue}))";
+            string sql = $@"SELECT 
+                                COUNT(1)
+                            FROM
+                                tede_middle a
+                                    INNER JOIN
+                                tede_notice b ON a.MiddleId = b.Id
+                            WHERE
+                                a.FolderType = {AllTypeConst.Inbox.GetHashCode()} AND a.UserId = {userId}
+                                    AND b.NoticeType = 1
+                                    AND a.IsDelete = 0
+                                    AND a.MiddleId IN (SELECT 
+                                        SourceId
+                                    FROM
+                                        tede_addressee
+                                    WHERE
+                                        UserId = {userId} AND IsRead = 0
+                                            AND IsDelete = 0
+                                            AND SourceType IN ({noticeConstValue} ,{missiveConstValue}, {anonymityConstValue}))";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -1141,12 +1156,16 @@ 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 userCount = new SqlKata.Query("tede_user");
             userCount.Where("Id", ">", 0).AsCount("Id");
             var query = new SqlKata.Query("tede_user");
             query.Join("tede_department as a", "a.Id", "tede_user.DepartmentId");
             query.Join("tede_group_user as b", "b.UserId", "tede_user.Id");
-            query.Where("b.GroupId", "=", request.GroupId);
+            query.Where("b.GroupId", request.GroupId);
             if (!string.IsNullOrEmpty(request.KeyWord))
                 query.Where(n => n.OrWhereLike("tede_user.Name", $"%{request.KeyWord}").OrWhereLike("tede_user.Phone", $"%{request.KeyWord}").OrWhereLike("tede_user.Email", $"%{request.KeyWord}"));
             if (request.TypeId == 1)
@@ -1158,6 +1177,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");
             var result = await _repository.GetAllAsync<GroupUserListResult>(query);
             foreach (var item in result)
             {