<?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="com.fjhx.oa.mapper.daily.DailyReportMapper">
    <select id="getPage" resultType="com.fjhx.oa.entity.daily.vo.DailyReportVo">
        SELECT
        dr.id,
        dr.completed_work,
        dr.unfinished_work,
        dr.coordinated_work,
        dr.is_visible_to_recipient,
        dr.create_user,
        dr.create_time,
        dr.update_user,
        dr.update_time,
        drd.is_read,
        WEEKDAY(dr.create_time)+1 `week`,
        date_format(dr.create_time,'%Y-%m-%d') `date`
        FROM
        daily_report dr
        JOIN daily_report_details drd ON drd.daily_report_id = dr.id
        ${ew.customSqlSegment}
    </select>
    <select id="detail" resultType="com.fjhx.oa.entity.daily.vo.DailyReportVo">
        SELECT
        dr.*,
        sum( drd.is_read ) readCount
        FROM
        daily_report dr
        LEFT JOIN daily_report_details drd ON drd.daily_report_id = dr.id
        WHERE
        dr.id = #{id}
    </select>

</mapper>
