<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="COM_BASE_CCM （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="ComBaseCcmDAL.Query" desc="查询">
        <![CDATA[
SELECT T.CCM_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.DIAMETER,
       T.WATER_NO,
       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,
       T.GRADECODE,
       T.GRADENAME,
       T.CIC,
       T.COOLING_VAL,
       T.TEP_VAL,
       T.STD_CODE_NK,
       T.STD_NAME_NK
  FROM COM_BASE_CCM T
 WHERE 1 = 1
        ]]>
    </query>
    <query id="ComBaseCcmDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.CCM_CODE,
       T.PLINE_CODE,
       T.PLINE_NAME,
       T.DIAMETER,
       T.WATER_NO
 FROM COM_BASE_CCM T
 WHERE
       T.CCM_CODE = '#CCM_CODE#'
        ]]>
    </query>
    <query id="ComBaseCcmDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO COM_BASE_CCM
  (CCM_CODE,
   PLINE_CODE,
   PLINE_NAME,
   DIAMETER,
   WATER_NO,
   CREATE_NAME,
   CREATE_TIME,
   GRADECODE,
   GRADENAME,
   CIC,
   COOLING_VAL,
   TEP_VAL,
   STD_CODE_NK,
   STD_NAME_NK)
VALUES
  ('#CCM_CODE#',
   '#PLINE_CODE#',
   '#PLINE_NAME#',
   '#DIAMETER#',
   '#WATER_NO#',
   '#CREATE_NAME#',
   SYSDATE,
   '#GRADECODE#',
   '#GRADENAME#',
   '#CIC#',
   '#COOLING_VAL#',
   '#TEP_VAL#',
   '#STD_CODE_NK#',
   '#STD_NAME_NK#')
        ]]>
    </query>
    <query id="ComBaseCcmDAL.Update" desc="修改">
        <![CDATA[
UPDATE COM_BASE_CCM T
   SET T.PLINE_CODE  = '#PLINE_CODE#',
       T.PLINE_NAME  = '#PLINE_NAME#',
       T.DIAMETER    = '#DIAMETER#',
       T.WATER_NO    = '#WATER_NO#',
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE,
       T.GRADECODE = '#GRADECODE#',
       T.GRADENAME = '#GRADENAME#',
       T.CIC = '#CIC#',
       T.COOLING_VAL = '#COOLING_VAL#',
       T.TEP_VAL = '#TEP_VAL#',
       T.STD_CODE_NK = '#STD_CODE_NK#',
       T.STD_NAME_NK = '#STD_NAME_NK#'
 WHERE T.CCM_CODE = '#CCM_CODE#'
        ]]>
    </query>
    <query id="ComBaseCcmDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT 'CCM' || LPAD(NVL(SUBSTR(MAX(CCM_CODE), '4'), 0) + 1, 2, '0') MAX_VALUE
  FROM COM_BASE_CCM T
        ]]>
    </query>
    <query id="ComBaseCcmDAL.Delete" desc="作废">
        <![CDATA[
UPDATE COM_BASE_CCM T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.CCM_CODE = '#CCM_CODE#'
        ]]>
    </query>
    <query id="ComBaseCcmDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE COM_BASE_CCM T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.CCM_CODE = '#CCM_CODE#'
        ]]>
    </query>
    <query id="ComBaseCcmDAL.GetPline" desc="获取产线基础数据">
        <![CDATA[
 SELECT T.PLINE_CODE, T.PLINE_NAME
   FROM COM_BASE_PLINE T
  WHERE T.PROCESS_CODE = 'B'
    AND T.PLINE_NAME NOT LIKE '%外购%'
        ]]>
    </query>
    <query id="ComBaseCcmDAL.Exists" desc="是否存在重复数据">
        <![CDATA[
SELECT COUNT(1)
   FROM COM_BASE_CCM T
  WHERE T.PLINE_CODE = {0}
    AND T.DIAMETER = {1}
    AND T.WATER_NO = {2}
    AND NVL(T.GRADECODE, '1') = NVL({3}, '1')
    AND NVL(T.CIC, '1') = NVL({4}, '1')
        ]]>
    </query>
    <query id="ComBaseCcmDAL.getNkCic" desc="获取内控成分索引码">
        <![CDATA[
SELECT T.STD_CODE_NK, T.STD_NAME_NK, T.GRADECODE, T.GRADENAME, T.CIC
  FROM COM_MSC_STD_CIC T
 WHERE T.STDSTYLE = 'N'
   AND T.VALIDFLAG = '1'
   AND T.STD_CODE_NK IN ('STD0000860', 'STD0001096')
        ]]>
    </query>
</queryMap>