<?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.unis.examine.modular.neassessmentScoreSum.mapper.BizNeAssessmentScoreSumMapper">
    <select id="selectMyMapPage" resultType="com.unis.examine.modular.neassessmentScoreSum.entity.BizNeAssessmentScoreSum">
    SELECT DISTINCT
    nam .id assessmentManageId, -- 任务ID
    nat.id assessmentTargetId,    --  指标id
    nam.assessment_type pcType, -- 考核类型；1：国考
    nam.assessment_year assessmentYear,
    nam.assessment_name assessmentName,
    nam.start_time startTime,
    nam.end_time endTime,
    nat.target_no targetNo,  -- 指标编号
    nat.score sumScore, --  指标评分
    bas.score,  --  得分
    bas.deduction,  -- 扣分
    bas.reason_for_deduction,
    bas.evidence_material,
    bss.sum_score ss,
    COALESCE(
    (
    SELECT bal_inner.name
    FROM biz_ne_assessment_level bal_inner
    WHERE bal_inner.min_value &lt;= bss.sum_score
    AND bal_inner.max_value >= bss.sum_score
    AND bal_inner.assessment_manage_id = nam.id
    ),'无') AS name
    FROM
    biz_ne_assessment_manage nam
    LEFT  JOIN biz_ne_assessment_target nat ON nam.id = nat.assessment_manage_id
    left join biz_ne_assessment_score bas on nam.id = bas.assessment_manage_id
    LEFT  JOIN biz_ne_assessment_score_sum bss ON nam.id = bss.assessment_manage_id
        <if test="ew.sqlSegment != null and ew.sqlSegment != ''">
            where ${ew.sqlSegment}
        </if>
    </select>
</mapper>