<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="下拉框动态数据获取管理">
	 

	<query id="CoreRackDefine.Add" desc="新增">
		<![CDATA[
			 INSERT INTO YDM_BS_RACK
    (RACK_NO,
     RACK_TYPE,
     BASE_WIDTH,
     BASE_HEIGHT,
     RACK_WIDTH,
     RACK_HEIGHT,
     RACK_LEN,
     RACK_RL,
     HL_MANAGEMENT_NO,
     HL_MANAGEMENT_NAME,
     MEMO,
     CREATE_NAME,
     CREATE_TIME
     )
    VALUES
   ((SELECT ?||(LPAD((NVL(MAX(SUBSTR(RACK_NO,2,5)),'00000')+1),5,'0')) FROM YDM_BS_RACK),
    ?,?,?,?,?,?,?,?,?,?,?,SYSDATE)
 
			 
		]]>
	</query>
	
	<query id="CoreRackDefine.Query" desc="查询">
		<![CDATA[
	 SELECT RACK_NO,
       RACK_TYPE,
       BASE_WIDTH,
       BASE_HEIGHT,
       RACK_WIDTH,
       RACK_HEIGHT,
       RACK_LEN,
       DECODE(TRIM(RACK_RL),'R','右侧','L','左侧','两侧') RACK_RL,
       HL_MANAGEMENT_NO,
       HL_MANAGEMENT_NAME,
       DECODE(TRIM(USE_FLAG),'1','使用','未使用') USE_FLAG,
       MEMO,
       DECODE(TRIM(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,
       DELETE_NAME,
       TO_CHAR(DELETE_TIME,'YYYY-MM-DD HH24:MI:SS') DELETE_TIME
      FROM YDM_BS_RACK
      WHERE  DECODE(?,NULL,'1',HL_MANAGEMENT_NAME) = DECODE(?,NULL,'1',?)
      AND '&'||RACK_TYPE LIKE '&'||?
      AND VALIDFLAG IN('1',?)
		 
		]]>
	</query>
	
	<query id="CoreRackDefine.Update" desc="修改">
		<![CDATA[
	    UPDATE YDM_BS_RACK
        SET  
      
        RACK_TYPE          = ?,
        BASE_WIDTH         = ?,
        BASE_HEIGHT        = ?,
        RACK_WIDTH         = ?,
        RACK_HEIGHT        = ?,
        RACK_LEN           = ?,
        RACK_RL            = ?,
        HL_MANAGEMENT_NO   = ?,
        HL_MANAGEMENT_NAME = ?,
        MEMO               = ?,
        UPDATE_NAME        = ?,
        UPDATE_TIME        = SYSDATE ,
        RACK_NO            = ?
       WHERE RACK_NO = ? AND VALIDFLAG='1'
 
		]]>
	</query>
	 
	 <query id="CoreRackDefine.Delete" desc="作废">
		<![CDATA[
	    UPDATE YDM_BS_RACK
        SET  
        DELETE_NAME        = ?,
        DELETE_TIME        = SYSDATE,
        VALIDFLAG          ='0'
       WHERE RACK_NO = ? AND VALIDFLAG='1'
 
		]]>
	</query>
	
	 <query id="CoreRackDefine.Resume" desc="恢复">
		<![CDATA[
	    UPDATE YDM_BS_RACK
        SET  
        DELETE_NAME        = '',
        DELETE_TIME        = '',
        VALIDFLAG          ='1'
       WHERE RACK_NO = ? AND VALIDFLAG='0'
 
		]]>
	</query>
	 
	  <query id = "CoreRackDefine.doQueryData" desc = "查询料架所属单位">
	 SELECT T.DEPARTNAME,T.DEPARTID FROM CORE_APP_DEPARTMENT T WHERE T.DEPTTYPE = '2' and 1 = ?
	 </query>
	 <query id = "CoreRackDefine.getReferRack" desc = "查询料架最新信息">
	 SELECT VALIDFLAG,USE_FLAG
        FROM YDM_BS_RACK T WHERE T.RACK_NO = ?
	 </query>
</queryMap>