<?xml version="1.0" encoding="UTF-8"?>

<queryMap desc="价格因素管理">
	<query id="CorePriceBaseSuit.querySuitNameByName" desc="查询订货规格">
	<![CDATA[
	
	   SELECT 1 FROM  SLM_PRICE_BASESUIT  T WHERE  T.SUIT_NAME = '#SUIT_NAME#' AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceBaseSuit.querySuitNameById" desc="查询订货规格">
	<![CDATA[
	
	  SELECT T.SUIT_NAME FROM SLM_PRICE_BASESUIT T
	  WHERE T.SUIT_ID = '#SUIT_ID#' AND T.VALIDFLAG = '1'
	     
	]]>
	</query>
	
	<query id="CorePriceBaseSuit.getSUITCLASSIFY" desc="查询订货规格">
	<![CDATA[
	
	select t.suit_id,t.suit_name from SLM_PRICE_BASESUIT t where t.ver_type=? and T.VALIDFLAG = '1'
	     
	]]>
	</query>
	<query id="CorePriceBaseSuit.GetSuitInfo" desc="根据因素名称查询因素信息 ">
	<![CDATA[

	    select * from SLM_PRICE_BASESUIT t where t.suit_id=? AND T.VALIDFLAG = '1'
	     	]]>
	</query>
	
	

	<query id="CorePriceBaseSuit.insert" desc="查询订货规格">
	<![CDATA[
         INSERT INTO SLM_PRICE_BASESUIT(
        SUIT_ID,
        SUIT_NAME,
        TABLE_NAME,
        COLUMN_KEY,
        COLUMN_TYPE,
        VAL_SQL,
        VER_TYPE,
        CREATE_NAME,
        CREATE_TIME,    
        COLUMN_NAME)
 VALUES( 
         (SELECT 'S' || LPAD(TO_NUMBER(NVL(SUBSTR(MAX(SUIT_ID), 2, 6), '0')) + 1, 6, '0') FROM SLM_PRICE_BASESUIT A ),
        '#SUIT_NAME#',
        '#TABLE_NAME#',
        '#COLUMN_KEY#',
        '#COLUMN_TYPE#',
        '#VAL_SQL#',
        '#VER_TYPE#',
        '#CREATE_NAME#',    
        SYSDATE,
        '#COLUMN_NAME#')
	       
	]]>
	</query>

	<query id="CorePriceBaseSuit.update" desc="查询订货规格">
	<![CDATA[
	
	 UPDATE SLM_PRICE_BASESUIT T
   SET 
        T.SUIT_ID = '#SUIT_ID#',
        T.SUIT_NAME = '#SUIT_NAME#',
        T.TABLE_NAME = '#TABLE_NAME#',
        T.COLUMN_KEY = '#COLUMN_KEY#',
        T.COLUMN_TYPE = '#COLUMN_TYPE#',
        T.VAL_SQL = '#VAL_SQL#',
        T.VER_TYPE = '#VER_TYPE#',     
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE,
        T.COLUMN_NAME = '#COLUMN_NAME#'
   WHERE T.SUIT_ID = '#SUIT_ID#'
         AND T.VALIDFLAG = '1'
	  
	     
	]]>
	</query>

	<query id="CorePriceBaseSuit.query" desc="查询订货规格">
	<![CDATA[
	    SELECT 
       T.SUIT_ID,
       T.SUIT_NAME,
       T.TABLE_NAME,
       T.COLUMN_KEY,
       T.COLUMN_TYPE,
       T.VAL_SQL,
       T.VER_TYPE,
      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.COLUMN_NAME
 FROM SLM_PRICE_BASESUIT T
 WHERE T.SUIT_ID LIKE '%'|| '#SUIT_ID#' ||'%'
   AND T.SUIT_NAME LIKE '%'|| '#SUIT_NAME#' || '%'
   AND T.VALIDFLAG IN ('1', '#VALIDFLAG#')
 
	     
	]]>
	</query>


	<query id="CorePriceBaseSuit.canResume" desc="查询订货规格">
	<![CDATA[
	
	   SELECT 1 FROM  SLM_PRICE_BASESUIT  T 
	   WHERE  T.SUIT_ID != '#SUIT_ID#' 
	      AND T.SUIT_NAME = '#SUIT_NAME#' 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceBaseSuit.Delete" desc="查询订货规格">
	<![CDATA[
	
	   UPDATE   SLM_PRICE_BASESUIT  T 
	   SET T.VALIDFLAG = '0',
	       T.UPDATE_NAME = '#UPDATE_NAME#',
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.SUIT_ID = '#SUIT_ID#'
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

	<query id="CorePriceBaseSuit.Resume" desc="查询订货规格">
	<![CDATA[
	
	   UPDATE  SLM_PRICE_BASESUIT  T 
	   SET T.VALIDFLAG = '1',
	       T.UPDATE_NAME = '#UPDATE_NAME#',
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.SUIT_ID =  '#SUIT_ID#' 
	      AND T.VALIDFLAG = '0'
	     
	]]>
	</query>
</queryMap>
