<?xml version="1.0" encoding="UTF-8"?>
 
<queryMap desc="备料码基础管理">
     
	<query id="CoreMscPhyStdNote.QUERY" desc="查询">
		<![CDATA[
       SELECT 
       PHY_CODE,
       PHY_NAME,
       INDEX_SEQ,
       STD_DESC,
       INDEX_SEQ_GROUP,
       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','有效','0','无效') VALIDFLAG,
       MEMO,
       GUID
       FROM COM_MSC_PHY_STD_NOTE
       WHERE   PHY_CODE = ? AND  VALIDFLAG = '1'
       
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.QUERYIndex" desc="查询">
		<![CDATA[
       SELECT 
       INDEX_SEQ,
       STD_DESC,
       INDEX_SEQ_GROUP
       FROM COM_MSC_PHY_STD_NOTE
       WHERE   PHY_CODE = ? AND  VALIDFLAG = '1'
       
		]]>
	</query>
	
	
	<query id="CoreMscPhyStdNote.Add" desc="新增">
		<![CDATA[
       INSERT INTO COM_MSC_PHY_STD_NOTE
     (PHY_CODE,
      PHY_NAME,
      STD_DESC,
      INDEX_SEQ_GROUP,
      CREATE_NAME,
      CREATE_TIME,
      MEMO,
      GUID,
      INDEX_SEQ)
      VALUES (?,?,?,?,?,SYSDATE,?,?,
       (SELECT NVL(MAX(INDEX_SEQ),0) + 1
        FROM COM_MSC_PHY_STD_NOTE
        WHERE PHY_CODE = ?)
      )
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.UPDATE" desc="修改关联">
		<![CDATA[
      UPDATE COM_MSC_PHY_STD_NOTE
      SET PHY_CODE     = ?,
       PHY_NAME        = ?,
       STD_DESC        = ?,
       INDEX_SEQ_GROUP = ?,
       UPDATE_NAME     = ?,
       UPDATE_TIME     = SYSDATE,
       MEMO            = ? 
     WHERE PHY_CODE =  ?
     AND INDEX_SEQ = ?
      
		]]>
	</query>
	
	 
	
	<query id="CoreMscPhyStdNote.QueryGuid" desc="查询GUID">
		<![CDATA[
          SELECT GUID
          FROM  COM_MSC_STD_PHY 
          WHERE PIC       =    ?
          AND   INDEX_SEQ =    ?
 
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.IsReapt" desc="查询GUID">
		<![CDATA[
          SELECT 1
          FROM  COM_MSC_PHY_STD_NOTE
          WHERE STD_DESC      =    ?
          AND   PHY_CODE      =    ?
           
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.IsReaptUpdate" desc="查询GUID">
		<![CDATA[
          SELECT 1
          FROM  COM_MSC_PHY_STD_NOTE
          WHERE STD_DESC      =    ?
          AND   PHY_CODE      =    ?
          AND   INDEX_SEQ    !=    ?
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.IsRefrenced" desc="是否被引用">
		<![CDATA[
         SELECT 1 FROM COM_MSC_STD_PHY 
         WHERE GUID = ?
		]]>
	</query>
	
	<query id="CoreMscPhyStdNote.IsGrouped" desc="是否被组合">
		<![CDATA[
         SELECT WM_CONCAT( INDEX_SEQ_GROUP) FROM COM_MSC_PHY_STD_NOTE
         WHERE PHY_CODE = ?
        
		]]>
	</query>
	 	
	 	
</queryMap>