<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	
	<query id="CoreProcessParameters.GetMaxCode" desc="获取工艺参数代码最大值">
		<![CDATA[
			select max(CRAFT_CODE) from COM_BASE_CRAFT
		]]>
	</query>

	<query id="CoreProcessParameters.GetType" desc="绑定工艺参数类别">
		<![CDATA[
			select basecode,basename from com_base_info 
			where sortcode='4031' AND VALIDFLAG='1'
		]]>
	</query>

	<query id="CoreProcessParameters.GetName" desc="判断名称是否存在">
		<![CDATA[
			select CRAFTITEM_DESC from COM_BASE_CRAFT where CRAFTITEM_DESC=?
		]]>
	</query>
	<query id="CoreProcessParameters.QUERY" desc="查询">
		<![CDATA[
SELECT T.CRAFT_CODE,
       T.CRAFTITEM_DESC,
       T.CRAFTITEM_TYPE,
       T.CRAFTITEM_LV,
       decode(T.CRAFTITEM_LV, 'A', '一级', '二级') CRAFTITEM_LVNAME,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,
       T.UPDATE_NAME,
       TO_CHAR(T.UPDATE_TIME, 'yyyy-mm-dd hh24:mi:ss') UPDATE_TIME,
       T.DELETE_NAME,
       TO_CHAR(T.DELETE_TIME, 'yyyy-mm-dd hh24:mi:ss') DELETE_TIME,
       T.VALIDFLAG,
       decode(T.VALIDFLAG, '1', '有效', '无效') VALIDFLAGNAME,
       T.MEMO,
       T.PROCESS_CODE,
       A.PROCESS_DESC
  FROM COM_BASE_CRAFT T
  LEFT JOIN COM_BASE_PROCESS A
  ON A.PROCESS_CODE = T.PROCESS_CODE
 WHERE T.VALIDFLAG in ('1', ?)
   AND lower(T.CRAFTITEM_DESC) || '&' LIKE '%' || lower(?) || '%'
 ORDER BY T.CRAFT_CODE
		]]>
	</query>
	<query id="CoreProcessParameters.ADD" desc="新增">
		<![CDATA[
			 INSERT INTO COM_BASE_CRAFT
							(CRAFT_CODE,
					        CRAFTITEM_DESC,
					        CRAFTITEM_TYPE,
							CRAFTITEM_LV,
					        CREATE_NAME,
					        CREATE_TIME,
					        VALIDFLAG,
					        MEMO,
					        PROCESS_CODE)
							VALUES(?,?,?,?,
							?,SYSDATE,
							'1',?, ?)
							
			  
		]]>
	</query>
	<query id="CoreProcessParameters.MODIFY" desc="修改">
		<![CDATA[
			 UPDATE COM_BASE_CRAFT set
							CRAFTITEM_DESC=?, 
							CRAFTITEM_TYPE=?, 
							CRAFTITEM_LV=?, 
							UPDATE_NAME=?, 
							UPDATE_TIME=SYSDATE,
							MEMO=?,
							PROCESS_CODE = ?
							WHERE CRAFT_CODE=?
		]]>
	</query>
	<query id="CoreProcessParameters.DELETE" desc="作废">
		<![CDATA[
			 UPDATE COM_BASE_CRAFT T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.CRAFT_CODE = ?
		]]>
	</query>
	
	<query id="CoreProcessParameters.RESUME" desc="恢复">
		<![CDATA[
			UPDATE COM_BASE_CRAFT T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.CRAFT_CODE = ?
		]]>
	</query>
</queryMap>