소스 검색

[fix]
解决报错

chenchen 1 개월 전
부모
커밋
05fb5582f6
1개의 변경된 파일7개의 추가작업 그리고 9개의 파일을 삭제
  1. 7 9
      application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourTravelNotesTopicMapper.xml

+ 7 - 9
application-webadmin/src/main/java/com/tourism/webadmin/back/dao/mapper/TourTravelNotesTopicMapper.xml

@@ -67,15 +67,13 @@
 
     <select id="getTourTravelNotesTopicListByName" resultType="com.tourism.webadmin.app.website.model.TourShortTopic" parameterType="String">
         SELECT
-            tnt.name AS topic_name,
-            SUM(tntp.page_view_count) AS total_view_count
+        tnt.NAME AS topic_name,
+        COALESCE(SUM(tntp.page_view_count), 0) AS total_view_count
         FROM
-            tour_travel_notes_topic tnt
-                JOIN
-            tour_travel_notes_topic_relation tnttr ON tnt.id = tnttr.topic_id
-                JOIN
-            tour_tourism_project_travel_notes tntp ON tnttr.travel_notes_id = tntp.id
-        where tnt.enable = 1 and tnt.data_state = 1 and tntp.data_state = 1
+        tour_travel_notes_topic tnt
+        LEFT JOIN tour_travel_notes_topic_relation tnttr ON tnt.id = tnttr.topic_id
+        LEFT JOIN tour_tourism_project_travel_notes tntp ON tnttr.travel_notes_id = tntp.id
+        where tnt.enable = 1 and tnt.data_state = 1
         <where>
             <if test="name != null and name != ''">
             and tnt.name LIKE CONCAT('%', #{name}, '%')
@@ -84,6 +82,6 @@
         GROUP BY
             tnt.name
         ORDER BY
-            total_view_count DESC;
+            total_view_count DESC
     </select>
 </mapper>