<?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.springblade.modules.byMonth.mapper.ByMonthMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="byMonthResultMap" type="org.springblade.modules.byMonth.entity.ByMonthEntity">
        <result column="id" property="id"/>
        <result column="user_id" property="userId"/>
        <result column="dept_id" property="deptId"/>
        <result column="sjhm" property="sjhm"/>
        <result column="yf" property="yf"/>
        <result column="is_confirm" property="isConfirm"/>
    </resultMap>


    <select id="selectByMonthPage" resultType="org.springblade.modules.byMonth.vo.ByMonthVO">
        select
            pbm.*,
            round( ( "numeric" ( pbm.djgz_fs ) + "numeric" ( pbm.cqkq_fs ) + "numeric" ( pbm.gzjl_fs ) ), 2 ) AS totalScore,
            bu.real_name
        from pfqr_by_month pbm
        left join blade_user bu on bu.id = pbm.user_id
        where pbm.is_deleted = 0
        <if test="null != params.yf and '' != params.yf">
            and pbm.yf = #{params.yf}
        </if>
        ORDER BY pbm.create_time
    </select>


    <select id="exportByMonth" resultType="org.springblade.modules.byMonth.excel.ByMonthExcel">
        SELECT * FROM pfqr_by_month ${ew.customSqlSegment}
    </select>

    <update id="updateIsconfirm">
        update pfqr_by_month set is_confirm = 1 where yf = #{yf}
    </update>
</mapper>
