Browse Source

新闻po增加字段

xusonglin 5 years ago
parent
commit
d60e6cc7e3

+ 4 - 0
src/main/java/com/jkcredit/sysnews/model/dto/newsArticle/NewsArticleDto.java

@@ -32,4 +32,8 @@ public class NewsArticleDto implements Serializable {
     private List<String> urlList;
 
     private Integer topFlag;
+
+    private String author;
+
+    private String source;
 }

+ 6 - 0
src/main/java/com/jkcredit/sysnews/model/po/newsArticle/NewsArticlePo.java

@@ -41,4 +41,10 @@ public class NewsArticlePo implements Serializable {
     private String photoUrl;
 
     private Integer topFlag;
+
+    private String author;
+
+    private String source;
+
+    private Date publishTime;
 }

+ 6 - 1
src/main/java/com/jkcredit/sysnews/model/vo/newsArticle/NewsArticleBizVo.java

@@ -4,7 +4,6 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 
 /**
  * @description:
@@ -29,4 +28,10 @@ public class NewsArticleBizVo implements Serializable {
     private String photoUrl;
 
     private Integer topFlag;
+
+    private String author;
+
+    private String source;
+
+    private Date publishTime;
 }

+ 6 - 0
src/main/java/com/jkcredit/sysnews/model/vo/newsArticle/NewsArticleVo.java

@@ -34,4 +34,10 @@ public class NewsArticleVo implements Serializable {
     private List<String> urlList;
 
     private Integer topFlag;
+
+    private String author;
+
+    private String source;
+
+    private Date publishTime;
 }

+ 4 - 0
src/main/java/com/jkcredit/sysnews/resource/web/newsArticle/fb/NewsArticleFB.java

@@ -33,4 +33,8 @@ public class NewsArticleFB implements Serializable {
     private List<String> urlList;
 
     private Integer topFlag;
+
+    private String author;
+
+    private String source;
 }

+ 7 - 0
src/main/java/com/jkcredit/sysnews/service/newsArticle/NewsArticleServiceImpl.java

@@ -128,6 +128,7 @@ public class NewsArticleServiceImpl extends BaseService implements NewsArticleSe
         BeanUtil.copyProperties(newsArticlePo, newsArticleDto);
         newsArticlePo.setCreateTime(new Date());
         newsArticlePo.setPhotoId(photoVo.getId());
+        newsArticlePo.setPublishTime(new Date());
         try {
             mapper.insert(newsArticlePo);
         } catch (Exception e) {
@@ -190,6 +191,12 @@ public class NewsArticleServiceImpl extends BaseService implements NewsArticleSe
             if (newsArticleDto.getTopFlag() != null) {
                 newsArticlePo.setTopFlag(newsArticleDto.getTopFlag());
             }
+            if (newsArticleDto.getAuthor() != null) {
+                newsArticlePo.setAuthor(newsArticleDto.getAuthor());
+            }
+            if (newsArticleDto.getSource() != null) {
+                newsArticlePo.setSource(newsArticleDto.getSource());
+            }
             if (newsArticleDto.getPhoto() != null) {
                 try {
                     photoService.deletePhoto(newsArticlePo.getPhotoId());

+ 7 - 1
src/main/resources/mapper/NewsArticleMapper.xml

@@ -12,6 +12,9 @@
         <result column="activated" property="activated"/>
         <result column="photoUrl" property="photoUrl"/>
         <result column="top_flag" property="topFlag"/>
+        <result column="author" property="author"/>
+        <result column="source" property="source"/>
+        <result column="publish_time" property="publishTime"/>
     </resultMap>
 
     <sql id="photo">
@@ -22,7 +25,10 @@
         create_time,
         update_time,
         activated,
-        top_flag
+        top_flag,
+        author,
+        source,
+        publish_time
     </sql>
 
     <select id="getNewsArticles" resultMap="baseResultMap">