<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="COM_BASE_PURCHASE_RANGE （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="ComBasePurchaseRangeDAL.Query" desc="查询">
        <![CDATA[
SELECT T.RANGE_ID,
       T.SUPP_CODE,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.LEN_MAX,
       T.LEN_MIN,
       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.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       DECODE(T.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG
  FROM COM_BASE_PURCHASE_RANGE T
 WHERE T.SUPP_CODE = {0}
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.RANGE_ID,
       T.SUPP_CODE,
       T.SPEC_CODE,
       T.SPEC_NAME,
       T.LEN_MAX,
       T.LEN_MIN,
       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.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
       T.VALIDFLAG
 FROM COM_BASE_PURCHASE_RANGE T
 WHERE
       T.RANGE_ID = '#RANGE_ID#'
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO COM_BASE_PURCHASE_RANGE(
        RANGE_ID,
        SUPP_CODE,
        SPEC_CODE,
        SPEC_NAME,
        LEN_MAX,
        LEN_MIN,
        CREATE_NAME,
        CREATE_TIME)
 VALUES( 
        '#RANGE_ID#',
        '#SUPP_CODE#',
        '#SPEC_CODE#',
        '#SPEC_NAME#',
        '#LEN_MAX#',
        '#LEN_MIN#',
        '#CREATE_NAME#',
        SYSDATE)
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.Update" desc="修改">
        <![CDATA[
 UPDATE COM_BASE_PURCHASE_RANGE T
   SET 
        T.SUPP_CODE = '#SUPP_CODE#',
        T.SPEC_CODE = '#SPEC_CODE#',
        T.SPEC_NAME = '#SPEC_NAME#',
        T.LEN_MAX = '#LEN_MAX#',
        T.LEN_MIN = '#LEN_MIN#',
        T.UPDATE_NAME = '#UPDATE_NAME#',
        T.UPDATE_TIME = SYSDATE
 WHERE
       T.RANGE_ID = '#RANGE_ID#'
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT 'RAG' || LPAD(NVL(SUBSTR(MAX(RANGE_ID), 4), 0) + 1, 7, '0') MAX_VALUE
  FROM COM_BASE_PURCHASE_RANGE T
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.Delete" desc="作废">
        <![CDATA[
UPDATE COM_BASE_PURCHASE_RANGE T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.RANGE_ID = '#RANGE_ID#'
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE COM_BASE_PURCHASE_RANGE T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.RANGE_ID = '#RANGE_ID#'
        ]]>
    </query>
    <query id="ComBasePurchaseRangeDAL.Delete2" desc="删除">
        <![CDATA[
DELETE FROM COM_BASE_PURCHASE_RANGE T WHERE T.RANGE_ID = '#RANGE_ID#'
        ]]>
    </query>
</queryMap>