<?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="cn.com.countrygarden.bi.main.dao.review.ReviewJudgeMapper">
	<!-- 通用查询映射结果 -->
	<resultMap id="BaseResultMap"
		type="cn.com.countrygarden.bi.main.model.review.ReviewJudge">
		<id column="id" property="id" />
		<result column="investigated_id" property="investigatedId" />
		<result column="grade_id" property="gradeId" />
		<result column="NAME" property="name" />
		<result column="tel" property="tel" />
		<result column="is_partake" property="isPartake" />
		<result column="flag" property="flag" />
		<result column="create_by" property="createBy" />
		<result column="create_time" property="createTime" />
		<result column="update_by" property="updateBy" />
		<result column="update_time" property="updateTime" />
	</resultMap>
	<select id="selectJudgeTel" parameterType="int"
		resultMap="BaseResultMap">
		select id,questionnaire_id,tel,name from review_judge where is_submission=0
		and investigated_id=#{investigatedId} and
		questionnaire_id=#{questionnaireId}
	</select>


	<select id="reviewjudgegrade" parameterType="int" resultType="cn.com.countrygarden.bi.main.dto.ReviewExcel.ReviewjudgeGradeDTO">
               select rg.id as rgid,rg.name as rgname,rj.id as rjid,rj.name as rjname,rs.create_time as createTime from review_score rs,review_judge rj,review_grade rg 
               where rs.judge_id=rj.id and rj.grade_id=rg.id and rj.investigated_id=#{investigatedid} and rj.questionnaire_id=#{questionnaireId}			   
               group by rjname,rgid,rjid,createTime
			    order by rgid

	</select>
	
</mapper>