<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.icomsys.main_vm.db.mybatis.mapper.BotTTSTagMapper">

	<select id="selectTtsTagList" resultType="java.util.HashMap">
	/* BotTTSTagMapper.selectTtsTagList.xml */
	<![CDATA[
	SELECT
	    *
	FROM (
	    SELECT
	        (SELECT @ROWNUM := @ROWNUM + 1) AS 'rownum'
	    	, A.*
	    FROM (
		SELECT	A.CODE_NAME as codeName,
	      		CONCAT(IFNULL(A.ATTRIBUTE_1,''),' ',IFNULL(A.ATTRIBUTE_2,'')) as soeTag,
				CONCAT(IFNULL(B.TTS_START_TAG,''),' ',IFNULL(B.TTS_END_TAG,'')) as ttsTag,
				IFNULL(B.UPDATE_DATE,'') as updateDate,
				A.MINOR_CODE as tagCode,
				A.ATTRIBUTE_1 as soeStartTag,
				A.ATTRIBUTE_2 as soeEndTag,
				B.TTS_START_TAG as ttsStartTag,
				B.TTS_END_TAG as ttsEndTag
				FROM TB_BOT_COMMON_CODE AS A
		LEFT JOIN TB_BOT_TTS_TAG AS B
		ON A.MINOR_CODE = B.TAG_CODE
		AND B.TTS_PROD_CODE = #{ttsProduct}
		WHERE A.MAJOR_CODE = 'TTS_TAG_TYPE'
		AND A.CUST_CODE = #{custCode}

	    ) A, (SELECT @ROWNUM := 0) B
	) C
		]]>
	</select>


</mapper>
