Blame view

ProjectReviewDAO.xml 2.43 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
<?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>