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

    <update id="updateMajor" parameterType="long">
        update project t set t.course_object_major = null where id = #{id}
    </update>

    <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`,
        s.years,
        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_status != '填写中'
    </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_date IS NULL
            AND s.delete_date IS NULL
            AND c.delete_date 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>
            <if test="projectTrack != null and projectTrack != ''">
                and p.project_track = #{projectTrack}
            </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,
        s.years,
        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>
            <if test="projectTrack != null and projectTrack != ''">
                and p.project_track = #{projectTrack}
            </if>
            and p.delete_date is null
            and s.delete_date is null
        </where>
    </select>


    <select id="getReviewList" resultType="com.subsidy.vo.project.ReviewListVO">
        select
        t.*,
        DATE_FORMAT(t.create_date, '%Y-%m-%d') as applicationTime
        from project t
        left join teacher t2 on t.teacher_id = t2.id
        left join colleges_dict t3 on t2.college_id = t3.id
        <where>
            <if test="matchId != null and matchId != ''">
                and match_id = #{matchId}
            </if>
            <if test="projectStatus != null and projectStatus != ''">
                and project_schedule = #{projectStatus}
            </if>
            <if test="projectReview != null and projectReview != ''">
                and project_review = #{projectReview}
            </if>
            <if test="projectName != null and projectName != ''">
                and (t2.user_name like concat('%', #{projectName}, '%') or t3.name like concat('%', #{projectName}, '%'))
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                and project_group = #{projectGroup}
            </if>
            <if test="projectAssigned != null and projectAssigned != ''">
                and project_assigned = #{projectAssigned}
            </if>
            <if test="projectProgress != null and projectProgress != ''">
                and project_progress = #{projectProgress}
            </if>
            <if test="projectSchedule != null and projectSchedule  != ''">
                and project_schedule = #{projectSchedule}
            </if>
            <if test="projectTrack != null and projectTrack != ''">
                and project_track = #{projectTrack}
            </if>
            and project_schedule != '校内报名'
            and t.delete_date is null
        </where>
    </select>

    <select id="getProjectReviewList" resultType="com.subsidy.model.ProjectDO">
        select
        p.*,
        pr.project_schedule as projectSchedule,
        pr.review_status as projectReview
        from project p
        left join project_review pr on p.id = pr.project_id
        where
        p.match_id = #{matchId}
        and pr.judge_id = #{id}
        and p.delete_date is null
        and pr.delete_date is null
        <if test="projectProgress != null and projectProgress != '' ">
            and p.project_progress = #{projectProgress}
        </if>
    </select>

    <select id="getProjectReviewPage" resultType="com.subsidy.vo.project.ProjectPageVO">
        select
        p.*,
        pr.review_status as reviewStatus,
        pr.review_score as reviewScore,
        pr.score as score,
        pr.review_opinion
        from project p
        left join project_review pr on pr.project_id = p.id
        left join teacher t on p.teacher_id = t.id
        <where>
            <if test="judgeId != null and judgeId != ''">
                and pr.judge_id = #{judgeId}
            </if>
            <if test="matchId != null and matchId != ''">
                and p.match_id = #{matchId}
            </if>
            <if test="projectSchedule != null and projectSchedule != ''">
                and pr.project_schedule = #{projectSchedule}
            </if>
            <if test="projectReview != null and projectReview != ''">
                and pr.review_status = #{projectReview}
            </if>
            <if test="projectName != null and projectName != ''">
                and ( p.course_name like concat('%', #{projectName}, '%') or  t.user_name like concat('%', #{projectName}, '%') )
            </if>
            <if test="projectGroup != null and projectGroup != ''">
                and p.project_group = #{projectGroup}
            </if>
            <if test="projectProgress != null and projectProgress != ''">
                and p.project_progress = #{projectProgress}
            </if>
            and p.delete_date is null
            and pr.delete_date is null
        </where>
    </select>

    <select id="clearTimeId" parameterType="long">
        update project t set t.time_id = null where t.id = #{id}
    </select>

    <select id="projectUserName" resultType="java.lang.String">
        SELECT
            t2.user_name
        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.id = #{projectId}
    </select>
</mapper>