<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="到站基础信息维护"> 
	<query id="CoreStation.doQuerySlmBaseSta" desc="查询所属铁路局下拉列表">
		<![CDATA[
			SELECT BASECODE rawy_buru ,BASENAME station_nm FROM com_base_info where SORTCODE = '1104' order by BASECODE
		]]>
	</query>  
	<query id="CoreStation.doQuerySave" desc="查询到站信息数据重复">
		<![CDATA[
			SELECT STATION_NO from SLM_BASE_STATION where STATION_NM = ?
		]]>
	</query>  
	<query id="CoreStation.toAdd" desc="新增">
		<![CDATA[
			INSERT INTO slm_base_station
            (station_no,
             station_nm, region_no, distance, freight, telegrp_no, rawy_buru,
             memo, create_name, create_time
            )
		    VALUES ((SELECT DECODE (MAX (station_no),
		                             '', ? || '001',
		                             MAX (station_no) + 1
		                            ) station_no
		                FROM slm_base_station
		               WHERE station_no like ?||'%'),
		             ?, ?, ?, ?, ?, ?,
		             ?, ?, sysdate
		            )
		]]>
	</query> 
	<query id="CoreStation.doUpdate" desc="更新数据">
		<![CDATA[
			UPDATE slm_base_station
				   SET station_nm = ?,
				       region_no = ?,
				       distance = ?,
				       freight = ?,
				       telegrp_no = ?,
				       rawy_buru = ?,
				       memo = ?,
				       UPDATE_NAME=?,
				       UPDATE_TIME=sysdate
				 WHERE station_no = ?
		]]>
	</query>  
	<query id="CoreStation.doDelete" desc="作废">
		<![CDATA[
			UPDATE slm_base_station
				   SET VALIDFLAG = ?,
				   	   DELETE_NAME = ?,
				   	   DELETE_TIME = sysdate
				 WHERE station_no = ?
		]]>
	</query> 
	<query id="CoreStation.doRecovery" desc="恢复">
		<![CDATA[
			UPDATE slm_base_station
				   SET VALIDFLAG = ?
				 WHERE station_no = ?
		]]>
	</query> 
	<query id="CoreStation.GetRegionTree" desc="查询树形结构">
		<![CDATA[
			SELECT   sel.region_no, st.region_type_nm || '  ' || sel.region_nm region_nm,
			         sel.p_region_no, st.region_lvl_no,
			         (SELECT region_nm
			            FROM sel_admin_region
			           WHERE region_no = sel.p_region_no) region_lvl_nm, sel.bigarea
			    FROM sel_admin_region sel LEFT JOIN sel_admin_region_t st
			         ON sel.region_type = st.region_type_no
			ORDER BY region_no
		]]>
	</query> 
	<query id="CoreOrderUnit.GetColumnComments" desc="查询指定表名的列名和注释的集合">
		<![CDATA[select COLUMN_NAME,COMMENTS from user_col_comments where table_name = ?]]>
	</query>
</queryMap>