DrawLotsGroupJudgesMapper.xml 3.73 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.DrawLotsGroupJudgesMapper">

    <update id="clearGroup">
        update draw_lots_group_judges set group_id = null where judge_id = #{judgeId}
    </update>

    <update id="setGroup">
        update draw_lots_group_judges set group_id = #{groupId} where judge_id = #{judgeId}
    </update>

    <select id="matchJudges" resultType="com.subsidy.vo.group.MatchJudgesVO">
        SELECT
        t2.id,
        t2.username,
        t2.account_name,
        t2.`password`,
        t2.unit,
        t2.position
        FROM
        project_judge t2
        WHERE
        t2.delete_date IS NULL
        <if test="userName != null and userName != ''">
            and (t2.username like concat('%', #{userName}, '%') or t2.telephone like concat('%', #{userName}, '%') )
        </if>
    </select>

    <select id="selectJudges" resultType="com.subsidy.vo.group.SelectJudgesVO">
        SELECT
        t2.id,
        t2.username,
        t2.unit,
        t2.position,
        t2.telephone
        FROM
        project_judge t2
        WHERE
        t2.delete_date IS NULL
        <if test="userName != null and userName != ''">
            and (t2.username like concat('%', #{userName}, '%') or t2.telephone like concat('%', #{userName}, '%') )
        </if>
        and t2.id not in (
        select judge_id from
        draw_lots_group_judges t
        where t.delete_date is null
        AND t.scene_id = #{sceneId}
        )
    </select>


    <select id="judgeScoreScreen" resultType="com.subsidy.vo.group.ScoreScreenVO">
        SELECT
            t.judge_id,
            t2.score,
            t2.submit_status
        FROM
            draw_lots_group_judges t
            LEFT JOIN (
            SELECT
                t.judge_id,
                t.score,
                t.submit_status
            FROM
                draw_lots_scores t
                LEFT JOIN draw_lots_group_items t2 ON t.group_id = t2.group_id
                AND t.project_id = t2.project_id
                LEFT JOIN draw_lot_group_dict t3 ON t.group_id = t3.id
            WHERE
                t.delete_date IS NULL
                and t2.delete_date is null
                AND t.group_id = #{groupId}
                AND t2.project_id = #{groupNum}
                and t.submit_status in ('已提交','弃权')
            ORDER BY
                t2.group_num
            ) t2 ON t.judge_id = t2.judge_id
        WHERE
            t.delete_date IS NULL
            AND t.group_id = #{groupId}
    </select>

    <select id="judgeScenes" resultType="com.subsidy.model.DrawLotsScenesDO">
        SELECT
            distinct t2.*
        FROM
            draw_lots_group_judges t
            LEFT JOIN draw_lots_scenes t2 ON t.scene_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t2.id is not null
            AND t.judge_id = #{judgeId}
    </select>


    <select id="judgeGroups" resultType="com.subsidy.model.DrawLotGroupDictDO">
        SELECT
            t2.*
        FROM
            draw_lots_group_judges t
            LEFT JOIN draw_lot_group_dict t2 ON t.group_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t2.id is not null
            AND t.judge_id = #{judgeId}
            and t.scene_id = #{sceneId}
    </select>

    <select id="judgeCnt" resultType="java.lang.Integer">
        SELECT
            count(
            DISTINCT ( t.judge_id ))
        FROM
            draw_lots_group_judges t
        WHERE
            t.scene_id = #{sceneId}
            AND t.delete_date IS NULL
    </select>

</mapper>