<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="基价管理">
<query id="CorePriceAddPriceHead.query" desc="查询数据 ">
	<![CDATA[
	 SELECT 
       T.PriceAdd_ID,
       T.PriceAdd_Desc,
       T.PriceAdd_Type,
       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,
     DECODE(T.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       T.CREATE_NAME,
       TO_CHAR(T.CAEATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CAEATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME
 FROM SLM_PRICE_ADDPRICE_HEAD T
 WHERE T.PriceAdd_ID  LIKE '%'|| '#PriceAdd_ID#' ||'%'  
 AND T.PriceAdd_Desc  LIKE '%'|| '#PriceAdd_Desc#' ||'%'
   AND T.VALIDFLAG IN ('1', '#VALIDFLAG#')


	
	
	]]>
	</query>
	
	<query id="CorePriceAddPriceHead.queryById" desc="查询数据 ">
	<![CDATA[
	  SELECT 
       T.PRICEADD_ID,
       T.PRICEADD_LINE_ID,
       T.PRICEADD_CLASSIFY,
       T.PRICEADD_ITEM,
       T.PRICEADD_ITEMVALUE,
       T.PRICEADD_PRICE,
       T.PRICEADD_SUIT,
      DECODE(T.VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
       T.PRICE_STEP
 FROM SLM_PRICE_ADDPRICE_LINE T
 WHERE T.PRICEADD_ID = '#PRICEADD_ID#'     AND T.VALIDFLAG IN ('1', '#VALIDFLAG#')


	
	
	]]>
	</query>
	
	
        
        	<query id="CorePriceAddPriceHead.insert" desc="查询数据 ">
	<![CDATA[
	  INSERT INTO SLM_PRICE_ADDPRICE_HEAD(
        PRICEADD_ID,
        PRICEADD_DESC,
        PRICEADD_TYPE,
        VALIDDATE_BEGIN,
        VALIDDATE_END,
     
        CREATE_NAME,
        CAEATE_TIME)
 VALUES( 
       (SELECT 'T' || LPAD(TO_NUMBER(NVL(SUBSTR(MAX(PRICEADD_ID), 2, 6), '0')) + 1, 6, '0') FROM SLM_PRICE_ADDPRICE_HEAD A ),
        '#PRICEADD_DESC#',
        '#PRICEADD_TYPE#',
        SYSDATE,
        SYSDATE,
      
        '#CREATE_NAME#',
        SYSDATE)
	
	]]>
	</query>

	<query id="CorePriceAddPriceHead.update" desc="更新基价维护 信息">
	<![CDATA[
 UPDATE SLM_PRICE_ADDPRICE_HEAD T
   SET 
      
        T.PRICEADD_DESC = '#PRICEADD_DESC#',
        T.PRICEADD_TYPE = '#PRICEADD_TYPE#',
        T.VALIDDATE_BEGIN = SYSDATE,
        T.VALIDDATE_END = SYSDATE,
     
    
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE
 WHERE
T.PRICEADD_ID = '#PRICEADD_ID#'
   AND T.VALIDFLAG = '1'
	       
	]]>
	</query>
	
	<query id="CorePriceAddPriceHead.Delete" desc="删除价格因素范围">
	<![CDATA[
	
	   UPDATE   SLM_PRICE_ADDPRICE_HEAD  T 
	   SET T.VALIDFLAG = '0',
	       T.UPDATE_NAME = '#UPDATE_NAME#',
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.PRICEADD_ID = '#PRICEADD_ID#' 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceAddPriceHead.Resume" desc="恢复价格因素范围">
	<![CDATA[
	
	   UPDATE  SLM_PRICE_ADDPRICE_HEAD  T 
	   SET T.VALIDFLAG = '1',
	       T.UPDATE_NAME =  '#UPDATE_NAME#',
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.PRICEADD_ID = '#PRICEADD_ID#' 
	      AND T.VALIDFLAG = '0'
	     
	]]>
	</query>


</queryMap>






