<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc = "轧管工序点工艺项配置">
<query id = "FrmMilCraftworkBase.queryCrafBase" desc = "查询工艺">
<![CDATA[
SELECT T.FACTOR_ID,
       T.FACTOR_NAME,
       T.TABLE_NAME,
       T.COLUMN_KEY,
       T.COLUMN_TYPE,
       T.CREATE_NAME,
       DECODE(T.VALIDFLAG,'1','是','0','否') VALIDFLAG,
       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.STATION_CODE     
  FROM MIL_CRAFTWORK_BASE T
 WHERE 1=1 
]]>
</query>
<query id = "FrmMilCraftworkBase.queryTbleName" desc = "查询数据表名">
<![CDATA[
SELECT T.TABLE_NAME,T.COMMENTS FROM USER_TAB_COMMENTS T WHERE T.TABLE_NAME LIKE '%MIL%'  AND T.TABLE_NAME LIKE '%RESULT%' ORDER BY T.TABLE_NAME
]]>
</query>
<query id = "FrmMilCraftworkBase.queryTableColumnName" desc = "查询表字段名">
<![CDATA[
SELECT T.COLUMN_NAME, T1.COMMENTS, T.DATA_TYPE
  FROM USER_TAB_COLUMNS T, USER_COL_COMMENTS T1
 WHERE T.TABLE_NAME = T1.TABLE_NAME
   AND T.COLUMN_NAME = T1.COLUMN_NAME
   AND T.TABLE_NAME = ?
 ORDER BY T.COLUMN_ID
]]>
</query>
<query id = "FrmMilCraftworkBase.queryTableColumecomments" desc = "查询表字段备注">
<![CDATA[
SELECT T.COMMENTS FROM USER_COL_COMMENTS  T WHERE T.TABLE_NAME=? AND T.COLUMN_NAME=?
]]>
</query>
<query id = "FrmMilCraftworkBase.queryTableDataType" desc = "查询表字段类型">
<![CDATA[
SELECT DECODE(T.DATA_TYPE,'NUMBER','D','DATE','T','C') DATA_TYPE FROM USER_TAB_COLUMNS T 
WHERE T.TABLE_NAME =? 
 AND  T.COLUMN_NAME=?
ORDER BY T.COLUMN_ID 
]]>
</query>
<query id = "FrmMilCraftworkBase.addCrafBase" desc = "新增">
<![CDATA[
INSERT INTO MIL_CRAFTWORK_BASE
  (FACTOR_ID, FACTOR_NAME, TABLE_NAME, COLUMN_KEY, COLUMN_TYPE, CREATE_NAME, CREATE_TIME,STATION_CODE)
VALUES
  (?, ?, ?, ?, ?, ?, TO_DATE(?,'YYYY-MM-DD HH24:MI:SS'),?)
]]>
</query>
<query id = "FrmMilCraftworkBase.queryCrafBaseMaxId" desc = "查询最大id">
<![CDATA[
 SELECT ? ||
        LPAD(SUBSTR(NVL(MAX(T.FACTOR_ID), '000000'), -6, 6) + 1, 6, '0') AS FACTOR_ID
   FROM MIL_CRAFTWORK_BASE T
]]>
</query>
<query id = "FrmMilCraftworkBase.updateCrafBase" desc = "修改">
<![CDATA[
UPDATE MIL_CRAFTWORK_BASE
   SET FACTOR_NAME = ?,
       TABLE_NAME  = ?,
       COLUMN_KEY  = ?,
       COLUMN_TYPE = ?,    
       UPDATE_NAME = ?,
       UPDATE_TIME = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'),
       STATION_CODE=?
 WHERE FACTOR_ID = ?
]]>
</query>
<query id = "FrmMilCraftworkBase.deleteCrafBase" desc = "删除">
<![CDATA[
DELETE MIL_CRAFTWORK_BASE WHERE FACTOR_ID = ?
]]>
</query>
<query id = "FrmMilCraftworkBase.updateValCrafBase" desc = "作废">
<![CDATA[
UPDATE MIL_CRAFTWORK_BASE SET VALIDFLAG = '0' WHERE FACTOR_ID = ?
]]>
</query>
<query id = "FrmMilCraftworkBase.queryCrafSet" desc = "是否引用">
<![CDATA[
SELECT T.FACTOR_ID FROM MIL_CRAFTWORK_SET T WHERE T.FACTOR_ID=? AND T.VALIDFLAG='1'
]]>
</query>
</queryMap>