李书文 1 år sedan
förälder
incheckning
413804218b

+ 2 - 2
smart-admin/src/main/java/com/huijy/web/controller/api/ApiIndexController.java

@@ -370,8 +370,8 @@ public class ApiIndexController extends ApiAbstractController {
         AjaxResult result = new AjaxResult();
         AboutUs aboutUs = aboutUsService.selectAboutUsByAboutUsId(1L);
         result.put("aboutUs", aboutUs);
-        List<Content> hot_list = contentService.home("2"); //热门景区
-        List<Content> zn_list = contentService.home("3"); //攻略指南
+        List<Content> hot_list = contentService.home("2",3); //热门景区
+        List<Content> zn_list = contentService.home("3",1); //攻略指南
         result.put("hot_list", hot_list);
         result.put("zn_list", zn_list);
         return AjaxResult.success(result);

+ 2 - 1
smart-system/src/main/java/com/huijy/management/mapper/ContentMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.huijy.management.domain.Content;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 内容管理Mapper接口
@@ -20,7 +21,7 @@ public interface ContentMapper {
      */
     public Content selectContentByContentId(Long contentId);
 
-    public List<Content> home(String serviceInfo);
+    public List<Content> home(@Param("serviceInfo") String serviceInfo, @Param("limit") int limit);
 
     /**
      * 查询内容管理列表

+ 1 - 1
smart-system/src/main/java/com/huijy/management/service/IContentService.java

@@ -28,7 +28,7 @@ public interface IContentService {
      */
     public List<Content> selectContentList(Content content);
 
-    public List<Content> home(String serviceInfo);
+    public List<Content> home(String serviceInfo,int limit);
 
     /**
      * 新增内容管理

+ 2 - 2
smart-system/src/main/java/com/huijy/management/service/impl/ContentServiceImpl.java

@@ -51,8 +51,8 @@ public class ContentServiceImpl implements IContentService {
     }
 
     @Override
-    public List<Content> home(String serviceInfo) {
-        return contentMapper.home(serviceInfo);
+    public List<Content> home(String serviceInfo,int limit) {
+        return contentMapper.home(serviceInfo,limit);
     }
 
     /**

+ 1 - 1
smart-system/src/main/resources/mapper/management/ContentMapper.xml

@@ -51,7 +51,7 @@
     </select>
 
     <select id="home" resultMap="ContentResult">
-        select content_id, service_info,title,brief_content, show_pictures,create_time from t_content where service_info = #{serviceInfo} and release_flag=1 order by create_time desc limit 1
+        select content_id, service_info,title,brief_content, show_pictures,create_time from t_content where service_info = #{serviceInfo} and release_flag=1 order by create_time desc limit #{limit}
     </select>
 
     <insert id="insertContent" parameterType="Content" useGeneratedKeys="true" keyProperty="contentId">