李昊 il y a 4 ans
Parent
commit
e6b6291ddd

+ 2 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/AddresseeRepository.cs

@@ -101,7 +101,7 @@ namespace GxPress.Repository.Implement
                 sqlValue += " and a.IsRead=0";
             if (!string.IsNullOrWhiteSpace(request.Key))
                 sqlValue += $" and b.Name like '%{request.Key}%'";
-            var sql = $"SELECT a.*,b.Name,b.AvatarUrl,c.Name FROM tede_notice_addressee a inner join tede_user b on a.UserId=b.Id inner join tede_department c on c.Id=b.DepartmentId where a.NoticeId={request.NoticeId} {sqlValue} order by a.LastModifiedDate desc";
+            var sql = $"SELECT a.*,b.Name,b.AvatarUrl,c.Name FROM tede_addressee a inner join tede_user b on a.UserId=b.Id inner join tede_department c on c.Id=b.DepartmentId where a.SourceId={request.NoticeId} {sqlValue} order by a.LastModifiedDate desc";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -126,7 +126,7 @@ namespace GxPress.Repository.Implement
         public async Task<IEnumerable<User>> GetUserByNoticeIdAsync(int noticeId)
         {
 
-            var sql = $"SELECT  b.* FROM tede_notice_addressee a inner join tede_user b on a.UserId=b.Id where a.NoticeId={noticeId} and a.IsAdmin=0;";
+            var sql = $"SELECT  b.* FROM tede_addressee a inner join tede_user b on a.UserId=b.Id where a.SourceId={noticeId} and a.IsAdmin=0;";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();

+ 12 - 12
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs

@@ -338,11 +338,11 @@ namespace GxPress.Repository.Implement
                             OR a.CreatedDate LIKE '%{request.Keyword}%' or a.MiddleId in (SELECT 
                                                                                             g.NoticeId
                                                                                         FROM
-                                                                                            tede_notice_addressee g
+                                                                                            tede_addressee g
                                                                                                 INNER JOIN
                                                                                             tede_user h ON g.UserId = h.Id
                                                                                         WHERE
-                                                                                            g.NoticeId =a.MiddleId AND h.Name LIKE '%{request.Keyword}%'))";
+                                                                                            g.SourceId =a.MiddleId AND h.Name LIKE '%{request.Keyword}%'))";
                 else
                     sb += $@" AND a.AttributeValue != 2 AND (b.Title LIKE '%{request.Keyword}%'
                             OR b.Content LIKE '%{request.Keyword}%'
@@ -351,11 +351,11 @@ namespace GxPress.Repository.Implement
                             OR a.CreatedDate LIKE '%{request.Keyword}%'  or a.MiddleId in (SELECT 
                                                                                             g.NoticeId
                                                                                         FROM
-                                                                                            tede_notice_addressee g
+                                                                                            tede_addressee g
                                                                                                 INNER JOIN
                                                                                             tede_user h ON g.UserId = h.Id
                                                                                         WHERE
-                                                                                            g.NoticeId =a.MiddleId AND h.Name LIKE '%{request.Keyword}%'))";
+                                                                                            g.SourceId =a.MiddleId AND h.Name LIKE '%{request.Keyword}%'))";
             }
             else
             {
@@ -429,19 +429,19 @@ namespace GxPress.Repository.Implement
                             ParentId = a.Id and IsDelete=0 and NoticeAddresseeType<>2) as FileCount,(SELECT 
                     COUNT(1)
                 FROM
-                    tede_notice_addressee
+                    tede_addressee
                 WHERE
-                    NoticeId = a.MiddleId AND IsRead = 1) as ReadCount,(SELECT 
+                    SourceId = a.MiddleId AND IsRead = 1) as ReadCount,(SELECT 
                     COUNT(1)
                 FROM
-                    tede_notice_addressee
+                    tede_addressee
                 WHERE
-                    NoticeId = a.MiddleId ) as AllCount,(SELECT 
+                    SourceId = a.MiddleId ) as AllCount,(SELECT 
                     COUNT(1)
                 FROM
-                    tede_notice_addressee
+                    tede_addressee
                 WHERE
-    NoticeId = a.MiddleId AND IsRead = 1 and UserId={request.UserId} limit 0,1) as IsRead, b.*, c.Name, c.AvatarUrl, d.*
+    SourceId = a.MiddleId AND IsRead = 1 and UserId={request.UserId} limit 0,1) as IsRead, b.*, c.Name, c.AvatarUrl, d.*
                                     FROM
                                         tede_middle a
                                             left   JOIN
@@ -449,7 +449,7 @@ namespace GxPress.Repository.Implement
                                             left JOIN
                                         tede_user c ON b.UserId = c.Id
                                             left JOIN
-                                        tede_notice_addressee d ON d.Id = a.MiddleSonId
+                                        tede_addressee d ON d.Id = a.MiddleSonId
                                     WHERE
                                         a.UserId = {request.UserId} and a.FolderType=1
                                             {sb}
@@ -464,7 +464,7 @@ namespace GxPress.Repository.Implement
                                             left JOIN
                                         tede_user c ON b.UserId = c.Id
                                             left JOIN
-                                        tede_notice_addressee d ON d.Id = a.MiddleSonId
+                                        tede_addressee d ON d.Id = a.MiddleSonId
                                     WHERE
                                         a.UserId = {1} and a.FolderType=1
                                             {0}", sb, request.UserId);

+ 1 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.Insert.cs

@@ -9,7 +9,6 @@ using GxPress.EnumConst;
 using System.Linq;
 using System.Collections.Generic;
 using Datory;
-using Aliyun.Acs.Core.Utils;
 
 namespace GxPress.Service.Implement.Notice
 {
@@ -113,7 +112,7 @@ namespace GxPress.Service.Implement.Notice
                         NoticeAddresseeType = request.NoticeType,
                         IsTop = false,
                         IsRead = true,
-                        SourceType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()
+                        SourceType = AllTypeConst.Notice.GetHashCode()
                     };
                     var noticeAddresseeId = await _addresseeRepository.InsertAsync(addresseeEntity);
                     request.NoticeAddresseeUserIds = request.NoticeAddresseeUserIds.Distinct().ToList();