<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="">


	<query id="QcmBaseLanguageFrm.Query" desc="">
		<![CDATA[
              SELECT *
    FROM QCM_BASE_LANGUAGE
   WHERE LANGUAGE_CODE = DECODE({0}, '/', LANGUAGE_CODE, {0})
     AND NVL(TYPE,'/') = DECODE({1}, '/', NVL(TYPE,'/'), {1})
     AND NVL(TYPE2,'/') = DECODE({2}, '/', NVL(TYPE2,'/'), {2})
     AND NVL(TYPE3,'/') = DECODE({3}, '/', NVL(TYPE3,'/'), {3})
     AND TYPE IN {4}
     AND VALIDFLAG='1'
ORDER BY  TYPE ASC,TYPE2 ASC,TYPE3 ASC,ORIGINAL_VALUE ASC, LANGUAGE_CODE ASC, CREATE_TIME DESC

		]]>
	</query>


	<query id="QcmBaseLanguageFrm.QueryAll" desc="">
		<![CDATA[
             SELECT *
  FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE = DECODE({0}, '/', LANGUAGE_CODE, {0})
   AND NVL(TYPE, '/') = DECODE({1}, '/', NVL(TYPE, '/'), {1})
   AND NVL(TYPE2, '/') = DECODE({2}, '/', NVL(TYPE2, '/'), {2})
   AND NVL(TYPE3, '/') = DECODE({3}, '/', NVL(TYPE3, '/'), {3})
   AND TYPE IN {4}
 ORDER BY TYPE           ASC,
          TYPE2          ASC,
          TYPE3          ASC,
          ORIGINAL_VALUE ASC,
          LANGUAGE_CODE  ASC,
          CREATE_TIME    DESC
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.Query1" desc="">
		<![CDATA[
            SELECT * FROM QCM_BASE_LANGUAGE WHERE LANGUAGE_CODE =? AND ORIGINAL_VALUE= ?  AND VALIDFLAG='1' ORDER BY CREATE_TIME DESC
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.QueryType" desc="">
		<![CDATA[
		 SELECT '/' BASECODE, '所有' BASENAME
   FROM DUAL
 UNION ALL
 SELECT *
   FROM (SELECT BASECODE, BASENAME
           FROM COM_BASE_INFO
          WHERE SORTCODE like {0}
            AND VALIDFLAG = '1'
          ORDER BY BASECODE)
		]]>
	</query>
	
	<query id="QcmBaseLanguageFrm.QueryType2" desc="">
		<![CDATA[
		 SELECT '/' BASECODE, '所有' BASENAME
   FROM DUAL
 UNION ALL
 SELECT *
   FROM (SELECT BASECODE, BASENAME
           FROM COM_BASE_INFO
          WHERE SORTCODE like {0}
          AND BASECODE IN {1}
            AND VALIDFLAG = '1'
          ORDER BY BASECODE)
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.QueryTypeC" desc="">
		<![CDATA[
 SELECT *
   FROM (SELECT BASECODE, BASENAME
           FROM COM_BASE_INFO
          WHERE SORTCODE like {0}
            AND BASECODE IN {1}
            AND VALIDFLAG = '1'
          ORDER BY BASECODE)
		]]>
	</query>
	
	<query id="QcmBaseLanguageFrm.QueryTypeC2" desc="">
		<![CDATA[
 SELECT *
   FROM (SELECT BASECODE, BASENAME
           FROM COM_BASE_INFO
          WHERE SORTCODE like {0}
            AND VALIDFLAG = '1'
          ORDER BY BASECODE)
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.OnKeyAdd" desc="">
		<![CDATA[

SELECT T3.*,
       T.TYPE,
       T.TYPE2,
       T.TYPE3,
       T.ASK_ITEM_NO    LANGUAGE_CODE,
       T.ASK_ITEM_DESC  LANGUAGE_NAME,
       T.ORIGINAL_VALUE
  FROM (SELECT *
          FROM (SELECT ASK_ITEM_NO, ASK_ITEM_DESC
                  FROM SLM_BASE_ADD_ASK T
                 WHERE T.ASK_P_ITEM_NO = '12100704'
                   AND VALIDFLAG = '1'
                   AND ASK_ITEM_NO = DECODE({0}, '/', ASK_ITEM_NO, {0})) T1
          LEFT JOIN (SELECT DISTINCT ORIGINAL_VALUE,TYPE,TYPE2,TYPE3
                      FROM QCM_BASE_LANGUAGE
                     WHERE VALIDFLAG = '1'
                        AND NVL(TYPE, '/') = DECODE({1}, '/', NVL(TYPE, '/'), {1})
           AND NVL(TYPE2, '/') = DECODE({2}, '/', NVL(TYPE2, '/'), {2})
           AND NVL(TYPE3, '/') = DECODE({3}, '/', NVL(TYPE3, '/'), {3})) T2
            ON 1 = 1) T
  LEFT JOIN QCM_BASE_LANGUAGE T3
    ON T3.LANGUAGE_CODE = T.ASK_ITEM_NO
   AND T3.ORIGINAL_VALUE = T.ORIGINAL_VALUE
 ORDER BY T.ORIGINAL_VALUE ASC, T.ASK_ITEM_NO ASC, T3.CREATE_TIME DESC

		]]>
	</query>


	<query id="QcmBaseLanguageFrm.QueryLanguage" desc="">
		<![CDATA[
 SELECT '/' ASK_ITEM_NO, '所有' ASK_ITEM_DESC
   FROM DUAL
 UNION ALL
 SELECT *
   FROM (SELECT ASK_ITEM_NO, ASK_ITEM_DESC
           FROM SLM_BASE_ADD_ASK T
          WHERE T.ASK_P_ITEM_NO = '12100704'
            AND VALIDFLAG = '1'
          ORDER BY ASK_ITEM_NO)
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.QueryLanguageC" desc="">
		<![CDATA[
 SELECT *
   FROM (SELECT ASK_ITEM_NO, ASK_ITEM_DESC
           FROM SLM_BASE_ADD_ASK T
          WHERE T.ASK_P_ITEM_NO = '12100704'
            AND VALIDFLAG = '1'
          ORDER BY ASK_ITEM_NO)
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.QueryAllLanguage" desc="">
		<![CDATA[
            	SELECT * FROM SLM_BASE_ADD_ASK T WHERE T.ASK_P_ITEM_NO ='12100704' AND VALIDFLAG='1'
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.QueryAllLanguageSet" desc="">
		<![CDATA[
   SELECT T3.*,
          T2.ORIGINAL_VALUE,
          T2.ASK_ITEM_NO    LANGUAGE_CODE,
          T2.ASK_ITEM_DESC  LANGUAGE_NAME,
          ?                 TYPE,
          T2.ORIGINAL_VALUE  BACK
     FROM (SELECT T1.ORIGINAL_VALUE, T.ASK_ITEM_NO, T.ASK_ITEM_DESC
             FROM SLM_BASE_ADD_ASK T
             LEFT JOIN QCM_BASE_LANGUAGE T1
               ON 1 = 1 @ID
            WHERE T.ASK_P_ITEM_NO = '12100704'
              AND T.VALIDFLAG = '1') T2
     LEFT JOIN QCM_BASE_LANGUAGE T3
       ON T3.LANGUAGE_CODE = T2.ASK_ITEM_NO
      AND T3.ORIGINAL_VALUE = T2.ORIGINAL_VALUE
      AND T3.VALIDFLAG = '1'
    ORDER BY T2.ORIGINAL_VALUE, T2.ASK_ITEM_NO
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.BeforeAdd" desc="">
		<![CDATA[
         DELETE FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE ='#LANGUAGE_CODE#'
     AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#'
		]]>
	</query>


	<query id="QcmBaseLanguageFrm.Add" desc="">
		<![CDATA[
        INSERT INTO QCM_BASE_LANGUAGE
  (ORIGINAL_VALUE, LANGUAGE_CODE, LANGUAGE_NAME, RESULT_VALUE,REMARK,TYPE,TYPE2,TYPE3,CREATE_NAME,CREATE_TIME)
SELECT
   trim('#ORIGINAL_VALUE#'),
   '#LANGUAGE_CODE#',
   (SELECT ASK_ITEM_DESC FROM SLM_BASE_ADD_ASK WHERE ASK_ITEM_NO =  '#LANGUAGE_CODE#'),
   trim('#RESULT_VALUE#'),
   '#REMARK#',
   '#TYPE#',
   '#TYPE2#',
   '#TYPE3#',
   '#CREATE_NAME#',
    SYSDATE
  FROM DUAL WHERE  NOT EXISTS (SELECT 1 FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE ='#LANGUAGE_CODE#'
     AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#' AND VALIDFLAG='1')
		]]>
	</query>

	<query id="QcmBaseLanguageFrm.AddC" desc="">
		<![CDATA[
            	INSERT INTO QCM_BASE_LANGUAGE
  (ORIGINAL_VALUE, LANGUAGE_CODE, LANGUAGE_NAME, RESULT_VALUE)
SELECT
   trim('#ORIGINAL_VALUE#'),
   '1210070400000001',
   '中文',
   trim('#ORIGINAL_VALUE#'),
  FROM DUAL WHERE  NOT EXISTS (SELECT 1 FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE = '1210070400000001'
     AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#')
		]]>
	</query>


	<query id="QcmBaseLanguageFrm.BeforeUpdate" desc="">
		<![CDATA[
         DELETE FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE ='#LANGUAGE_CODE#',
     AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#'
     AND ID <> '#ID#'
		]]>
	</query>


	<query id="QcmBaseLanguageFrm.Update" desc="">
		<![CDATA[
         UPDATE QCM_BASE_LANGUAGE
   SET ORIGINAL_VALUE = '#ORIGINAL_VALUE#',
       LANGUAGE_CODE  = '#LANGUAGE_CODE#',
       LANGUAGE_NAME  =  (SELECT ASK_ITEM_DESC FROM SLM_BASE_ADD_ASK WHERE ASK_ITEM_NO =  '#LANGUAGE_CODE#'),
       RESULT_VALUE   = '#RESULT_VALUE#',
       REMARK = '#REMARK#',
       TYPE = '#TYPE#',
       TYPE2 = '#TYPE2#',
       TYPE3 = '#TYPE3#',
       UPDATE_NAME ='#UPDATE_NAME#',
       UPDATE_TIME = SYSDATE
 WHERE ID = '#ID#'

		]]>
	</query>

	<query id="QcmBaseLanguageFrm.UpdateC" desc="">
		<![CDATA[
DELETE FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE = '1210070400000001'
   AND ORIGINAL_VALUE =
       (SELECT ORIGINAL_VALUE FROM QCM_BASE_LANGUAGE WHERE ID = '#ID#')
   AND NOT EXISTS
 (SELECT 1
          FROM QCM_BASE_LANGUAGE
         WHERE LANGUAGE_CODE <> '1210070400000001'
           AND ORIGINAL_VALUE = (SELECT ORIGINAL_VALUE
                                   FROM QCM_BASE_LANGUAGE
                                  WHERE ID = '#ID#')
           AND ID <> '#ID#')
		]]>
	</query>




	<query id="QcmBaseLanguageFrm.Delete" desc="">
		<![CDATA[
         UPDATE  QCM_BASE_LANGUAGE SET VALIDFLAG ='0' , DELETE_NAME = '#DELETE_NAME#', DELETE_TIME = SYSDATE
 WHERE ID = '#ID#'
		]]>
	</query>


	<query id="QcmBaseLanguageFrm.DeleteC" desc="">
		<![CDATA[
         DELETE FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE = '1210070400000001'
 AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#'
 AND NOT EXISTS (SELECT 1 FROM QCM_BASE_LANGUAGE
 WHERE LANGUAGE_CODE <> '1210070400000001'
     AND ORIGINAL_VALUE = '#ORIGINAL_VALUE#')

		]]>
	</query>

	<query id="QcmBaseLanguageFrm.Copy" desc="">
		<![CDATA[
	SELECT * FROM (
SELECT '' ID,
       {0} LANGUAGE_CODE,
       {1} LANGUAGE_NAME,
       NVL(T.ORIGINAL_VALUE, T1.ORIGINAL_VALUE) ORIGINAL_VALUE,
       NVL(T.RESULT_VALUE, '') ||  CHR(13) ||chr(10) || NVL(T1.RESULT_VALUE, '') RESULT_VALUE,
       'True' CHK
  FROM QCM_BASE_LANGUAGE T
  FULL JOIN QCM_BASE_LANGUAGE T1
    ON T1.LANGUAGE_CODE ={2}
   AND T1.ORIGINAL_VALUE = T.ORIGINAL_VALUE
   AND T1.VALIDFLAG = '1'
 WHERE T.LANGUAGE_CODE = {3}
 AND T.VALIDFLAG = '1'
 ) T3


		]]>
	</query>
</queryMap>