|
|
@@ -141,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
csl.status AS status,
|
|
|
csl.type AS type,
|
|
|
csl.content AS content,
|
|
|
- <!-- 根据optionType动态选择关联字段 -->
|
|
|
+ <!-- 动态选择字段 -->
|
|
|
<choose>
|
|
|
<when test="dto.optionType == 1">
|
|
|
fuc.course_name AS courseName,
|
|
|
@@ -158,7 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
company_sms_logs csl
|
|
|
LEFT JOIN company c ON csl.company_id = c.company_id
|
|
|
LEFT JOIN company_user cu ON csl.company_user_id = cu.user_id
|
|
|
- <!-- 根据optionType动态关联不同的表 -->
|
|
|
+ <!-- 动态关联表 -->
|
|
|
<choose>
|
|
|
<when test="dto.optionType == 1">
|
|
|
LEFT JOIN qw_course_link_send_msg_log qclog ON csl.logs_id = qclog.company_sms_logs_id
|
|
|
@@ -168,8 +168,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<when test="dto.optionType == 2">
|
|
|
LEFT JOIN qw_acquisition_send_msg_log qalog ON csl.logs_id = qalog.company_sms_logs_id
|
|
|
</when>
|
|
|
+ <otherwise>
|
|
|
+ <!-- 可选:不关联任何表 -->
|
|
|
+ </otherwise>
|
|
|
</choose>
|
|
|
<where>
|
|
|
+ <!-- 公共条件 -->
|
|
|
<if test="dto.companyId != null">
|
|
|
AND csl.company_id = #{dto.companyId}
|
|
|
</if>
|
|
|
@@ -194,7 +198,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="dto.endCreateTime != null">
|
|
|
AND csl.create_time <= #{dto.endCreateTime}
|
|
|
</if>
|
|
|
- <!-- 课程链接类型特有查询条件 -->
|
|
|
+
|
|
|
+ <!-- 根据 optionType 过滤日志类型 -->
|
|
|
+ <choose>
|
|
|
+ <when test="dto.optionType == 1">
|
|
|
+ AND qclog.company_sms_logs_id IS NOT NULL
|
|
|
+ </when>
|
|
|
+ <when test="dto.optionType == 2">
|
|
|
+ AND qalog.company_sms_logs_id IS NOT NULL
|
|
|
+ </when>
|
|
|
+ <!-- 如果 optionType 为 null 或其他值,可选择不过滤,或默认查全部 -->
|
|
|
+ </choose>
|
|
|
+
|
|
|
+ <!-- 课程类型特有查询条件 -->
|
|
|
<if test="dto.optionType == 1">
|
|
|
<if test="dto.courseId != null">
|
|
|
AND fuc.course_id = #{dto.courseId}
|