<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="价格因素范围管理">
	<query id="CorePriceFactorRange.queryFacRNameByName" desc="按照范围名称查询 ">
	<![CDATA[
	
      select 1 from slm_price_factor_classify t where t.class_d_name = ? AND T.VALIDFLAG = '1'     
	]]>
	</query>

	<query id="CorePriceFactorRange.queryFacRNameById" desc="按照范围ID查询 ">
	<![CDATA[
	
	  SELECT T.CLASS_D_NAME FROM SLM_PRICE_FACTOR_CLASSIFY T
	  WHERE T.CLASS_D_ID = ? AND T.VALIDFLAG = '1'
	     
	]]>
	</query>
		<query id="CorePriceFactorRange.queryFacName" desc="查询订货规格">
	<![CDATA[
	
	  SELECT T.FACTOR_NAME,T.FACTOR_ID FROM SLM_PRICE_FACTOR T
	  WHERE T.VALIDFLAG = '1'
	     
	]]>
	</query>
	
	<query id="CorePriceFactorRange.query" desc="查询数据 ">
	<![CDATA[
	 SELECT 
       FACTOR_MIN_VAL,
       FACTOR_MAX_SIGN,
       FACTOR_MAX_VAL,
       PERTAIN_FACTOR_ID,
       PERTAIN_VAL,
       PERTAIN_MIN_SIGN,
       PERTAIN_MIN_VAL,
       PERTAIN_MAX_SIGN,
       PERTAIN_MAX_VAL,
   DECODE(VALIDFLAG,'1','有效','0','无效') VALIDFLAG,
       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,
       CLASS_D_ID,
       CLASS_D_NAME,
       SORT_NO,
       VER_TYPE,
       FACTOR_ID,
       FACTOR_VAL,
       FACTOR_MIN_SIGN
 FROM SLM_PRICE_FACTOR_CLASSIFY
 WHERE
 1=1
 and CLASS_D_ID LIKE '%'|| '#CLASS_D_ID#' ||'%'
   AND CLASS_D_NAME LIKE '%'|| '#CLASS_D_NAME#' || '%'
   AND VALIDFLAG IN ('1', '#VALIDFLAG#')
 
	     
	]]>
	</query>
	
	<query id="CorePriceFactorRange.queryBaseInfo" desc="查询订货规格">
	<![CDATA[
	
	 SELECT BASECODE,BASENAME FROM COM_BASE_INFO T WHERE T.SORTCODE = ? AND T.VALIDFLAG = '1'
		   
	]]>

	</query>
	<query id="CorePriceFactorRange.insert" desc="查询订货规格">
	<![CDATA[
 INSERT INTO SLM_PRICE_FACTOR_CLASSIFY(
        CLASS_D_ID,
        CLASS_D_NAME,
        SORT_NO,
        VER_TYPE,
        FACTOR_ID,
        FACTOR_VAL,
        FACTOR_MIN_SIGN,
        FACTOR_MIN_VAL,
        FACTOR_MAX_SIGN,
        FACTOR_MAX_VAL,
        PERTAIN_FACTOR_ID,
        PERTAIN_VAL,
        PERTAIN_MIN_SIGN,
        PERTAIN_MIN_VAL,
        PERTAIN_MAX_SIGN,
        PERTAIN_MAX_VAL,
     
        CREATE_NAME,
        CREATE_TIME,
        UPDATE_NAME,
        UPDATE_TIME)
 VALUES( 
       
         (SELECT 'C' || LPAD(TO_NUMBER(NVL(SUBSTR(MAX(CLASS_D_ID), 2, 6), '0')) + 1, 6, '0') FROM SLM_PRICE_FACTOR_CLASSIFY A ),
        '#CLASS_D_NAME#',
        '#SORT_NO#',
        '#VER_TYPE#',
        '#FACTOR_ID#',
        '#FACTOR_VAL#',
        '#FACTOR_MIN_SIGN#',
        '#FACTOR_MIN_VAL#',
        '#FACTOR_MAX_SIGN#',
        '#FACTOR_MAX_VAL#',
        '#PERTAIN_FACTOR_ID#',
        '#PERTAIN_VAL#',
        '#PERTAIN_MIN_SIGN#',
        '#PERTAIN_MIN_VAL#',
        '#PERTAIN_MAX_SIGN#',
        '#PERTAIN_MAX_VAL#',
     
        '#CREATE_NAME#',
        SYSDATE,
        '#UPDATE_NAME#',
        SYSDATE)
	       
	]]>
	</query>
	
	<query id="CorePriceFactorRange.update" desc="查询订货规格">
	<![CDATA[
	
 UPDATE SLM_PRICE_FACTOR_CLASSIFY T
   SET 
        T.CLASS_D_ID = '#CLASS_D_ID#',
        T.CLASS_D_NAME = '#CLASS_D_NAME#',
        T.SORT_NO = '#SORT_NO#',
        T.VER_TYPE = '#VER_TYPE#',
        T.FACTOR_ID = '#FACTOR_ID#',
        T.FACTOR_VAL = '#FACTOR_VAL#',
        T.FACTOR_MIN_SIGN = '#FACTOR_MIN_SIGN#',
        T.FACTOR_MIN_VAL = '#FACTOR_MIN_VAL#',
        T.FACTOR_MAX_SIGN = '#FACTOR_MAX_SIGN#',
        T.FACTOR_MAX_VAL = '#FACTOR_MAX_VAL#',
        T.PERTAIN_FACTOR_ID = '#PERTAIN_FACTOR_ID#',
        T.PERTAIN_VAL = '#PERTAIN_VAL#',
        T.PERTAIN_MIN_SIGN = '#PERTAIN_MIN_SIGN#',
        T.PERTAIN_MIN_VAL = '#PERTAIN_MIN_VAL#',
        T.PERTAIN_MAX_SIGN = '#PERTAIN_MAX_SIGN#',
        T.PERTAIN_MAX_VAL = '#PERTAIN_MAX_VAL#',
      
      
     
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE
 WHERE
T.CLASS_D_ID = '#CLASS_D_ID#'
AND T.VALIDFLAG = '1'	     
	]]>
	</query>
	
	<query id="CorePriceFactorRange.canResume" desc="查询订货规格">
	<![CDATA[
	
	   SELECT 1 FROM  SLM_PRICE_FACTOR_CLASSIFY  T 
	   WHERE  T.CLASS_D_ID != ? 
	      AND T.CLASS_D_NAME = ? 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>
	<query id="CorePriceFactorRange.Delete" desc="删除价格因素范围">
	<![CDATA[
	
	   UPDATE   SLM_PRICE_FACTOR_CLASSIFY  T 
	   SET T.VALIDFLAG = '0',
	       T.UPDATE_NAME = ?,
	       T.UPDATE_TIME = SYSDATE
	   WHERE  T.CLASS_D_ID = ? 
	      AND T.VALIDFLAG = '1'
	     
	]]>
	</query>

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