ProjectMapper.xml 5.83 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.ProjectMapper">

    <select id="getSeedTrackProjectPage" resultType="com.subsidy.vo.project.SeedTrackProjectPageVO">
        SELECT
        p.course_name,
        c.`name` AS collegeName,
        s.user_name,
        s.position,
        s.title,
        s.education,
        s.major,
        s.telephone,
        p.project_group,
        p.`status`,
        DATE_FORMAT( p.create_date, '%Y-%m-%d' ) AS applicationTime
        FROM
        project p
        LEFT JOIN teacher s ON s.id = p.teacher_id
        LEFT JOIN colleges_dict c ON s.academy_id = c.id
        WHERE
        p.delete_date IS NULL
        AND s.delete_date IS NULL
        AND c.delete_date IS NULL
        <if test="projectGroup != null and projectGroup != '' and projectGroup !='中职/高职'">
            and p.project_group = #{projectGroup}
        </if>
        <if test="courseName != null and courseName != ''">
            AND ( p.course_name like concat('%',#{courseName} ,'%') or p.college like concat('%',#{courseName} ,'%') )
        </if>
        AND p.match_id = #{matchId}
        <if test="projectSchedule != null and projectSchedule != ''">
            and p.project_schedule = #{projectSchedule}
        </if>
    </select>

    <select id="matchCollegeVods" resultType="com.subsidy.vo.college.MatchCollegeVodsVO">
        SELECT
            t.id,
            t.course_name,
            t2.user_name,
            t2.position,
            t2.title,
            t2.education,
            t2.major,
            t2.telephone,
            t.vod_url,
            t.upload_date
        FROM
            project t
            LEFT JOIN teacher t2 ON t.teacher_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.match_id = #{matchId}
            AND t.college_id = #{collegeId}
            and t.project_schedule != '校内报名'
    </select>

    <select id="getList" resultType="com.subsidy.model.MatchDictDO">
        SELECT
        p.*
        FROM project p
        LEFT JOIN student s ON s.id = p.proposer_id
        LEFT JOIN colleges_dict c ON c.`name` = s.college
        <where>
            AND p.project_status != '填写中'
            <if test="projectType != null and projectType != ''">
                AND p.project_type = #{projectType}
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                AND p.project_group = #{projectGroup}
            </if>
            AND p.delete_time IS NULL
            AND s.delete_time IS NULL
            AND c.delete_time IS NULL
        </where>
        GROUP BY
        c.id
    </select>

    <select id="getSeedTrackProjectList" resultType="com.subsidy.model.ProjectDO">
        select
        p.*
        from project p
        left join teacher s on s.id = p.teacher_id
        <where>
            <if test="matchId != null and matchId !=''">
                and p.match_id = #{matchId}
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                and p.project_group = #{projectGroup}
            </if>
            <if test="collegeId != null and collegeId != ''">
                and p.college_id = #{collegeId}
            </if>
            <if test="projectProgress!= null and projectProgress != ''">
                and p.project_progress = #{projectProgress}
            </if>
            and p.project_status != '填写中'
            and p.delete_date is null
            and s.delete_date is null
        </where>
    </select>

    <select id="recentVod" resultType="com.subsidy.vo.project.RecentVodVO">
        SELECT
            t.*
        FROM
            project t
        WHERE
            t.delete_date IS NULL
            AND t.college_id = #{collegeId}
            AND t.match_id = #{matchId}
            and t.project_schedule !='校内报名'
        ORDER BY
            t.upload_date DESC
    </select>

    <select id="getSeedTrackProjectPage1" resultType="com.subsidy.vo.project.SeedTrackProjectPageVO">
        select
        p.*,
        cd.name college,
        s.user_name,
        s.major,
        s.telephone,
        s.position,
        s.title,
        s.education,
        p.course_name,
        DATE_FORMAT(p.create_date, '%Y-%m-%d') as applicationTime
        from project p
        left join teacher s ON s.id = p.teacher_id
        left join colleges_dict cd on p.college_id = cd.id
        <where>
            and p.match_id = #{matchId}
            and p.project_status != '填写中'
            <if test="collegeId  != null and collegeId != ''">
                and cd.id = #{collegeId}
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                and p.project_group = #{projectGroup}
            </if>
            <if test="projectSchedule != null and projectSchedule != ''">
                and p.project_schedule = #{projectSchedule}
            </if>
            <if test="projectStatus != null and projectStatus != ''">
                <if test="projectStatus == '已评审'">
                    and p.project_status != '待评审'
                </if>
                <if test="projectStatus != '已评审'">
                    and p.project_status = #{projectStatus}
                </if>
            </if>
            <if test="projectProgress != null and projectProgress != ''">
                and p.project_progress = #{projectProgress}
            </if>
            <if test="name != null and name != ''">
                and (p.course_name like concat('%',#{name},'%') or s.user_name like concat('%',#{name},'%') or cd.name like concat('%',#{name},'%'))
            </if>
            and p.delete_date is null
            and s.delete_date is null
        </where>
    </select>
</mapper>