fix(sync): replace iText logger with SLF4J, add batch query methods

Replace com.itextpdf.text.log.Logger/LoggerFactory imports with
org.slf4j equivalents in SyncTaskService and SyncUserInfoService.

Add batchFindUserInfoByStuUserIds and batchFindUserIdByUsernames
queries to replace N+1 loop patterns in user sync operations.
This commit is contained in:
2026-06-09 09:57:54 +08:00
parent c97b523bc1
commit 0119b5bb87
4 changed files with 119 additions and 44 deletions

View File

@@ -226,10 +226,11 @@
LIMIT 1
</select>
<!-- 更新最后同步时间 -->
<!-- 更新最后同步时间(仅更新最新一条记录) -->
<update id="updateLastSyncTime" parameterType="java.util.Date">
UPDATE sync_task_log
SET sync_time = #{syncTime}
WHERE id = (SELECT max_id FROM (SELECT MAX(id) as max_id FROM sync_task_log) t)
</update>
<update id="update" parameterType="cn.wepact.dfm.training.dto.entity.SyncTaskLog">
@@ -339,8 +340,8 @@
SELECT
s.stu_user_id AS stuUserId,
s.project_id AS projectId,
SUM(CASE WHEN s.task_required = 1 THEN s.task_get_scores ELSE 0 END) AS requiredTotalScores,
SUM(CASE WHEN s.task_required = 0 THEN s.task_get_scores ELSE 0 END) AS electiveTotalScores
SUM(CASE WHEN s.task_required = 1 THEN IFNULL(s.task_get_scores, 0) ELSE 0 END) AS requiredTotalScores,
SUM(CASE WHEN s.task_required = 0 THEN IFNULL(s.task_get_scores, 0) ELSE 0 END) AS electiveTotalScores
FROM
(SELECT
s1.stu_user_id,