<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="合同行锁定数据">
	<query id="SlmOrderLineLockDAL.query" desc="查询合同行">
		<![CDATA[
		 SELECT
			   T.ORD_LN_PK,
			   T.ORDER_NO_SEQ,
			   DECODE(T.LOCK_TYPE,'0','提报锁定','') LOCK_TYPE,
			   DECODE(T.IS_LOCK,'0','未锁定','1','已锁定') IS_LOCK,
			   T.LOCK_NAME,
			   TO_CHAR(T.LOCK_DATE, 'YYYY-MM-DD HH24:MI:SS') LOCK_DATE,
			   T.LOCK_REASON,
			   T.UN_LOCK_NAME,
			   TO_CHAR(T.UN_LOCK_DATE, 'YYYY-MM-DD HH24:MI:SS') UN_LOCK_DATE,
			   T.UN_LOCK_REASON
		 FROM SLM_ORDER_LINE_LOCK T
		 WHERE
			1 = 1 AND IS_LOCK = '1'
		]]>
	</query>

	<query id="SlmOrderLineLockDAL.GetOrderLineLock" desc="合同行是否锁定">
		<![CDATA[
	  		SELECT IS_LOCK FROM SLM_ORDER_LINE_LOCK T WHERE  T.ORD_LN_PK = ? AND T.IS_LOCK = '1'
		]]>
	</query>

	<query id="SlmOrderLineLockDAL.insert" desc="新增合同行">
		<![CDATA[
		 INSERT INTO SLM_ORDER_LINE_LOCK(
				ORD_LN_PK,
				ORDER_NO_SEQ,
				LOCK_TYPE,
				IS_LOCK,
				LOCK_NAME,
				LOCK_DATE,
				LOCK_REASON,
				UN_LOCK_NAME,
				UN_LOCK_DATE,
				UN_LOCK_REASON)
		 VALUES(
				'#ORD_LN_PK#',
				'#ORDER_NO_SEQ#',
				'#LOCK_TYPE#',
				'#IS_LOCK#',
				'#LOCK_NAME#',
				SYSDATE,
				'#LOCK_REASON#',
				'#UN_LOCK_NAME#',
				SYSDATE,
				'#UN_LOCK_REASON#')
		]]>
	</query>

	<query id="SlmOrderLineLockDAL.lock" desc="锁定合同行">
		<![CDATA[
			 UPDATE SLM_ORDER_LINE_LOCK T
			   SET
					T.IS_LOCK = '1',
					T.LOCK_NAME = '#LOCK_NAME#',
					T.LOCK_DATE = SYSDATE,
					T.LOCK_REASON = '#LOCK_REASON#'
			 WHERE
			T.ORD_LN_PK = '#ORD_LN_PK#'
		]]>
	</query>

	<query id="SlmOrderLineLockDAL.unLock" desc="解锁合同行">
		<![CDATA[
			 UPDATE SLM_ORDER_LINE_LOCK T
			   SET
					T.IS_LOCK = '0',
					T.UN_LOCK_NAME = '#UN_LOCK_NAME#',
					T.UN_LOCK_DATE = SYSDATE,
					T.UN_LOCK_REASON = '#UN_LOCK_REASON#'
			 WHERE
			T.ORD_LN_PK = '#ORD_LN_PK#'
		]]>
	</query>
</queryMap>