fix:过滤user表和real_name 表软删除的记录

# Conflicts:
#	internal/dao/taskDao.go
This commit is contained in:
cjy 2026-01-07 13:06:05 +08:00
parent fa79376e51
commit 4f01d924d6

View File

@ -464,9 +464,9 @@ active_windows AS (
bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number, bb.manual_data_analysis_number, bb.manual_data_analysis_consumption_number,
rn.name AS user_name rn.name AS user_name
FROM ` + "`micro-account`.`user`" + ` u FROM ` + "`micro-account`.`user`" + ` u
INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL INNER JOIN ` + "`micro-account`.real_name" + ` rn ON rn.id = u.real_name_id AND rn.name IS NOT NULL AND rn.deleted_at = 0
INNER JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2 INNER JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2
INNER JOIN latest_bor bor ON bor.customer_id = u.id INNER JOIN latest_bor bor ON bor.customer_id = u.id AND u.deleted_at = 0
INNER JOIN newest_month nm ON nm.user_id = u.id INNER JOIN newest_month nm ON nm.user_id = u.id
INNER JOIN bundle_balance bb ON bb.user_id = u.id AND bb.order_uuid = bor.uuid AND bb.month = nm.month AND bb.deleted_at IS NULL INNER JOIN bundle_balance bb ON bb.user_id = u.id AND bb.order_uuid = bor.uuid AND bb.month = nm.month AND bb.deleted_at IS NULL
WHERE u.deleted_at = 0 WHERE u.deleted_at = 0
@ -861,13 +861,13 @@ func GetPendingUploadBreakdownBySubNums(subNums []string, page int, pageSize int
" (SELECT customer_id, MAX(created_at) AS max_created_time FROM bundle_order_records WHERE status = 2 AND deleted_at IS NULL GROUP BY customer_id) AS bor2\n" + " (SELECT customer_id, MAX(created_at) AS max_created_time FROM bundle_order_records WHERE status = 2 AND deleted_at IS NULL GROUP BY customer_id) AS bor2\n" +
" ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time\n" + " ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time\n" +
"JOIN `micro-account`.user u ON u.id = bor1.customer_id AND u.deleted_at = 0\n" + "JOIN `micro-account`.user u ON u.id = bor1.customer_id AND u.deleted_at = 0\n" +
"JOIN `micro-account`.real_name rn ON rn.id = u.real_name_id\n" + "JOIN `micro-account`.real_name rn ON rn.id = u.real_name_id AND rn.deleted_at = 0\n" +
"JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2\n" + "JOIN bundle_activate bc ON bc.user_id = u.id AND bc.activate = 2\n" +
"JOIN bundle_balance bb ON bb.order_uuid COLLATE utf8mb4_general_ci = bor1.uuid COLLATE utf8mb4_general_ci AND bb.user_id = u.id\n" + "JOIN bundle_balance bb ON bb.order_uuid COLLATE utf8mb4_general_ci = bor1.uuid COLLATE utf8mb4_general_ci AND bb.user_id = u.id AND u.deleted_at = 0\n" +
"JOIN\n" + "JOIN\n" +
" (SELECT user_id, MAX(month) AS month FROM bundle_balance WHERE deleted_at IS NULL GROUP BY user_id) AS newest_month\n" + " (SELECT user_id, MAX(month) AS month FROM bundle_balance WHERE deleted_at IS NULL GROUP BY user_id) AS newest_month\n" +
" ON bb.user_id = newest_month.user_id AND CAST(bb.month AS CHAR) COLLATE utf8mb4_general_ci = CAST(newest_month.month AS CHAR) COLLATE utf8mb4_general_ci\n" + " ON bb.user_id = newest_month.user_id AND CAST(bb.month AS CHAR) COLLATE utf8mb4_general_ci = CAST(newest_month.month AS CHAR) COLLATE utf8mb4_general_ci\n" +
"LEFT JOIN latest_bundle_balance lbb ON lbb.user_id = u.id\n" + "LEFT JOIN latest_bundle_balance lbb ON lbb.user_id = u.id AND u.deleted_at = 0\n" +
"LEFT JOIN cast_work cw ON cw.artist_phone COLLATE utf8mb4_general_ci = u.tel_num COLLATE utf8mb4_general_ci AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN bb.start_at AND bb.expired_at\n" + "LEFT JOIN cast_work cw ON cw.artist_phone COLLATE utf8mb4_general_ci = u.tel_num COLLATE utf8mb4_general_ci AND cw.deleted_at = 0 AND (cw.origin_uuid = '' OR cw.origin_uuid IS NULL) AND cw.submit_time BETWEEN bb.start_at AND bb.expired_at\n" +
"LEFT JOIN cast_work_extra cwe ON cwe.work_uuid = cw.uuid AND cwe.deleted_at = 0\n" + "LEFT JOIN cast_work_extra cwe ON cwe.work_uuid = cw.uuid AND cwe.deleted_at = 0\n" +
"LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = u.tel_num COLLATE utf8mb4_general_ci AND cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(bb.start_at) AND UNIX_TIMESTAMP(bb.expired_at)\n" + "LEFT JOIN cast_work_analysis cwa ON cwa.artist_phone COLLATE utf8mb4_general_ci = u.tel_num COLLATE utf8mb4_general_ci AND cwa.deleted_at = 0 AND (cwa.work_analysis_status IS NULL OR cwa.work_analysis_status != 1) AND cwa.submit_time BETWEEN UNIX_TIMESTAMP(bb.start_at) AND UNIX_TIMESTAMP(bb.expired_at)\n" +