<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="基价扩展管理">
<query id="CorePriceFramePriceExp.getPriceExpByVerId" desc="">
        
	<![CDATA[
	 SELECT 
       T.PRICE_EXP_ID,
       T.PRICE_EXP_NAME,
       T.Frame_ID,
       '0' as Total_Add,
       T.Factor1_ID,
       T.Factor1_Price,
       T.Factor2_ID,
       T.Factor2_Price,
       T.Factor3_ID,
       T.Factor3_Price,
       T.Factor4_ID,
       T.Factor4_Price,
       T.Factor5_ID,
       T.Factor5_Price,
       T.Factor6_ID,
       T.Factor6_Price,
       T.Factor7_ID,
       T.Factor7_Price,
       T.Factor8_ID,
       T.Factor8_Price,
       T.PRICE_HEAD_ID,
        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
 FROM SLM_PRICE_BASEPRICE_EXP T
 WHERE T.PRICE_HEAD_ID = '#PRICE_HEAD_ID#'     AND T.VALIDFLAG IN ('1', '#VALIDFLAG#')
	]]>
	</query>
	
	<query id="CorePriceFramePriceExp.insert" desc="查询数据 ">
	<![CDATA[
 INSERT INTO SLM_PRICE_BASEPRICE_EXP(
        PRICE_EXP_ID,
        PRICE_EXP_NAME,
        FRAME_ID,
        PRICE_HEAD_ID,
        FACTOR1_ID,
        FACTOR1_PRICE,
        FACTOR2_ID,
        FACTOR2_PRICE,
        FACTOR3_ID,
        FACTOR3_PRICE,
        FACTOR4_ID,
        FACTOR4_PRICE,
        FACTOR5_ID,
        FACTOR5_PRICE,
        FACTOR6_ID,
        FACTOR6_PRICE,
        FACTOR7_ID,
        FACTOR7_PRICE,
        FACTOR8_ID,
        FACTOR8_PRICE,
       
        CREATE_NAME,
        CREATE_TIME)
 VALUES( 
       
               (SELECT 'E' || LPAD(TO_NUMBER(NVL(SUBSTR(MAX(PRICE_EXP_ID), 2, 6), '0')) + 1, 6, '0') FROM SLM_PRICE_BASEPRICE_EXP A ),
        '#PRICE_EXP_NAME#',
        '#FRAME_ID#',
        '#PRICE_HEAD_ID#',
        '#FACTOR1_ID#',
        '#FACTOR1_PRICE#',
        '#FACTOR2_ID#',
        '#FACTOR2_PRICE#',
        '#FACTOR3_ID#',
        '#FACTOR3_PRICE#',
        '#FACTOR4_ID#',
        '#FACTOR4_PRICE#',
        '#FACTOR5_ID#',
        '#FACTOR5_PRICE#',
        '#FACTOR6_ID#',
        '#FACTOR6_PRICE#',
        '#FACTOR7_ID#',
        '#FACTOR7_PRICE#',
        '#FACTOR8_ID#',
        '#FACTOR8_PRICE#',
        '#CREATE_NAME#',
        SYSDATE
       )

	]]>
	</query>
	
	<query id="CorePriceFramePriceExp.update" desc="查询数据 ">
	<![CDATA[
  UPDATE SLM_PRICE_BASEPRICE_EXP T
   SET 
     
        T.PRICE_EXP_NAME = '#PRICE_EXP_NAME#',
        T.FRAME_ID = '#FRAME_ID#',
        T.PRICE_HEAD_ID = '#PRICE_HEAD_ID#',
        T.FACTOR1_ID = '#FACTOR1_ID#',
        T.FACTOR1_PRICE = '#FACTOR1_PRICE#',
        T.FACTOR2_ID = '#FACTOR2_ID#',
        T.FACTOR2_PRICE = '#FACTOR2_PRICE#',
        T.FACTOR3_ID = '#FACTOR3_ID#',
        T.FACTOR3_PRICE = '#FACTOR3_PRICE#',
        T.FACTOR4_ID = '#FACTOR4_ID#',
        T.FACTOR4_PRICE = '#FACTOR4_PRICE#',
        T.FACTOR5_ID = '#FACTOR5_ID#',
        T.FACTOR5_PRICE = '#FACTOR5_PRICE#',
        T.FACTOR6_ID = '#FACTOR6_ID#',
        T.FACTOR6_PRICE = '#FACTOR6_PRICE#',
        T.FACTOR7_ID = '#FACTOR7_ID#',
        T.FACTOR7_PRICE = '#FACTOR7_PRICE#',
        T.FACTOR8_ID = '#FACTOR8_ID#',
        T.FACTOR8_PRICE = '#FACTOR8_PRICE#',
      
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE
where T.PRICE_EXP_ID = '#PRICE_EXP_ID#'
         AND T.VALIDFLAG = '1'

	]]>
	</query>
	
	<query id="CorePriceFramePriceExp.Delete" desc="删除价格因素范围">
	<![CDATA[
	
	   UPDATE   SLM_PRICE_BASEPRICE_EXP  T 
	   SET T.VALIDFLAG = '0',
	       T.UPDATE_NAME = '#UPDATE_NAME#',
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.PRICE_EXP_ID = '#PRICE_EXP_ID#'
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

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