ProjectReviewDAO.xml 2.43 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.ProjectReviewDAO">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zhongzhi.model.ProjectReviewDO">
        <id column="id" property="id"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="delete_time" property="deleteTime"/>
        <result column="project_id" property="projectId"/>
        <result column="judge_id" property="judgeId"/>
        <result column="review_score" property="reviewScore"/>
        <result column="score" property="score"/>
        <result column="review_opinion" property="reviewOpinion"/>
        <result column="project_schedule" property="projectSchedule"/>
        <result column="review_time" property="reviewTime"/>
        <result column="review_status" property="reviewStatus"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_time,
        update_time,
        delete_time,
        id, project_id, judge_id, review_score, score, review_opinion, project_schedule, review_time, review_status
    </sql>

    <select id="getList" resultType="com.zhongzhi.vo.judge.ProjectReviewVO">
        select
        pj.username as judgesName,
        pr.score as score
        from project_review pr
        left join project_judge pj on pj.id = pr.judge_id
        where pr.project_id = #{projectId}
        and pr.project_schedule = #{projectSchedule}
        and pr.delete_time is null
        and pj.delete_time is null
    </select>

    <select id="selectCountByMatchId" resultType="java.lang.Integer">
        select
        count(*)
        from project_review pr
        left join project p on pr.project_id = p.id
        where p.match_id = #{matchId}
        and pr.judge_id = #{judgeId}
        and pr.delete_time is null
        and p.delete_time is null
    </select>

    <select id="selectNotReviewCount" resultType="java.lang.Integer">
        select
            count(*)
        from project_review pr
        left join project p on pr.project_id = p.id
        where p.match_id = #{matchId}
          and pr.judge_id = #{judgeId}
          and pr.review_status = '已分配'
          and pr.delete_time is null
          and p.delete_time is null
    </select>

</mapper>