<?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.PreExaminationMattersMapper">


	<resultMap id="baseResultMap" type="org.jeecg.modules.ai.vo.PreExaminationMattersVo" >
		<result column="id" property="id" jdbcType="VARCHAR"/>
		<result column="display_name" property="displayName" jdbcType="VARCHAR"/>
		<result column="event_code" property="eventCode" jdbcType="VARCHAR"/>
		<result column="depart_name" property="departName" jdbcType="VARCHAR"/>
		<result column="valid_status" property="validStatus" jdbcType="VARCHAR"/>
		<result column="report_template_url" property="reportTemplateUrl" jdbcType="VARCHAR"/>
		<result column="print_template_url" property="printTemplateUrl" jdbcType="VARCHAR"/>
		<result column="author_status" property="authorStatus" jdbcType="INTEGER"/>
		<result column="del_flag" property="delFlag" jdbcType="INTEGER"/>
		<result column="processing_type" property="processingType" jdbcType="INTEGER"/>
	</resultMap>
	
	<sql id="preexaminationmatters_column_body">
         a.id,a.display_name,a.event_code,b.del_flag,a.author_status,c.depart_name,a.processing_type,
         b.valid_status,a.report_template_url,a.print_template_url
    </sql>
	
	<sql id="preexaminationmatters_select_body">
    	<where>
    		<if test="query.displayName != null and query.displayName != ''"> and a.display_name like CONCAT('%', #{query.displayName}, '%') </if>
    		<if test="query.departName != null and query.departName != ''"> and c.depart_name like CONCAT('%', #{query.departName}, '%') </if>
    		<if test="query.orgCode != null and query.orgCode != ''"> and a.sys_org_code = #{query.orgCode,jdbcType=VARCHAR} </if>
    		<if test="query.eventCode != null and query.eventCode != ''"> and a.event_code = #{query.eventCode,jdbcType=VARCHAR} </if>
    		<if test="query.processingType != null"> and a.processing_type = #{query.processingType,jdbcType=INTEGER} </if>
    		<if test="query.eventType != null"> and b.event_type = #{query.eventType,jdbcType=INTEGER} </if>
    		<if test="query.delFlag != null"> and a.del_flag = #{query.delFlag,jdbcType=INTEGER} </if>
    		<if test="query.authorStatus != null"> and a.author_status = #{query.authorStatus,jdbcType=INTEGER} </if>
    	</where>
    </sql>

	<select id="getPreExaminationMattersList" resultMap="baseResultMap" >
		select <include refid="preexaminationmatters_column_body" />
		from pre_examination_matters a 
		left join ys_directory b on a.event_code = b.event_code
		left join sys_depart c on b.sys_org_code = c.depart_code
		<include refid="preexaminationmatters_select_body" /> 
	</select>

</mapper>