<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="价格文件版本 管理 ">

	<query id="CorePriceFactor.queryTableName" desc="查询订货规格">
	<![CDATA[
	SELECT T.TABLE_NAME
    FROM USER_TABLES T
    WHERE T.TABLE_NAME LIKE 'COM%'
    OR T.TABLE_NAME LIKE 'SLM%'
		   
	]]>

	</query>

	

	

	



	<query id="CorePriceFactor.queryFacNameById" desc="查询订货规格">
	<![CDATA[
	
	  SELECT T.FACTOR_NAME FROM SLM_PRICE_FACTOR T
	  WHERE T.FACTOR_ID = ? AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceDoc.insert" desc="查询订货规格">
	<![CDATA[
	 
	  INSERT INTO SLM_PRICE_DOC(
        PRICE_VER_ID,
        PRICE_VER_DESC,
        VALIDDATE_BEGIN,
        VALIDDATE_END,
        CREATENAME,
        CREATEDATE)
 VALUES( 
         (SELECT 'D' || LPAD(TO_NUMBER(NVL(SUBSTR(MAX(PRICE_VER_ID), 2, 6), '0')) + 1, 6, '0') FROM SLM_PRICE_DOC A ),
        '#PRICE_VER_DESC#',
        
          TO_Date('#VALIDDATE_BEGIN#', 'YYYY-MM-DD HH24:MI:SS') ,
          TO_Date('#VALIDDATE_END#', 'YYYY-MM-DD HH24:MI:SS') ,
             
        '#CREATENAME#',
        SYSDATE
      
       )      
	       
	       
	       
	       
	       
	]]>
	</query>

	<query id="CorePriceDoc.update" desc="查询订货规格">
	<![CDATA[
     
	      UPDATE SLM_PRICE_DOC T
   SET 
        
        T.PRICE_VER_DESC = '#PRICE_VER_DESC#',
        T.VALIDDATE_BEGIN =   TO_Date('#VALIDDATE_BEGIN#', 'YYYY-MM-DD HH24:MI:SS') ,
        T.VALIDDATE_END =  TO_Date('#VALIDDATE_END#', 'YYYY-MM-DD HH24:MI:SS') ,
        
            
        
        T.UPDATENAME = '#UPDATENAME#',
        T.UPDATEDATE = SYSDATE
 WHERE
T.PRICE_VER_ID = '#PRICE_VER_ID#'
         AND T.VALIDFLAG = '1'
	     
	     
	]]>
	</query>

	<query id="CorePriceDoc.query" desc="查询价格文件版本信息">
	<![CDATA[
 SELECT 
       T.PRICE_VER_ID,
       T.PRICE_VER_DESC,
       TO_CHAR(T.VALIDDATE_BEGIN, 'YYYY-MM-DD HH24:MI:SS') VALIDDATE_BEGIN,
       TO_CHAR(T.VALIDDATE_END, 'YYYY-MM-DD HH24:MI:SS') VALIDDATE_END,
       T.VALIDFLAG,
       T.CREATENAME,
       TO_CHAR(T.CREATEDATE, 'YYYY-MM-DD HH24:MI:SS') CREATEDATE,
       T.UPDATENAME,
       TO_CHAR(T.UPDATEDATE, 'YYYY-MM-DD HH24:MI:SS') UPDATEDATE
 FROM SLM_PRICE_DOC T
 WHERE

  T.PRICE_VER_ID LIKE '%'|| '#PRICE_VER_ID#' ||'%'
   AND T.PRICE_VER_DESC LIKE '%'|| '#PRICE_VER_DESC#' || '%'
   AND T.VALIDFLAG IN ('1', '#VALIDFLAG#')
 
	     
	]]>
	</query>


	<query id="CorePriceDoc.canResume" desc="查询订货规格">
	<![CDATA[

	        SELECT * FROM  SLM_PRICE_DOC  T 
	   WHERE  T.PRICE_VER_ID != '#PRICE_VER_ID#' 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>
	
	<query id="CorePriceDoc.Delete" desc="删除价格因素范围">
	<![CDATA[
	
	   UPDATE   SLM_PRICE_DOC  T 
	   SET T.VALIDFLAG = '0',
	       T.updatename = '#updatename#',
	       T.updatedate = SYSDATE
	   WHERE  T.PRICE_VER_ID = '#PRICE_VER_ID#' 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceDoc.Resume" desc="恢复价格因素范围">
	<![CDATA[
	
	   UPDATE  SLM_PRICE_DOC  T 
	   SET T.VALIDFLAG = '1',
	       T.updatename =  '#updatename#',
	       T.updatedate = SYSDATE
	   WHERE  T.PRICE_VER_ID = '#PRICE_VER_ID#' 
	      AND T.VALIDFLAG = '0'
	     
	]]>
	</query>




</queryMap>