| | |
| | | ifnull(sum(aa.num3), 0) as notClockInDays, |
| | | ifnull(dd.num1, 0) as shouldClockInDays |
| | | from ( |
| | | select app_user_id, count(id) as num1, 0 as num2, 0 as num3 from xp_clock_in where is_deleted = 0 and |
| | | clock_in_result = 1 and clock_out_result = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | select app_user_id, sum(num1) as num1, 0 as num2, 0 as num3 from ( |
| | | select app_user_id, count(id) as num1 from xp_clock_in where is_deleted = 0 and clock_in_result = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, count(id) as num1 from xp_clock_in where is_deleted = 0 and clock_out_result = 1 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | ) as temp |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, 0 as num1, count(id) as num2, 0 as num3 from xp_clock_in where is_deleted = 0 and |
| | | (clock_in_result = 2 or clock_out_result = 2) |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | select app_user_id, 0 as num1, sum(num2) as num2, 0 as num3 from ( |
| | | select app_user_id, count(id) as num2 from xp_clock_in where is_deleted = 0 and clock_in_result = 2 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, count(id) as num2 from xp_clock_in where is_deleted = 0 and clock_out_result = 2 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | ) as temp |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, 0 as num1, 0 as num2, count(id) as num3 from xp_clock_in where is_deleted = 0 and |
| | | (clock_in_result = 3 or clock_out_result = 3) |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | select app_user_id, 0 as num1, 0 as num2, sum(num3) as num3 from ( |
| | | select app_user_id, count(id) as num3 from xp_clock_in where is_deleted = 0 and clock_in_result = 3 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | union all |
| | | select app_user_id, count(id) as num3 from xp_clock_in where is_deleted = 0 and clock_out_result = 3 |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and app_user_id in |
| | | <foreach item="item" collection="appUserIds" separator="," open="(" close=")" index="index"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != startTime and '' != startTime and null != endTime and '' != endTime"> |
| | | and DATE_FORMAT(clock_in_time, '%Y-%m-%d') between #{startTime} and #{endTime} |
| | | </if> |
| | | group by app_user_id |
| | | ) as temp |
| | | group by app_user_id |
| | | ) as aa |
| | | left join xp_fleet_operations bb on (aa.app_user_id = bb.operations_user_id) |