xuhy
2026-03-15 9146943317b7d51b669c5188416348cf40c562a5
打卡统计修改
1个文件已修改
108 ■■■■■ 已修改文件
xp-robotaxi-maintenance-boot/src/main/resources/mapper/maintenance/XpClockInMapper.xml 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/resources/mapper/maintenance/XpClockInMapper.xml
@@ -28,43 +28,85 @@
        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)