Bladeren bron

Merge branch 'master' of http://120.78.165.83:8123/git/nazw

李雪梅 2 jaren geleden
bovenliggende
commit
5c1db6b535

+ 5 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/ImpressionNanan.java

@@ -29,5 +29,10 @@ public class ImpressionNanan implements Serializable {
     private int examineState = 0;
     //图片描述
     private String pictureDescription;
+    //图片标题
+    private String pictureTitle;
+    //图片作者
+    private String pictureAuthor;
+
 
 }

+ 19 - 1
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/YxnnServiceImpl.java

@@ -56,6 +56,12 @@ public class YxnnServiceImpl implements YxnnService {
         if (!Validator.isMobile(impressionNanan.getUploaderPhone())) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "电话格式不正确,请填入移动电话号码");
         }
+        if (impressionNanan.getPictureTitle().length() > 200) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "标题长度不能大于100");
+        }
+        if (impressionNanan.getPictureAuthor().length() > 50) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "作者长度不能大于50");
+        }
         if (impressionNanan.getPictureDescription().length() > 200) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "图片描述长度不能大于200");
         }
@@ -94,7 +100,7 @@ public class YxnnServiceImpl implements YxnnService {
         if (Blank.isNotEmpty(impressionNanan.getUrlAddress())) {
             File file = new File(path + "/" + impressionNanan.getUrlAddress());
             //删出对应的文件,以及对应的文件信息
-            if(file.exists()){
+            if (file.exists()) {
                 file.delete();
             }
         }
@@ -109,6 +115,12 @@ public class YxnnServiceImpl implements YxnnService {
         if (!Validator.isMobile(impressionNanan.getUploaderPhone())) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "电话格式不正确,请填入移动电话号码");
         }
+        if (impressionNanan.getPictureTitle().length() > 200) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "标题长度不能大于100");
+        }
+        if (impressionNanan.getPictureAuthor().length() > 50) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "作者长度不能大于50");
+        }
         if (impressionNanan.getPictureDescription().length() > 200) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "图片描述长度不能大于200");
         }
@@ -142,6 +154,12 @@ public class YxnnServiceImpl implements YxnnService {
         if (!Validator.isMobile(impressionNanan.getUploaderPhone())) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "电话格式不正确,请填入移动电话号码");
         }
+        if (impressionNanan.getPictureTitle().length() > 200) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "标题长度不能大于100");
+        }
+        if (impressionNanan.getPictureAuthor().length() > 50) {
+            return SendUtil.send(false, ConstStr.ADD_FAILED, "作者长度不能大于50");
+        }
         if (impressionNanan.getPictureDescription().length() > 200) {
             return SendUtil.send(false, ConstStr.ADD_FAILED, "图片描述长度不能大于200");
         }

+ 13 - 6
nngkxxdp/src/main/resources/mapper/YxnnDao.xml

@@ -14,7 +14,9 @@
         url_address,
         picture_type,
         examine_state,
-        picture_description
+        picture_description,
+        picture_title,
+        picture_author
         FROM impression_nanan
         <where>
             <if test="pictureType != null">
@@ -30,15 +32,16 @@
 
     <insert id="saveDocumetIn" parameterType="com.example.nngkxxdp.entity.ImpressionNanan">
         INSERT INTO impression_nanan (uploader_phone, upload_time, update_time, url_address, picture_type,
-                                      examine_state,
-                                      picture_description)
+                                      examine_state,picture_description,picture_title,picture_author)
         VALUES (#{uploaderPhone},
                 #{uploadTime},
                 #{updateTime},
                 #{urlAddress},
                 #{pictureType},
                 #{examineState},
-                #{pictureDescription})
+                #{pictureDescription},
+                #{pictureTitle},
+                #{pictureAuthor})
     </insert>
 
     <select id="getDocumentById" resultType="com.example.nngkxxdp.entity.ImpressionNanan">
@@ -49,7 +52,9 @@
                url_address,
                picture_type,
                examine_state,
-               picture_description
+               picture_description,
+               picture_title,
+               picture_author
         FROM impression_nanan
         where id = #{id}
     </select>
@@ -62,7 +67,9 @@
             url_address=#{urlAddress},
             picture_type=#{pictureType},
             examine_state=#{examineState},
-            picture_description=#{pictureDescription}
+            picture_description=#{pictureDescription},
+            picture_title=#{pictureTitle},
+            picture_author=#{pictureAuthor}
         WHERE id = #{id}
     </update>