<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="CoreSteelGrade.GetMaxCode" desc="获取扣型代码最大值">
		<![CDATA[
			select 'C' || max(TO_NUMBER(REGEXP_SUBSTR(STEELCODE,'[0-9]+'))) from COM_BASE_STEEL
		]]>
	</query>
	
	<query id="CoreSteelGrade.IsLinkPSC" desc="是否关联PSC">
		<![CDATA[
			SELECT 1 FROM COM_PSC
			WHERE STEELCODE = ?
		]]>
	</query>
	

	<query id="CoreSteelGrade.GetName" desc="判断名称是否存在">
		<![CDATA[
			select STEELNAME from COM_BASE_STEEL where STEELNAME=?
		]]>
	</query>
	
	<query id="CoreSteelGrade.QUERY" desc="权限功能">
		<![CDATA[
			SELECT  STEELCODE,
				    STEELNAME,
				    STEELSTYLE,
				    decode(STEELSTYLE,'1','钢级','牌号') STEELSTYLENAME,
					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,
					VALIDFLAG,
					decode(VALIDFLAG,'1','有效','无效') VALIDFLAGNAME,
					MEMO,
					IS_TP,
					DECODE(IS_TP, '1', '是', '否') IS_TP_DESC
					FROM COM_BASE_STEEL
					   WHERE VALIDFLAG in ('1' , ?)
					   AND lower(STEELNAME)||'&' LIKE '%' || lower(?) || '%'  ORDER BY STEELCODE
		]]>
	</query>
	<query id="CoreSteelGrade.ADD" desc="新增">
		<![CDATA[
			 INSERT INTO COM_BASE_STEEL
							(STEELCODE,
					        STEELNAME,
					        STEELSTYLE,
					        CREATE_NAME,
					        CREATE_TIME,
					        VALIDFLAG,
					        MEMO,
					        IS_TP)
							VALUES(?,?,?,
							?,SYSDATE,
							'1',?, ?)
							
			  
		]]>
	</query>
	<query id="CoreSteelGrade.MODIFY" desc="修改">
		<![CDATA[
			 UPDATE COM_BASE_STEEL set
							STEELNAME=?, 
							STEELSTYLE=?, 
							UPDATE_NAME=?, 
							UPDATE_TIME=SYSDATE,
							MEMO=?,
							IS_TP=?
							WHERE STEELCODE=?
		]]>
	</query>
	<query id="CoreSteelGrade.DELETE" desc="作废">
		<![CDATA[
			 UPDATE COM_BASE_STEEL T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.STEELCODE = ?
		]]>
	</query>
	
	<query id="CoreSteelGrade.RESUME" desc="恢复">
		<![CDATA[
			UPDATE COM_BASE_STEEL T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.STEELCODE = ?
		]]>
	</query>
</queryMap>