<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.appInterface.mapper.FbsWorkingStatisticsMapper">
    <select id="getByMaterial" resultType="org.jeecg.modules.appInterface.entity.FbsWorkingStatistics">
        SELECT
            sum( fws.working_hours ) as workingHours,
            fwdl.product
        FROM
            fbs_working_statistics fws
            LEFT JOIN fbs_workshop_dispatch_list fwdl ON fws.pk_workshop_dispatch_list = fwdl.id
        WHERE
            fws.del_flag = '0'
            AND fwdl.del_flag = '0'
            AND fws.final_state IN ( '2', '3' )
            AND date_format( fws.final_time, #{dateString} ) = DATE_FORMAT( now( ), #{dateString} )
        GROUP BY
            fwdl.product
    </select>
</mapper>