<?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="org.jeecg.modules.ai.mapper.PreReviewRecordsDetailMapper">
	<resultMap id="baseResultMap" type="org.jeecg.modules.ai.vo.PreReviewRecordsDetailVo" >
		<result column="id" property="id" jdbcType="VARCHAR"/>
		<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
		<result column="review_result" property="reviewResult" jdbcType="VARCHAR"/>
		<result column="materia_url" property="materiaUrl" jdbcType="VARCHAR"/>
		<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
	</resultMap>
	
	<sql id="prereviewrecordsdetail_column_body">
         a.id,b.material_name,a.review_result,a.materia_url,a.create_time
    </sql>
	
	<sql id="prereviewrecordsdetail_select_body">
    	<where>
    		<if test="query.reviewRecordsId != null and query.reviewRecordsId != ''"> and a.review_records_id = #{query.reviewRecordsId,jdbcType=VARCHAR} </if>
    		<if test="query.eventCode != null and query.eventCode != ''"> and a.event_code = #{query.eventCode,jdbcType=VARCHAR} </if>
    		<if test="query.userId != null and query.userId != ''"> and c.user_id = #{query.userId,jdbcType=VARCHAR} </if>
    		<if test="query.reviewResult != null and query.reviewResult != ''"> and a.review_result = #{query.reviewResult,jdbcType=VARCHAR} </if>
    	</where>
    </sql>

	<select id="getPreReviewRecordsDetailList" resultMap="baseResultMap" >
		select <include refid="prereviewrecordsdetail_column_body" />
		from pre_review_records_detail a 
		left join ys_directory_material b on a.material_code = b.material_code
		left join pre_review_records c on a.review_records_id = c.id
		<include refid="prereviewrecordsdetail_select_body" /> 
	</select>
</mapper>