|
|
@@ -1098,11 +1098,11 @@
|
|
|
MIN(rl.operate_date) AS createTime
|
|
|
FROM report_log rl
|
|
|
FORCE INDEX (idx_report_log_main) -- 强制使用新索引
|
|
|
- LEFT JOIN `user` ON `user`.id = rl.operator_id
|
|
|
+ LEFT JOIN `user` ON `user`.id = rl.creator_id
|
|
|
LEFT JOIN department d ON `user`.department_id = d.department_id
|
|
|
WHERE rl.company_id = #{companyId}
|
|
|
AND rl.create_date between #{startDate} and #{endDate}
|
|
|
- AND rl.msg LIKE CONCAT(`user`.name, '%提交了日报') -- 使用LIKE替代CONCAT相等
|
|
|
+ AND rl.msg LIKE '%提交了日报' -- 使用LIKE替代CONCAT相等
|
|
|
AND `user`.is_active = 1
|
|
|
<if test="userId!=null">
|
|
|
and `user`.id=#{userId}
|
|
|
@@ -1117,10 +1117,10 @@
|
|
|
SELECT 1
|
|
|
FROM report_log r2
|
|
|
FORCE INDEX (idx_report_log_sub) -- 强制子查询使用索引
|
|
|
- WHERE r2.operator_id = rl.operator_id
|
|
|
+ WHERE r2.creator_id = rl.creator_id
|
|
|
AND r2.create_date = rl.create_date
|
|
|
AND r2.operate_date > rl.operate_date
|
|
|
- AND r2.msg LIKE CONCAT(`user`.name, '%撤销了日报')
|
|
|
+ AND r2.msg LIKE '%撤销了日报'
|
|
|
)
|
|
|
GROUP BY user.id, rl.create_date;
|
|
|
</select>
|