<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="取样要求表功能">
	<query id="CoreComMSCSample.QUERY" desc="取样要求查询">
		<![CDATA[
		SELECT MSC,
       XH,
       MIN_D,
       MAX_D,
       MIN_H,
       MAX_H,
       LENGTH,
       DESC_LENGTH,
       RATE,
       DESC_RATE,
       DESC_COUNT,
       POSITION,
       DESC_POSITION,
       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','有效','无效') VALIDFLAGNAME,
       MEMO
  FROM COM_MSC_SAMPLE
        WHERE MSC=? AND VALIDFLAG in ('1' , ?)
        ORDER BY XH 
		]]>
	</query>
	
	
   <query id="CoreComMSCSample.ADD" desc="取样要求增加">
		<![CDATA[
			INSERT INTO COM_MSC_SAMPLE
  (MSC,
   XH,
   MIN_D,
   MAX_D,
   MIN_H,
   MAX_H,
   LENGTH,
   DESC_LENGTH,
   RATE,
   DESC_RATE,
   DESC_COUNT,
   POSITION,
   DESC_POSITION,
   CREATE_NAME,
   CREATE_TIME,
   VALIDFLAG,
   MEMO)
 VALUES(?,?,?,?,?, ?,?,?,?,?,?,?,?,?,to_date(?, 'yyyy-mm-dd hh24:mi:ss'),DEFAULT,?)
		]]>
	</query>
	
	<query id="CoreComMSCSample.UPDATE" desc="取样要求修改">
		<![CDATA[
   UPDATE COM_MSC_SAMPLE
   SET MSC           = ?,
       XH            = ?,
       MIN_D         = ?,
       MAX_D         = ?,
       MIN_H         = ?,
       MAX_H         = ?,
       LENGTH        = ?,
       DESC_LENGTH   = ?,
       RATE          = ?,
       DESC_RATE     = ?,
       DESC_COUNT    = ?,
       POSITION      = ?,
       DESC_POSITION = ?,
       UPDATE_NAME   = ?,
       UPDATE_TIME   = to_date(?, 'yyyy-mm-dd hh24:mi:ss'),
       MEMO          = ?
 WHERE MSC = ?
   AND XH = ?
		]]>
	</query>
	
    <query id="CoreComMSCSample.DELETE" desc="取样要求删除">
		<![CDATA[
			UPDATE COM_MSC_SAMPLE 
			SET VALIDFLAG=?,DELETE_NAME=?,DELETE_TIME=to_date(?, 'yyyy-mm-dd hh24:mi:ss')
			WHERE MSC=? AND XH=?
		]]>
	</query>
	
	<query id="CoreComMSCSample.RESUME" desc="取样要求恢复">
		<![CDATA[
			UPDATE COM_MSC_SAMPLE 
			SET VALIDFLAG=?,DELETE_NAME=?,DELETE_TIME=?
			WHERE MSC=? AND XH=?
		]]>
	</query>

   <query id="CoreComMSCSample.GETMAXXH" desc="取样要求最大序号">
		<![CDATA[		
        SELECT XH
        FROM COM_MSC_SAMPLE
        WHERE XH = (SELECT MAX(XH) XH FROM COM_MSC_SAMPLE WHERE MSC = ?)
		]]>
	</query>
</queryMap>