<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	
	<query id="CoreBuckleType.GetKType" desc="获取扣型分类">
		<![CDATA[
			select BASECODE,BASENAME from com_base_info
			 where sortcode='4051' AND  VALIDFLAG='1'
			 ORDER BY BASECODE
		]]>
	</query>
	
	<query id="CoreBuckleType.GetMaxCode" desc="获取扣型代码最大值">
		<![CDATA[
			select max(MODEL_CODE) from COM_BASE_MODEL
		]]>
	</query>

	<query id="CoreBuckleType.GetName" desc="判断名称是否存在">
		<![CDATA[
			select MODEL_DESC from COM_BASE_MODEL where MODEL_DESC=?
		]]>
	</query>
	<query id="CoreBuckleType.QUERY" desc="权限功能">
		<![CDATA[
			SELECT  MODEL_CODE,
				    MODEL_DESC,
				    MODEL_STYLE,
					MODEL_STYLE_DESC,
					HAVEJG,
					decode(HAVEJG,'1','是','否') HAVEJGNAME,
					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,
					E_MATERIAL_CODE,
					IS_TP,
					DECODE(IS_TP, '1', '是', '否') IS_TP_DESC
				FROM COM_BASE_MODEL
				   WHERE VALIDFLAG in ('1' , ?)
				   AND lower(MODEL_DESC)||'&' LIKE '%' || lower(?) || '%'  
				ORDER BY MODEL_CODE
		]]>
	</query>
	<query id="CoreBuckleType.ADD" desc="新增">
		<![CDATA[
			 INSERT INTO COM_BASE_MODEL
							(MODEL_CODE,
					        MODEL_DESC,
					        MODEL_STYLE,
							MODEL_STYLE_DESC,
					        HAVEJG,
					        CREATE_NAME,
					        CREATE_TIME,
					        VALIDFLAG,
					        MEMO,
					        E_MATERIAL_CODE,
					        IS_TP)
							VALUES(?,?,?,?,?,
							?,SYSDATE,
							'1',?, ?, ?)
							
			  
		]]>
	</query>
	<query id="CoreBuckleType.MODIFY" desc="修改">
		<![CDATA[
			 UPDATE COM_BASE_MODEL set
				MODEL_DESC=?, 
				MODEL_STYLE=?, 
				MODEL_STYLE_DESC=?, 
				HAVEJG=?,
				UPDATE_NAME=?, 
				UPDATE_TIME=SYSDATE,
				MEMO=?,
				E_MATERIAL_CODE = ?,
				IS_TP = ?
				WHERE MODEL_CODE=?
		]]>
	</query>
	<query id="CoreBuckleType.DELETE" desc="作废">
		<![CDATA[
			 UPDATE COM_BASE_MODEL T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.MODEL_CODE = ?
		]]>
	</query>
	
	<query id="CoreBuckleType.RESUME" desc="恢复">
		<![CDATA[
			UPDATE COM_BASE_MODEL T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.MODEL_CODE = ?
		]]>
	</query>
</queryMap>