huangzhiguo 2 rokov pred
rodič
commit
ca97a2cce2

+ 6 - 1
src/main/java/com/caimei/www/service/page/impl/SinglePageServiceImpl.java

@@ -12,6 +12,7 @@ import org.springframework.http.MediaType;
 import org.springframework.http.ZeroCopyHttpOutputMessage;
 import org.springframework.http.server.reactive.ServerHttpResponse;
 import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 import reactor.core.publisher.Mono;
 
@@ -49,7 +50,11 @@ public class SinglePageServiceImpl implements SinglePageService {
         PageContent pageContent = singlePageDao.getFreePageById(id);
         String mobileContent = singlePageDao.findMobileContent(id);
         if (StringUtils.isEmpty(mobileContent)) {
-            pageContent.setMobileContent(pageContent.getContent());
+            if (!ObjectUtils.isEmpty(pageContent.getContent())) {
+                pageContent.setMobileContent(pageContent.getContent());
+            } else {
+                pageContent.setMobileContent("");
+            }
         } else {
             pageContent.setMobileContent(mobileContent);
         }

+ 1 - 1
src/main/resources/mapper/SinglePageMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.www.mapper.SinglePageDao">
     <select id="getFreePageById" resultType="com.caimei.www.pojo.page.PageContent">
-        select  a.id, a.type, a.title, a.keywords, a.description, ifnull(f.content,''), a.backgroundColour, a.backgroundImage
+        select  a.id, a.type, a.title, a.keywords, a.description, ifnull(f.content,'') as content, a.backgroundColour, a.backgroundImage
         from cm_page a
         left join cm_page_freedom f on a.id=f.pageId
         where a.type=4 and a.enabledStatus=1 and f.type=1