CollegeFileMapper.xml 3.33 KB
<?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.subsidy.mapper.CollegeFileMapper">

    <select id="fileManagement" resultType="com.subsidy.vo.college.FileManagementVO">
        SELECT
        t.id,
        t.NAME,
        t2.summary_name,
        t2.summary_url,
        t2.support_file_name,
        t2.support_file_url,
        t2.word_report_name,
        t2.word_report_url,
        t2.ppt_url,
        t2.ppt_name
        FROM
        colleges_dict t
        LEFT JOIN (
        SELECT
        t2.id,
        t2.NAME,
        t.summary_name,
        t.summary_url,
        t.support_file_name,
        t.support_file_url,
        t.word_report_name,
        t.word_report_url,
        t.ppt_url,
        t.ppt_name
        FROM
        college_file t
        LEFT JOIN colleges_dict t2 ON t.college_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t.match_id = #{matchId}
        ) t2 ON t.id = t2.id
        where t.delete_date is null
            <if test="education != null and education != ''">
                AND t.education = #{education}
            </if>
            <if test="name != null and name != ''">
                AND t.`name` LIKE concat('%',#{name} ,'%')
            </if>
    </select>

    <select id="collegeInfo" resultType="com.subsidy.vo.college.CollegeInfoVO">
        SELECT
            (
            SELECT
                count( 1 )
            FROM
                project t
            WHERE
                t.delete_date IS NULL
                AND t.match_id = #{matchId}
                AND t.college_id = #{collegeId}
                AND t.project_schedule = '市级复赛'
                ) t1,(
            SELECT
                count( 1 )
            FROM
                project t
            WHERE
                t.delete_date IS NULL
                AND t.match_id = #{matchId}
                AND t.college_id = #{collegeId}
                AND t.project_schedule = '市级决赛'
                ) t2,(
            SELECT
                count( 1 )
            FROM
                project t
            WHERE
                t.delete_date IS NULL
                AND t.match_id = #{matchId}
                AND t.college_id = #{collegeId}
                AND t.project_status = '铜奖'
            ) t3,
            (
            SELECT
                count( 1 )
            FROM
                project t
            WHERE
                t.delete_date IS NULL
                AND t.match_id = #{matchId}
                AND t.college_id = #{collegeId}
                AND t.project_status = '银奖'
            ) t4,
            (
            SELECT
                count( 1 )
            FROM
                project t
            WHERE
                t.delete_date IS NULL
                AND t.match_id = #{matchId}
                AND t.college_id = #{collegeId}
                AND t.project_status = '金奖'
            ) t5
        FROM
        DUAL
    </select>

    <select id="recentFile" resultType="com.subsidy.vo.college.RecentFileVO">
        SELECT
            *
        FROM
            college_file t
        WHERE
            t.delete_date IS NULL
            AND t.college_id = #{collegeId}
            AND t.match_id = #{matchId}
    </select>

</mapper>