hjl
2024-05-21 f0d8f535a4c09dee9d786d8fb13c9b9918addaa9
ruoyi-service/ruoyi-study/src/main/resources/mapper/sutdy/TStudyMapper.xml
@@ -19,4 +19,21 @@
        id, week, day, listen, type, integral, sort, title
    </sql>
    <select id="weekList" resultType="com.ruoyi.study.dto.StudyWeekDTO">
        SELECT COALESCE(SUM(sa.integral), 0) + COALESCE(SUM(si.integral), 0) + COALESCE(SUM(st.integral), 0) +
               COALESCE(SUM(sk.integral), 0) + COALESCE(SUM(sp.integral), 0) + COALESCE(SUM(sl.integral), 0) +
               COALESCE(SUM(g.integral), 0) AS totalIntegral,
               s.week,
               s.title,
               s.quarter,s.id
        FROM t_study s
                 LEFT JOIN t_study_answer sa ON s.id = sa.studyId
                 LEFT JOIN t_study_induction si ON s.id = si.studyId
                 LEFT JOIN t_study_listen st ON s.id = st.studyId
                 LEFT JOIN t_study_look sk ON s.id = sk.studyId
                 LEFT JOIN t_study_pair sp ON s.id = sp.studyId
                 LEFT JOIN t_story_listen sl ON s.id = sl.studyId
                 LEFT JOIN t_game g ON s.id = g.studyId
        GROUP BY s.week, s.title, s.quarter,s.id;
    </select>
</mapper>