<?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="Report">
	
	<resultMap id="reportMap" type="reportVO">
		<id property="inSeq" column="in_seq" />
		<result property="docNo" column="doc_no" />
		<result property="inAgencyCode" column="in_agency_code" />
		<result property="inPlaceCode" column="in_place_code" />
		<result property="inPlace" column="in_place" />
		<result property="inPlaceName" column="in_place_name" />
		<result property="inPlaceNum" column="in_place_num" />
		<result property="inDocPlace" column="in_doc_place" />
		<result property="inTypeCode" column="in_type_code" />
		<result property="inType" column="in_type" />
		<result property="inCategory1" column="in_category1" />
		<result property="inCategory2" column="in_category2" />
		<result property="inSubject" column="in_subject" />
		<result property="inMemo" column="in_memo" />
		<result property="inPlace1" column="in_place1" />
		<result property="inPlace2" column="in_place2" />
		<result property="inDuty" column="in_duty" />
		<result property="inName" column="in_name" />
		<result property="inUserid" column="in_userid" />
		<result property="inIp" column="in_ip" />
		<result property="inContent" column="in_content" />
		<result property="inFile1" column="in_file1" />
		<result property="inFile2" column="in_file2" />
		<result property="inFile3" column="in_file3" />
		<result property="inFileName1" column="in_file_name1" />
		<result property="inFileName2" column="in_file_name2" />
		<result property="inFileName3" column="in_file_name3" />
		<result property="inFsseq" column="in_fsseq" />
		<result property="inInfodate" column="in_infodate" />
		<result property="inInfoYear" column="in_info_year" />
		<result property="inInfoMonth" column="in_info_month" />
		<result property="inInfoDay" column="in_info_day" />
		<result property="inRegdate" column="in_regdate" />
		<result property="inRegdateStr" column="in_regdate_str" />
		<result property="inJudge" column="in_judge" />
		<result property="inJuseqSection" column="in_juseq_section" />
		<result property="inJuseqHead" column="in_juseq_head" />
		<result property="inOfflineType" column="in_offline_type" />
		<result property="inOfflineUserid" column="in_offline_userid" />
		<result property="inComplete" column="in_complete" />
		<result property="inOld" column="in_old" />
		<result property="inDelete" column="in_delete" />
		<result property="inStateCode" column="in_state_code" />
		<result property="inCategory1Str" column="in_category1_str" />
		<result property="inCategory2Str" column="in_category2_str" />
		<result property="judgeStr" column="judgeStr" />
	</resultMap>
		
	<select id="Report.selectPlaceNum" parameterType="reportVO" resultType="int">
		<![CDATA[
			SELECT 
			  IFNULL(MAX(in_place_num), 0) + 1 AS inPlaceNum
			FROM 
			  H2_REPORT_INFO 
			WHERE 
			  IN_PLACE_CODE = 'PS00'
		]]>
	</select>
	
	<select id="Report.select" parameterType="reportVO" resultMap="reportMap">
		<![CDATA[
			SELECT
				T.*
			FROM
				H2_REPORT_INFO T
			WHERE
				in_seq = #{inSeq}
		]]>
	</select>
	
	<select id="Report.selectSaveList" parameterType="reportSearchVO" resultMap="reportMap">
		 /* Report.selectWaitList */
         SELECT
			  T1.IN_SEQ
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE = '99'
		AND IN_USERID = #{userid}
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>

	<select id="Report.selectSaveListCnt" parameterType="reportSearchVO" resultType="int">
	<![CDATA[	
		SELECT
			COUNT(*)
		FROM 
			H2_REPORT_INFO
		WHERE
			IN_STATE_CODE = '99' AND
       		IN_TYPE = #{type} AND
	]]>
	<choose>
		<when test="type != null and type.equals(1)"><![CDATA[ 
			IN_USERID = #{userid}
		]]></when>
		<when test="type == null or type != 1"><![CDATA[
			IN_USERID IN (#{userid}, CONCAT('''' ,  #{usegrade} ,  ''''))
		]]></when>
	</choose>
	</select>

	<insert id="Report.insert" parameterType="reportVO" useGeneratedKeys="true" keyProperty="inSeq" keyColumn="in_seq"> 
			INSERT INTO H2_REPORT_INFO(
				  in_agency_code, in_place
				, in_place_code, in_place_name, in_place_num
				, in_doc_place, in_type_code, in_type
				, in_category1, in_category2, in_category3
				, in_category4, in_subject, in_memo
				, in_place1, in_place2, in_duty
				, in_name, in_userid, in_ip
				, in_content, in_infodate
				, in_info_year, in_info_month, in_info_day
				, in_regdate, in_chkdate
				, in_offline_userid, in_complete
				, in_old, in_delete, in_state_code
				, in_fsseq
			)VALUES(
				 #{inAgencyCode}, #{inPlace}
				, #{inPlaceCode}, #{inPlaceName}, #{inPlaceNum}
				, #{inDocPlace}, #{inTypeCode}, ''
				, #{inCategory1}, #{inCategory2}, ''
				, '', #{inSubject}, #{inMemo}
				, #{inPlace1}, #{inPlace2}, #{inDuty}
				, #{inName}, #{inUserid}, #{inIp}
				, #{inContent}, #{strInfodate}
				, #{inInfoYear}, #{inInfoMonth}, #{inInfoDay}
				, NOW()	, #{inChkdate}
				, #{inOfflineUserid}, #{inComplete}
				, #{inOld}, #{inDelete}, #{inStateCode}
				, #{inFsseq}
			)
	</insert>

	<update id="Report.update" parameterType="reportVO">
		UPDATE 
			H2_REPORT_INFO
		SET 
			in_agency_code = #{inAgencyCode},
			in_place_code = #{inPlaceCode},
			in_place_name = #{inPlaceName},
			in_place_num = #{inPlaceNum},
			in_category1 = #{inCategory1},
			in_category2 = #{inCategory2},
			in_memo = #{inMemo},
			in_subject = #{inSubject},
			in_place1 = #{inPlace1},
			in_place2 = #{inPlace2},
			in_duty = #{inDuty},
			in_name = #{inName},
			in_userid = #{inUserid},
			in_ip = #{inIp},
			in_fsseq = #{inFsseq},
			<!-- 20180515 보고일 관련 있을때랑 없을때랑 해서 쿼리 수정 -->
			<if test=' strInfodate != null and !"".equals(strInfodate)'>
				<![CDATA[ 
					in_infodate = #{strInfodate}, 
				]]>
			</if>
			in_info_year = #{inInfoYear},
			in_info_month = #{inInfoMonth},
			in_info_day = #{inInfoDay},
			in_state_code = #{inStateCode},
			in_content = #{inContent},
			in_complete = #{inComplete},
			in_judge = #{inJudge}, 
			in_juseq_section = #{inJuseqSection},
			in_juseq_head = #{inJuseqHead}
		WHERE 
			in_seq = #{inSeq}
	</update>

	<delete id="Report.delete" parameterType="reportVO">
	<![CDATA[
		DELETE 
		FROM
			H2_REPORT_INFO
		WHERE 
			in_seq = #{inSeq}
	]]>
	</delete>
	
	<!-- 검색 -->
	<select id="Report.selectListAll" parameterType="reportSearchVO" resultMap="reportMap">
		<![CDATA[	
		SELECT
			ALL_LIST.*, 
			(SELECT NAME FROM Rpt_Category WHERE TYPE = 1 AND CODE = ALL_LIST.IN_CATEGORY1) AS inCategory1Str,
	        (SELECT NAME FROM Rpt_Category WHERE TYPE = 2 AND CODE = ALL_LIST.IN_CATEGORY2) AS inCategory2Str,
	        (SELECT NAME FROM Rpt_Category WHERE TYPE = 3 AND CODE = ALL_LIST.IN_CATEGORY3) AS inCategory3Str,
	        (SELECT NAME FROM Rpt_Category WHERE TYPE = 4 AND CODE = ALL_LIST.IN_CATEGORY4) AS inCategory4Str,
	        ('국제정보분석-' || ALL_LIST.IN_PLACE_NUM) AS docNo,
	        (CASE WHEN IN_REPORT = 0 AND IN_REPORT1 = 0 AND IN_REPORT2 = 0 THEN '-'
	        	  WHEN IN_REPORT2 > 0 THEN '상보(' || (SELECT CODENM FROM TCODE WHERE CODE1 = 'DC05' AND CODE2 = IN_JUDGE3) || ')'
	        	  ELSE '상보' END) AS fullReportStr, 
	    	(CASE 
	    		WHEN judge = 1 THEN '특보' WHEN judge = 2 THEN '판단' WHEN judge = 3 THEN '중보' WHEN judge = 4 THEN '통보'
	    		WHEN judge = 5 THEN '기록' WHEN judge = 6 THEN '조사' WHEN judge = 7 THEN '참고' WHEN judge = 8 THEN '무가치'
	    	END) AS judgeStr
       	FROM
       		(
				SELECT
					RPT.*,
			]]>
		    <choose> 
				<when test="myGroupCode.equals(3)"><![CDATA[ 
					(CASE 
						WHEN IN_JUDGE3 > 0 THEN IN_JUDGE3
						WHEN IN_JUDGE2 > 0 THEN IN_JUDGE2
						WHEN IN_JUDGE1 > 0 THEN IN_JUDGE1
						ELSE NULL
					END)
				]]></when>
				<when test="myGroupCode.equals(2)"><![CDATA[
					(CASE 
						WHEN IN_JUDGE2 > 0 THEN IN_JUDGE2
						WHEN IN_JUDGE1 > 0 THEN IN_JUDGE1
						ELSE NULL
					END) 
				]]></when>
				<when test="myGroupCode.equals(1)"><![CDATA[
					(CASE 
						WHEN IN_JUDGE1 > 0 THEN IN_JUDGE1
						ELSE NULL
					END) 
				]]></when>
				<otherwise><![CDATA[
					NULL
				]]></otherwise>
			</choose>
		    <![CDATA[
		    		AS judge
				FROM 
					RPT_INFO RPT
				WHERE
					IN_COMPLETE = '1' AND
		       		IN_STATE_CODE <> '99'
       		
		]]>
			<choose>
				<when test="myGroupCode.equals(3)"></when>
				
				<when test="myGroupCode.equals(2)"><![CDATA[ 
					AND IN_AGENCY_CODE = #{userPlace}
				]]></when>
				
				<when test="myGroupCode.equals(1)"><![CDATA[ 
					AND IN_PLACE_CODE = #{userPlace}
				]]></when>
				
				<otherwise></otherwise>
			</choose>
				
				<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
				]]></if>
				<if test="dateEnd != null and dateEnd != ''"><![CDATA[
					AND IN_INFODATE <= #{dateEnd}
				]]></if>
				<if test="writeName != null and writeName != ''"><![CDATA[
					AND IN_NAME = #{writeName}
				]]></if>
				<if test="writeId != null and writeId != ''"><![CDATA[
					AND IN_USERID = #{writeId}
				]]></if>
				<if test="subject != null and subject != ''"><![CDATA[
					AND IN_SUBJECT LIKE '%'||#{subject}||'%'
				]]></if>
				<if test="filename != null and filename != ''"><![CDATA[
					AND (IN_FILE1 LIKE '%'||#{filename}||'%' OR IN_FILE3 LIKE '%'||#{filename}||'%' OR IN_FILE3 LIKE '%'||#{filename}||'%'
							 OR IN_FILE4 LIKE '%'||#{filename}||'%' OR IN_FILE5 LIKE '%'||#{filename}||'%')
				]]></if>
				
				<if test="policeType != null and policeType.length > 0">
					AND IN_TYPE IN
					<foreach collection="policeType" item="type" open="(" close=")" separator=",">
						#{type}
					</foreach>
				</if>
				<if test="places != null and places.length > 0">
					AND IN_PLACE_CODE IN
					<foreach collection="places" item="place" open="(" close=")" separator=",">
						#{place}
					</foreach>
				</if>
				<if test="judges != null and judges.length > 0">
					AND IN_JUDGE IN
					<foreach collection="judges" item="judge" open="(" close=")" separator=",">
						#{judge}
					</foreach>
				</if>
				<if test="fullReport != null and fullReport.length > 0">
					AND 
					<foreach collection="fullReport" item="report" open="(" close=")" separator=" OR ">
						IN_REPORT${report} = 1
					</foreach>
				</if>
				<if test="category1 != null and category1.length > 0">
					AND IN_CATEGORY1 IN
					<foreach collection="category1" item="category" open="(" close=")" separator=",">
						#{category}
					</foreach>
				</if>
				<if test="category2 != null and category2.length > 0">
					AND IN_CATEGORY2 IN
					<foreach collection="category2" item="category" open="(" close=")" separator=",">
						#{category}
					</foreach>
				</if>
				<if test="category3 != null and category3.length > 0">
					AND IN_CATEGORY3 IN
					<foreach collection="category3" item="category" open="(" close=")" separator=",">
						#{category}
					</foreach>
				</if>
				<if test="category4 != null and category4.length > 0">
					AND IN_CATEGORY4 IN
					<foreach collection="category4" item="category" open="(" close=")" separator=",">
						#{category}
					</foreach>
				</if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[
				ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		<![CDATA[
			) ALL_LIST
		]]>
		
	</select>
	
	<select id="Report.selectTotalCnt" parameterType="reportSearchVO" resultType="int">
	<![CDATA[	
		SELECT
			COUNT(*)
		FROM 
			H2_REPORT_INFO
		WHERE
			IN_COMPLETE = '1' AND
       		IN_STATE_CODE <> '99'
	]]>
	<choose>
		<when test="myGroupCode.equals(3)"></when>
		
		<when test="myGroupCode.equals(2)"><![CDATA[ 
			AND IN_AGENCY_CODE = #{userPlace}
		]]></when>
		
		<when test="myGroupCode.equals(1)"><![CDATA[ 
			AND IN_PLACE_CODE = #{userPlace}
		]]></when>
		
		<otherwise></otherwise>
	</choose>
	</select>
	
	<select id="Report.selectList" parameterType="reportSearchVO" resultMap="reportMap">
		<![CDATA[
     		 SELECT
			  T1.IN_SEQ
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
			, CASE 
	    		WHEN in_judge = 1 THEN '특보' WHEN in_judge = 2 THEN '판단' WHEN in_judge = 3 THEN '중보' WHEN in_judge = 4 THEN '통보'
	    		WHEN in_judge = 5 THEN '기록' WHEN in_judge = 6 THEN '조사' WHEN in_judge = 7 THEN '참고' WHEN in_judge = 8 THEN '무가치'
	    	END AS judgeStr
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_COMPLETE = '1' AND
       		IN_STATE_CODE <> '99'
		]]>
				<choose>
					<when test="myGroupCode.equals(2)"><![CDATA[ 
						AND IN_AGENCY_CODE = #{userPlace}
					]]></when>
					<when test="myGroupCode.equals(1)"><![CDATA[ 
						AND IN_PLACE_CODE = #{userPlace}
					]]></when>
					<otherwise></otherwise>
				</choose>
					
					<if test="dateStart != null and dateStart != ''"><![CDATA[
						AND IN_INFODATE >= #{dateStart}
					]]></if>
					<if test="dateEnd != null and dateEnd != ''"><![CDATA[
						AND IN_INFODATE <= #{dateEnd}
					]]></if>
					<if test="writeName != null and writeName != ''"><![CDATA[
						AND IN_NAME = #{writeName}
					]]></if>
					<if test="writeId != null and writeId != ''"><![CDATA[
						AND IN_USERID = #{writeId}
					]]></if>
					<if test="subject != null and subject != ''"><![CDATA[
						AND IN_SUBJECT LIKE CONCAT('%',#{subject},'%')
					]]></if>
					<if test="places != null and places.length > 0">
						AND IN_PLACE_CODE IN
						<foreach collection="places" item="place" open="(" close=")" separator=",">
							#{place}
						</foreach>
					</if>
					<if test="judges != null and judges.length > 0">
						AND IN_JUDGE IN
						<foreach collection="judges" item="judge" open="(" close=")" separator=",">
							#{judge}
						</foreach>
					</if>
					<if test="category1 != null and category1.length > 0">
						AND IN_CATEGORY1 IN
						<foreach collection="category1" item="category" open="(" close=")" separator=",">
							#{category}
						</foreach>
					</if>
					<if test="category2 != null and category2.length > 0">
						AND IN_CATEGORY2 IN
						<foreach collection="category2" item="category" open="(" close=")" separator=",">
							#{category}
						</foreach>
					</if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
					ORDER BY ${orderCol} ${orderAsc}
		]]></if>
			LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>
	
	<select id="Report.selectListCnt" parameterType="reportSearchVO" resultType="int">
	<![CDATA[ 
			SELECT
					COUNT(1)
				FROM 
					H2_REPORT_INFO 
					WHERE
						IN_COMPLETE = '1' AND
			       		IN_STATE_CODE <> '99'
		]]>
				<choose>
					<when test="myGroupCode.equals(2)"><![CDATA[ 
						AND IN_AGENCY_CODE = #{userPlace}
					]]></when>
					<when test="myGroupCode.equals(1)"><![CDATA[ 
						AND IN_PLACE_CODE = #{userPlace}
					]]></when>
					<otherwise></otherwise>
				</choose>
					
					<if test="dateStart != null and dateStart != ''"><![CDATA[
						AND IN_INFODATE >= #{dateStart}
					]]></if>
					<if test="dateEnd != null and dateEnd != ''"><![CDATA[
						AND IN_INFODATE <= #{dateEnd}
					]]></if>
					<if test="writeName != null and writeName != ''"><![CDATA[
						AND IN_NAME = #{writeName}
					]]></if>
					<if test="writeId != null and writeId != ''"><![CDATA[
						AND IN_USERID = #{writeId}
					]]></if>
					<if test="subject != null and subject != ''"><![CDATA[
						AND IN_SUBJECT LIKE CONCAT('%',#{subject},'%')
					]]></if>
					<if test="places != null and places.length > 0">
						AND IN_PLACE_CODE IN
						<foreach collection="places" item="place" open="(" close=")" separator=",">
							#{place}
						</foreach>
					</if>
					<if test="judges != null and judges.length > 0">
						AND IN_JUDGE IN
						<foreach collection="judges" item="judge" open="(" close=")" separator=",">
							#{judge}
						</foreach>
					</if>
					<if test="category1 != null and category1.length > 0">
						AND IN_CATEGORY1 IN
						<foreach collection="category1" item="category" open="(" close=")" separator=",">
							#{category}
						</foreach>
					</if>
					<if test="category2 != null and category2.length > 0">
						AND IN_CATEGORY2 IN
						<foreach collection="category2" item="category" open="(" close=")" separator=",">
							#{category}
						</foreach>
					</if>
	</select>
	
	<!-- 결재 대기 목록 -->
	<select id="Report.selectWaitList" parameterType="reportSearchVO"  resultMap="reportMap">
		 /* Report.selectWaitList */
         SELECT
			  T1.IN_SEQ
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		<choose>
			<when test="dutiesForApprove == 2">
			    AND IN_STATE_CODE LIKE '%1'
			</when>
			<when test="dutiesForApprove == 3">
			    AND IN_STATE_CODE LIKE '%2'
			</when>
			<otherwise>
			    AND (IN_STATE_CODE LIKE '%1' OR IN_STATE_CODE LIKE '%2' OR IN_STATE_CODE LIKE '%3')
			</otherwise>
		</choose>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>
	
	<select id="Report.selectWaitListAll" parameterType="reportSearchVO"  resultMap="reportMap">
		/* Report.selectWaitList */
         SELECT
			  T1.IN_SEQ
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		<choose>
			<when test="dutiesForApprove == 2">
			    AND IN_STATE_CODE LIKE '%1'
			</when>
			<when test="dutiesForApprove == 3">
			    AND IN_STATE_CODE LIKE '%2'
			</when>
			<otherwise>
			    AND (IN_STATE_CODE LIKE '%1' OR IN_STATE_CODE LIKE '%2' OR IN_STATE_CODE LIKE '%3')
			</otherwise>
		</choose>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
	</select>
	<select id="Report.selectWaitListCnt" parameterType="reportSearchVO"  resultType="int">
		 /* Report.selectMyList */
        SELECT
        	COUNT(1) AS CNT 
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		<choose>
			<when test="dutiesForApprove == 2">
			    AND IN_STATE_CODE LIKE '%1'
			</when>
			<when test="dutiesForApprove == 3">
			    AND IN_STATE_CODE LIKE '%2'
			</when>
			<otherwise>
			    AND (IN_STATE_CODE LIKE '%1' OR IN_STATE_CODE LIKE '%2' OR IN_STATE_CODE LIKE '%3')
			</otherwise>
		</choose>
	</select>
	
	
	<!-- 견문 결재 처리 목록 -->
	<select id="Report.selectAprList" parameterType="reportSearchVO" resultMap="reportMap">
	 /* Report.selectWaitList */
         SELECT
			  T1.IN_SEQ
			, CONCAT('국제정보분석-' , IN_PLACE_NUM) AS docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
			JOIN H2_REPORT_JUDGE_HISTORY T4 ON T1.IN_SEQ =  T4.JU_INSEQ
		WHERE
			IN_STATE_CODE != '99'
		AND T4.JU_USERID = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
				AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>
	
	<select id="Report.selectAprListCnt" parameterType="reportSearchVO" resultType="int">
        SELECT 
			COUNT(*)
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
			JOIN H2_REPORT_JUDGE_HISTORY T4 ON T1.IN_SEQ =  T4.JU_INSEQ
		WHERE
			IN_STATE_CODE != '99'
		AND T4.JU_USERID = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
				AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
	</select>
	<select id="Report.selectAprListAll" parameterType="reportSearchVO" resultMap="reportMap">
		 /* Report.selectAprListAll */
         SELECT
			  T1.IN_SEQ
			, CONCAT('국제정보분석-' , IN_PLACE_NUM) AS docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_REGDATE AS IN_REGDATE_STR
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
			JOIN H2_REPORT_JUDGE_HISTORY T4 ON T1.IN_SEQ =  T4.JU_INSEQ
		WHERE
			IN_STATE_CODE != '99'
		AND T4.JU_USERID = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
				AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
	</select>
	
	
	<!-- 내 실적 목록 -->
	<select id="Report.selectMyList" parameterType="reportSearchVO" resultMap="reportMap">
        /* Report.selectMyList */
         SELECT
			  T1.IN_SEQ
			, CONCAT('국제정보분석-', IN_PLACE_NUM) DOC_NO
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		AND in_userid = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>
	<select id="Report.selectMyListCnt" parameterType="reportSearchVO" resultType="int">
		/* Report.selectMyListCnt */
		SELECT
			COUNT(*)
		FROM 
			H2_REPORT_INFO
		WHERE
			IN_STATE_CODE != '99'
		AND in_userid = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
	</select>
	
	<select id="Report.selectMyListAll" parameterType="reportSearchVO" resultMap="reportMap">
	/* Report.selectMyListAll */
         SELECT
			  T1.IN_SEQ
			 , CONCAT(T1.IN_PLACE_NAME, ' 국제정보분석 - ', IN_PLACE_NUM) DOC_NO
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		 AND in_userid = #{userid}
		<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
				AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
				AND IN_SUBJECT LIKE '%'||#{subject}||'%'
		]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
	</select>
	
	<!-- 견문 제출 현황 -->
	<select id="Report.selectPresentList" parameterType="reportSearchVO" resultMap="reportMap">
		<![CDATA[
        SELECT
			  T1.IN_SEQ
			 , CONCAT('국제정보분석-', IN_SEQ) docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		]]>
			<choose>
				<when test="myGroupCode.equals(3)"></when>
				<when test="myGroupCode.equals(2)"><![CDATA[ 
					AND IN_AGENCY_CODE = #{userPlace}
				]]></when>
				<when test="myGroupCode.equals(1)"><![CDATA[ 
					AND IN_PLACE_CODE = #{userPlace}
				]]></when>
				<otherwise></otherwise>
			</choose>
			
			<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
			]]></if>
			<if test="dateEnd != null and dateEnd != ''"><![CDATA[
					AND IN_INFODATE <= #{dateEnd}
			]]></if>
			<if test="subject != null and subject != ''"><![CDATA[
					AND IN_SUBJECT LIKE CONCAT('%', #{subject}, '%')
			]]></if>
			<if test="writeName != null and writeName != ''"><![CDATA[
				AND IN_NAME LIKE CONCAT('%',#{writeName},'%')
			]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	</select>
	<select id="Report.selectPresentListCnt" parameterType="reportSearchVO" resultType="int">
		<![CDATA[
		SELECT
			COUNT(*)
		FROM 
			H2_REPORT_INFO I
		WHERE 
			IN_STATE_CODE != '99'
		]]>
		<choose>
			<when test="myGroupCode.equals(3)"></when>
			<when test="myGroupCode.equals(2)"><![CDATA[ 
				AND IN_AGENCY_CODE = #{userPlace}
			]]></when>
			<when test="myGroupCode.equals(1)"><![CDATA[ 
				AND IN_PLACE_CODE = #{userPlace}
			]]></when>
			<otherwise></otherwise>
		</choose>
		
		<if test="dateStart != null and dateStart != ''"><![CDATA[
			AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
			AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="subject != null and subject != ''"><![CDATA[
					AND IN_SUBJECT LIKE CONCAT('%', #{subject}, '%')
			]]></if>
			<if test="writeName != null and writeName != ''"><![CDATA[
				AND IN_NAME LIKE CONCAT('%',#{writeName},'%')
			]]></if>
	</select>
	<select id="Report.selectPresentListAll" parameterType="reportSearchVO" resultMap="reportMap">
    	<![CDATA[
        SELECT
			  T1.IN_SEQ
			, CONCAT('국제정보분석-', IN_SEQ) docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
		]]>
			<choose>
				<when test="myGroupCode.equals(3)"></when>
				<when test="myGroupCode.equals(2)"><![CDATA[ 
					AND IN_AGENCY_CODE = #{userPlace}
				]]></when>
				<when test="myGroupCode.equals(1)"><![CDATA[ 
					AND IN_PLACE_CODE = #{userPlace}
				]]></when>
				<otherwise></otherwise>
			</choose>
			
			<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
			]]></if>
			<if test="dateEnd != null and dateEnd != ''"><![CDATA[
					AND IN_INFODATE <= #{dateEnd}
			]]></if>
			<if test="subject != null and subject != ''"><![CDATA[
					AND IN_SUBJECT LIKE CONCAT('%', #{subject}, '%')
			]]></if>
			<if test="writeName != null and writeName != ''"><![CDATA[
				AND IN_NAME LIKE CONCAT('%',#{writeName},'%')
			]]></if>
		<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
			ORDER BY ${orderCol} ${orderAsc}
		]]></if>
	</select>
	
	
	<!-- 평가기록부 -->
	<select id="Report.selectRecordList" parameterType="reportSearchVO" resultMap="reportMap">
		<![CDATA[
        SELECT
			  T1.IN_SEQ
			 , CONCAT('국제정보분석-', IN_SEQ) docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
			AND IN_COMPLETE = 1
			AND IN_PLACE_CODE LIKE '%'
		]]>
			<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
			]]></if>
			<if test="dateEnd != null and dateEnd != ''"><![CDATA[
					AND IN_INFODATE <= #{dateEnd}
			]]></if>
			<if test="placeGroup != null and placeGroup != ''"><![CDATA[
					AND IN_PLACE_CODE = #{placeGroup}
			]]></if>
					
			<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
				ORDER BY ${orderCol} ${orderAsc}
			]]></if>
		<![CDATA[
		LIMIT  #{firstIndex} , #{recordCountPerPage}
	  	]]>
	</select>
	<select id="Report.selectRecordListCnt" parameterType="reportSearchVO" resultType="int">
		<![CDATA[
       SELECT
			COUNT(*)
		FROM 
			H2_REPORT_INFO
		WHERE 
			IN_STATE_CODE != '99' 
			AND IN_COMPLETE = 1
		]]>
		<if test="dateStart != null and dateStart != ''"><![CDATA[
			AND IN_INFODATE >= #{dateStart}
		]]></if>
		<if test="dateEnd != null and dateEnd != ''"><![CDATA[
			AND IN_INFODATE <= #{dateEnd}
		]]></if>
		<if test="placeGroup != null and placeGroup != ''"><![CDATA[
			AND IN_PLACE_CODE = #{placeGroup}
		]]></if>
		<if test="placeGroup == null or placeGroup == ''"><![CDATA[
			AND IN_PLACE_CODE = #{userPlace}
		]]></if>
	</select>
	<select id="Report.selectRecordListAll" parameterType="reportSearchVO" resultMap="reportMap">
		<![CDATA[
        SELECT
			  T1.IN_SEQ
			 , CONCAT('국제정보분석-', IN_SEQ) docNo
			, T1.IN_AGENCY_CODE
			, T1.IN_PLACE
			, T1.IN_PLACE_CODE
			, T1.IN_PLACE_NAME
			, T1.IN_PLACE_NUM
			, T1.IN_DOC_PLACE
			, T1.IN_TYPE_CODE
			, T1.IN_TYPE
			, T1.IN_CATEGORY1
			, T1.IN_CATEGORY2
			, T2.CC_CODE_NAME AS IN_CATEGORY1_STR
			, T3.CC_CODE_NAME AS IN_CATEGORY2_STR
			, T1.IN_CATEGORY3
			, T1.IN_CATEGORY4
			, T1.IN_SUBJECT
			, T1.IN_MEMO
			, T1.IN_PLACE1
			, T1.IN_PLACE2
			, T1.IN_DUTY
			, T1.IN_NAME
			, T1.IN_USERID
			, T1.IN_CONTENT
			, T1.IN_FILE1
			, T1.IN_FILE2
			, T1.IN_FILE3
			, T1.IN_FS_SEQ
			, T1.IN_INFODATE
			, T1.IN_INFO_YEAR
			, T1.IN_INFO_MONTH
			, T1.IN_INFO_DAY
			, T1.IN_REGDATE
			, T1.IN_CHKDATE
			, T1.IN_JUDGE
			, T1.IN_JUSEQ_SECTION
			, T1.IN_JUSEQ_HEAD
			, T1.IN_OFFLINE_USERID
			, T1.IN_COMPLETE
			, T1.IN_OLD
			, T1.IN_DELETE
			, T1.IN_STATE_CODE
			, T1.IN_IP
			, T1.IN_FSSEQ
			, T1.IN_FILE_NAME1
			, T1.IN_FILE_NAME2
			, T1.IN_FILE_NAME3
		FROM H2_REPORT_INFO T1 
	    	LEFT JOIN  H2_COMMON_CODE T2 ON  T1.IN_CATEGORY1 = T2.CC_CODE AND T2.CC_GROUP = 'CAT1'
			LEFT JOIN  H2_COMMON_CODE T3 ON  T1.IN_CATEGORY2 = T3.CC_CODE AND T3.CC_GROUP = 'CAT2'
		WHERE
			IN_STATE_CODE != '99'
			AND IN_COMPLETE = 1
			AND IN_PLACE_CODE LIKE '%'
		]]>
			<if test="dateStart != null and dateStart != ''"><![CDATA[
					AND IN_INFODATE >= #{dateStart}
			]]></if>
			<if test="dateEnd != null and dateEnd != ''"><![CDATA[
					AND IN_INFODATE <= #{dateEnd}
			]]></if>
			<if test="placeGroup != null and placeGroup != ''"><![CDATA[
					AND IN_PLACE_CODE = #{placeGroup}
			]]></if>		
			<if test="orderCol != null and orderCol != '' and orderAsc != null and orderAsc != ''"><![CDATA[ 
				ORDER BY ${orderCol} ${orderAsc}
			]]></if>
	</select>

</mapper>