<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="CoreResBaseResourceAllocation.QUERY" desc="权限功能">
		<![CDATA[
	   SELECT 
       SALE_ORG,
       SALE_ORG SALE_ORG_OLD,
       SALE_ORG_DESC,
       PROCESS_CODE,
       PROCESS_CODE PROCESS_CODE_OLD,
       PROCESS_DESC,
       YEAR,
       YEAR YEAR_OLD,
       MONTH_1,
       MONTH_2,
       MONTH_3,
       MONTH_4,
       MONTH_5,
       MONTH_6,
       MONTH_7,
       MONTH_8,
       MONTH_9,
       MONTH_10,
       MONTH_11,
       MONTH_12,
       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,
       DECODE(VALIDFLAG,'1','有效','无效') VALIDFLAG,
       MEMO
       FROM RES_BASE_RESOURCE_ALLOCATION
       WHERE  VALIDFLAG IN('1',?)
		]]>
	</query>
	
	<query id="CoreResBaseResourceAllocation.GetSaleOrg" desc="新增">
		<![CDATA[
			  SELECT BASECODE,BASENAME
			  FROM COM_BASE_INFO T
			  WHERE T.SORTCODE ='1001'
			  AND T.VALIDFLAG ='1'
			  
		]]>
	</query>
	<query id="CoreResBaseResourceAllocation.GetProcess" desc="修改">
		<![CDATA[
			 SELECT 
			 PROCESS_CODE,PROCESS_DESC
			 FROM COM_BASE_PROCESS T
			 WHERE T.VALIDFLAG = '1'
		]]>
	</query>
	<query id="CoreResBaseResourceAllocation.INSERT" desc="作废">
		<![CDATA[
			 INSERT INTO RES_BASE_RESOURCE_ALLOCATION
       (SALE_ORG,
       SALE_ORG_DESC,
       PROCESS_CODE,
       PROCESS_DESC,
       YEAR,
       MONTH_1,
       MONTH_2,
       MONTH_3,
       MONTH_4,
       MONTH_5,
       MONTH_6,
       MONTH_7,
       MONTH_8,
       MONTH_9,
       MONTH_10,
       MONTH_11,
       MONTH_12,
       CREATE_NAME,
       CREATE_TIME,
       MEMO)
       VALUES
       (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE,? )
			 
		]]>
	</query>
	
	<query id="CoreResBaseResourceAllocation.UPDATE" desc="恢复">
		<![CDATA[
			  UPDATE RES_BASE_RESOURCE_ALLOCATION
   SET SALE_ORG      = ?,
       SALE_ORG_DESC = ?,
       PROCESS_CODE  = ?,
       PROCESS_DESC  = ?,
       YEAR          = ?,
       MONTH_1       = ?,
       MONTH_2       = ?,
       MONTH_3       = ?,
       MONTH_4       = ?,
       MONTH_5       = ?,
       MONTH_6       = ?,
       MONTH_7       = ?,
       MONTH_8       = ?,
       MONTH_9       = ?,
       MONTH_10      = ?,
       MONTH_11      = ?,
       MONTH_12      = ?,
       UPDATE_NAME   = ?,
       UPDATE_TIME   = SYSDATE,
       MEMO          = ?
     WHERE SALE_ORG = ?
   AND PROCESS_CODE = ?
   AND YEAR = ?
			  
		]]>
	</query>
	
	<query id="CoreResBaseResourceAllocation.DELETE" desc="获取一级工序最大编码">
		<![CDATA[
			  UPDATE RES_BASE_RESOURCE_ALLOCATION
			  SET VALIDFLAG = '0',
			  DELETE_NAME = ?,
			  DELETE_TIME = SYSDATE
			  WHERE SALE_ORG = ?
              AND PROCESS_CODE = ?
              AND YEAR = ?
              AND VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="CoreResBaseResourceAllocation.RESUME" desc="获取二级工序与一级工序关系">
		<![CDATA[
			  UPDATE RES_BASE_RESOURCE_ALLOCATION
			  SET VALIDFLAG = '1',
			  DELETE_NAME = '',
			  DELETE_TIME = ''
			  WHERE SALE_ORG = ?
              AND PROCESS_CODE = ?
              AND YEAR = ?
              AND VALIDFLAG = '0'
		]]>
	</query>
	
	<query id="CoreResBaseResourceAllocation.ISREAPT" desc="获取二级工序与一级工序关系">
		<![CDATA[
			  SELECT 1
			  FROM  RES_BASE_RESOURCE_ALLOCATION
			  WHERE SALE_ORG = ?
              AND PROCESS_CODE = ?
              AND YEAR = ?
          
		]]>
	</query>
	
</queryMap>