<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="生产产线基础信息管理">




	<query id="CoreBaseInfoNew.isAddChild" desc="判断是否允许增加子项">
		<![CDATA[
			select FLAG from com_base_info where BASECODE=?
		]]>
	</query>
	<query id="CoreBaseInfoNew.GetName" desc="判断名称是否存在">
		<![CDATA[
			select BASENAME from com_base_info where SORTCODE=? and BASENAME=?
		]]>
	</query>
	<query id="CoreBaseInfoNew.GetMaxBaseCode" desc="获取当前父节点下，最大编号">
		<![CDATA[
			select max(basecode) from com_base_info where sortcode=?
		]]>
	</query>
	<query id="CoreBaseInfoNew.QUERY" desc="产线基础信息查询">
		<![CDATA[
			SELECT 'FALSE' CHK,
			       BASECODE,
			       BASENAME,
			       SORTCODE,
			       ISVISIBLE,
			       MNEMONIC_CODE,
			       SEQ,
			       FLAG,
			       decode(FLAG,'1','是','否') FLAGNAME,
			       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,
			       DEPT,
			       PROPERA,
			       PROPERB,
			       STANDARD
			  FROM COM_BASE_INFO
			 WHERE SORTCODE=?   AND VALIDFLAG='1'
			 order by BASECODE
		]]>
	</query>
	<query id="CoreBaseInfoNew.ADD" desc="基础信息新增">
        <![CDATA[
            INSERT INTO COM_BASE_INFO
						  (BASECODE,
						   BASENAME,
						   SORTCODE,
						   MNEMONIC_CODE,
						   FLAG,
						   CREATE_NAME,
						   SEQ,
						   CREATE_TIME,
						   VALIDFLAG,
						   MEMO,
						   PROPERA,
						   PROPERB,
						   DEPT,
						   STANDARD)
						VALUES
						  (?, ?, ?, ?, ?,?,(select max(seq) from com_base_info)+1, SYSDATE, '1', ?,?,?,?,?)
        ]]>
	</query>
	<query id="CoreBaseInfoNew.MODIFY" desc="基础信息修改">
        <![CDATA[
            UPDATE COM_BASE_INFO T
			   SET T.BASENAME      = ?,
			       T.MNEMONIC_CODE=?,
			       T.FLAG=?,
			       T.UPDATE_NAME     = ?,
			       T.UPDATE_TIME     = SYSDATE,
			       T.MEMO            = ?,
			       T.PROPERA            = ?,
			       T.PROPERB            = ?,
			       T.DEPT            = ?,
			       t.STANDARD		 = ?
			 WHERE T.BASECODE = ?
        ]]>
	</query>
	
	
	
	
	
	<query id="CoreBaseInfoNew.DELETE" desc="基础信息删除">
        <![CDATA[
            UPDATE COM_BASE_INFO T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = SYSDATE, T.VALIDFLAG = '0'
			 WHERE T.BASECODE = ?
        ]]>
	</query>
	<query id="CoreBaseInfoNew.RESUME" desc="基础信息恢复">
        <![CDATA[
            UPDATE COM_BASE_INFO T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.BASECODE = ?
        ]]>
	</query>

	<query id="CoreBaseInfoNew.TreeData" desc="获取树形结构数据。">
		<![CDATA[
			  SELECT BASECODE,
			         BASENAME,
             		 SORTCODE
			        FROM COM_BASE_INFO WHERE 1=1
			        AND VALIDFLAG = '1'
			        AND substr(BASECODE,0,1) in (?,?,?,?,?,?,?,?,?) order by BASECODE


		]]>
	</query>



	<query id="CoreBaseInfoNew.TreeDataNew" desc="获取树形结构数据。">
		<![CDATA[
   SELECT BASECODE, BASENAME, SORTCODE
        FROM COM_BASE_INFO
       WHERE 1 = 1
         AND VALIDFLAG = '1'


		]]>
	</query>
	
	<query id="CoreBaseInfoNew.IsExistValidChild" desc="是否包含有效子项">
		<![CDATA[
		SELECT COUNT(1)
	  FROM COM_BASE_INFO T
	 WHERE T.SORTCODE = ?
	   AND T.VALIDFLAG = '1'
		]]>
	</query>
	
	<query id="CoreBaseInfoNew.IsExistValidParent" desc="是否包含有效父项">
		<![CDATA[
		SELECT COUNT(1)
	  FROM COM_BASE_INFO T
	 WHERE T.BASECODE = ?
	   AND T.VALIDFLAG = '1'
		]]>
	</query>

</queryMap>