<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="成分内控标准">

<query id="CoreInnerChemcs.QUERY" desc="化学元素标准索引">
    <![CDATA[
	   SELECT CIC,
       PSC,
       DECODE(STDSTYLE,'K','ALPHA','N','内控','S','实验标准','成分偏差标准') STDSTYLE,
       STD_CODE_NK,
       STD_NAME_NK,
       WHOLE_BACKLOG_2,
       PROCESS_DESC,
       GRADECODE,
       GRADENAME,
       STD_CODE,
       STD_NAME,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME,'yyyy-mm-dd hh24:mi:ss') DELETE_TIME,
       DECODE(VALIDFLAG,'1','有效','无效') VALIDFLAG,
       MEMO
       FROM COM_MSC_STD_CIC
       WHERE
       UPPER(STD_NAME_NK)||'&' LIKE UPPER('%' || ? || '%')
       AND UPPER(PROCESS_DESC)||'&' LIKE UPPER('%' || ? || '%')
       AND UPPER(GRADENAME)||'&' LIKE UPPER('%' || ? || '%')
       AND VALIDFLAG in ('1' , ?)
       AND STDSTYLE NOT IN ('G','X' )
       ORDER BY CIC 
		]]>
	</query>
	
	
<query id="CoreInnerChemcs.QUERY1" desc="化学元素标准">
	<![CDATA[
	SELECT 
	   CIC,
       INDEX_SEQ,
       CHEM_CODE,
       CHEM_NAME,
       DECODE(WHOLE_BACKLOG,'A','单一元素','复合元素') WHOLE_BACKLOG,
       CHEM_FORMULA,
       DECODE(ISCHECK,'1','TRUE','FALSE') ISCHECK,
       STDMIN_SIGN,
       STDMIN,
       STDMAX_SIGN,
       STDMAX,
       STDTARGET,
       MODEL_CODE,
       MODEL_DESC,
       STDMEMO,
       SPEC_JG,
       SPEC_JG_DESC,
       CREATE_NAME,
       TO_CHAR(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,
       UPDATE_NAME,
       TO_CHAR(UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') UPDATE_TIME,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME,'yyyy-mm-dd hh24:mi:ss') DELETE_TIME,
       DECODE(VALIDFLAG,'1','有效','无效') VALIDFLAG
       FROM COM_MSC_STD_CHEM
       WHERE  VALIDFLAG in ('1' , ?)
       ORDER BY INDEX_SEQ 
		]]>
	</query>
	
	
<query id="CoreInnerChemcs.ADD" desc="化学元素标准索引">
		<![CDATA[
	  INSERT INTO COM_MSC_STD_CIC
      (CIC,
       PSC,
       STDSTYLE,
       STD_CODE_NK,
       STD_NAME_NK,
       WHOLE_BACKLOG_2,
       PROCESS_DESC,
       GRADECODE,
       GRADENAME,
       STD_CODE,
       STD_NAME,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME, 
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,  
      MEMO)
      VALUES(?,?,?,?,?,?,?,?, ?,?,?, ?,SYSDATE,'',NULL,'', NULL,DEFAULT,?)
	  
		]]>
	</query>
	
	
<query id="CoreInnerChemcs.ADD1" desc="化学元素标准">
		<![CDATA[	
        INSERT INTO COM_MSC_STD_CHEM
        (CIC,
        INDEX_SEQ,
        CHEM_CODE,
        CHEM_NAME,
        WHOLE_BACKLOG,
        CHEM_FORMULA,
        ISCHECK,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX,
        STDTARGET,
        MODEL_CODE,
        MODEL_DESC,
        STDMEMO,
        SPEC_JG,
        SPEC_JG_DESC,
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME,
        DELETE_NAME,
        DELETE_TIME,
        VALIDFLAG)
VALUES
  (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE,'',NULL,'',NULL,DEFAULT)


			]]>
	</query>
	
	
<query id="CoreInnerChemcs.UPDATE" desc="化学元素标准索引">
		<![CDATA[
      UPDATE COM_MSC_STD_CIC
       SET CIC = ?,
       PSC = ?,
       STDSTYLE = ?,
       STD_CODE_NK = ?,
       STD_NAME_NK = ?,
       WHOLE_BACKLOG_2 = ?,
       PROCESS_DESC = ?,
       GRADECODE = ?,
       GRADENAME = ?,
       STD_CODE = ?,
       STD_NAME = ?,
       UPDATE_NAME =  ?,
       UPDATE_TIME = SYSDATE,
       MEMO = ?
       WHERE CIC = ?
				]]>
	</query>
	
	
<query id="CoreInnerChemcs.UPDATE1" desc="化学元素标准">
		<![CDATA[
		UPDATE COM_MSC_STD_CHEM
       SET CIC = ?,
       INDEX_SEQ = ?,
       CHEM_CODE = ?,
       CHEM_NAME = ?,
       WHOLE_BACKLOG = ?,
       CHEM_FORMULA = ?,
       ISCHECK = ?,
       STDMIN_SIGN = ?,
       STDMIN = ?,
       STDMAX_SIGN = ?,
       STDMAX = ?,
       STDTARGET = ?,
       MODEL_CODE = ?,
       MODEL_DESC = ?,
       STDMEMO = ?,
       SPEC_JG = ?,
       SPEC_JG_DESC = ?,
       UPDATE_NAME = ?,
       UPDATE_TIME = SYSDATE
       WHERE CIC = ?  AND INDEX_SEQ = ?

				]]>
	</query>
	
	
<query id="CoreInnerChemcs.DELETE" desc="化学元素标准索引">
		<![CDATA[
		UPDATE COM_MSC_STD_CIC
		SET
		VALIDFLAG='0',
		DELETE_NAME=?,
		DELETE_TIME=SYSDATE
		WHERE
		CIC = ?
		]]>
		</query>
		
<query id="CoreInnerChemcs.RESUME" desc="化学元素标准索引">
		<![CDATA[
			UPDATE COM_MSC_STD_CIC
		SET
		VALIDFLAG='1',
		DELETE_NAME=?,
		DELETE_TIME=NULL
		WHERE
		CIC = ?
		]]>
		</query>		
		
<query id="CoreInnerChemcs.DELETE1" desc="化学元素标准">
		<![CDATA[
		UPDATE COM_MSC_STD_CHEM
        SET
        VALIDFLAG = '0',
        DELETE_NAME = ?,
        DELETE_TIME = SYSDATE
       WHERE CIC = ? AND INDEX_SEQ = ?
		]]>
		</query>
		
<query id="CoreInnerChemcs.RESUME1" desc="化学元素标准">
		<![CDATA[
		UPDATE COM_MSC_STD_CHEM
        SET
        VALIDFLAG = '1',
        DELETE_NAME = ?,
        DELETE_TIME = NULL
       WHERE CIC = ? AND INDEX_SEQ = ?
		]]>
		</query>		
		
<query id="CoreInnerChemcs.QUERYMAX" desc="化学元素标准">
		<![CDATA[
		SELECT CIC FROM COM_MSC_STD_CIC WHERE CIC=(SELECT MAX(CIC)  FROM COM_MSC_STD_CIC WHERE CIC LIKE 'CICN%') 
		]]>
		</query>
		
		
<query id="CoreInnerChemcs.QUERYMAX1" desc="化学元素标准">
		<![CDATA[
		SELECT INDEX_SEQ FROM COM_MSC_STD_CHEM 
		WHERE INDEX_SEQ=(SELECT MAX(INDEX_SEQ) FROM COM_MSC_STD_CHEM WHERE CIC=?) 
		]]>
		</query>
		
<query id="CoreInnerChemcs.QUERYCOMMON" desc="化学元素标准">
		<![CDATA[
		SELECT CIC,
       PSC,
       STDSTYLE,
       STD_CODE_NK,
       STD_NAME_NK,
       PROCESS_DESC,
       GRADECODE,
       GRADENAME,
       STD_CODE,
       STD_NAME,
       CREATE_NAME,
       CREATE_TIME,
       UPDATE_NAME,
       UPDATE_TIME,
       DELETE_NAME,
       DELETE_TIME,
       VALIDFLAG,
       MEMO,
       WHOLE_BACKLOG_2
  FROM COM_MSC_STD_CIC
  WHERE STD_NAME_NK=? AND PROCESS_DESC=? AND GRADENAME=?

		]]>
		</query>
</queryMap>