Selaa lähdekoodia

fix: 补充发布者姓名

FanYanpeng 3 vuotta sitten
vanhempi
commit
07a9755fe0

+ 3 - 1
seecoder-portal-common/src/main/java/cn/seecoder/seecoderportalcommon/vo/CommunicationVO.java

@@ -15,6 +15,8 @@ public class CommunicationVO {
 
     private Long publisherId;
 
+    private String publisherName;
+
     private String title;
 
     private CommunicationTypeEnum type;
@@ -39,7 +41,7 @@ public class CommunicationVO {
 
     private List<CommunicationFileVO> attachments;
 
-    private String publisherName;
+
 
     //是否已经收藏
     private Boolean starred;

+ 11 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/domain/Communication.java

@@ -22,6 +22,8 @@ public class Communication {
 
     private Long publisherId;
 
+    private String publisherName;
+
     private String title;
 
     @Column
@@ -64,6 +66,15 @@ public class Communication {
         return this;
     }
 
+    public String getPublisherName() {
+        return publisherName;
+    }
+
+    public Communication setPublisherName(String publisherName) {
+        this.publisherName = publisherName;
+        return this;
+    }
+
     public Long getPublisherId() {
         return publisherId;
     }

+ 2 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/mapper/impl/CommunicationMapperImpl.java

@@ -26,6 +26,8 @@ public class CommunicationMapperImpl implements CommunicationMapper {
 
     private final CommunicationStarRepository communicationStarRepository;
 
+
+
     public CommunicationMapperImpl(CommunicationFileMapper communicationFileMapper, CommunicationStarRepository communicationStarRepository) {
         this.communicationFileMapper = communicationFileMapper;
         this.communicationStarRepository = communicationStarRepository;

+ 5 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/serviceImpl/CommunicationServiceImpl.java

@@ -133,6 +133,11 @@ public class CommunicationServiceImpl implements CommunicationService {
         communication.setPublisherId(userId);
         communication.setPublishTime(new Date());
 
+        // 添加用户的姓名
+        UserVO userVO = userService.findUserById(userId);
+        communication.setPublisherName(userVO.getName());
+
+
         communicationRepository.save(communication);
 
         return communicationMapper.toCommunicationVO(communication,userId);