ProjectJudgeDAO.xml 2.42 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.zhongzhi.dao.ProjectJudgeDAO">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zhongzhi.model.ProjectJudgeDO">
        <id column="id" property="id"/>
        <result column="username" property="username"/>
        <result column="telephone" property="telephone"/>
        <result column="position" property="position"/>
        <result column="unit" property="unit"/>
        <result column="id_card" property="idCard"/>
        <result column="bank_name" property="bankName"/>
        <result column="bank_card" property="bankCard"/>
        <result column="status" property="status"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="delete_time" property="deleteTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, username, telephone, position, unit, status, create_time, update_time, delete_time
    </sql>

    <select id="getProjectJudgePage" resultType="com.zhongzhi.vo.judge.ProjectJudgePageVO">
        select
        *
        from project_judge
        <where>
            <if test="username != null and username != ''">
                and username like concat('%', #{username}, '%')
            </if>
            <if test="status != null and status != ''">
                and status = #{status}
            </if>
            and delete_time is null
        </where>
    </select>

    <select id="projectJudgesAssigned" resultType="com.zhongzhi.vo.judge.ProjectJudgePageVO">
        select
        pj.*
        from project_judge pj
        left join project_review pr on pr.judge_id = pj.id
        left join project p on p.id = pr.project_id
        <where>
            <if test="projectGroup != null and projectGroup != ''">
                and p.project_group = #{projectGroup}
            </if>
            <if test="projectSchedule != null and projectSchedule != ''">
                and p.project_schedule = #{projectSchedule}
            </if>
            and p.match_id = #{matchId}
            and pj.status = 1
            and p.delete_time is null
            and pj.delete_time is null
            and pr.delete_time is null
        </where>
        group by pj.id
    </select>

</mapper>