<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="org.springblade.modules.basinSation.mapper.BasinStationMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="basinStationResultMap" type="org.springblade.modules.basinSation.entity.BasinStation">
|
<id column="BASIN_STATION_ID" property="basinStationId"/>
|
<result column="STATION_CODE" property="stationCode"/>
|
<result column="STATION_NAME" property="stationName"/>
|
<result column="BASIN_CODE" property="basinCode"/>
|
<result column="WEIGHT" property="weight"/>
|
<result column="SPARE1" property="spare1"/>
|
<result column="SPARE2" property="spare2"/>
|
<result column="SPARE3" property="spare3"/>
|
</resultMap>
|
|
<resultMap id="treeNodeResulTMap" type="org.springblade.core.tool.node.TreeNode">
|
<id column="id" property="id"/>
|
<result column="parent_id" property="parentId"/>
|
<result column="title" property="title"/>
|
<result column="value" property="value"/>
|
<result column="key" property="key"/>
|
<result column="has_children" property="hasChildren"/>
|
</resultMap>
|
|
<select id="selectBasinStationPage" resultMap="basinStationResultMap">
|
select * from ZHSW_BASIN_STATION where 1=1
|
<if test="deptId!=null and deptId != ''">
|
and STATION_CODE = #{deptId}
|
</if>
|
<if test="parentId!=null and parentId != ''">
|
and BASIN_CODE = #{parentId}
|
</if>
|
</select>
|
|
<select id="selectBasins" resultMap="basinStationResultMap">
|
select * from ZHSW_BASIN_STATION where 1=1
|
<if test="deptId!=null and deptId != ''">
|
and BASIN_CODE = #{deptId}
|
</if>
|
</select>
|
|
<select id="lazyTree" resultMap="treeNodeResulTMap">
|
SELECT
|
dept.STATION_CODE AS id,
|
dept.BASIN_CODE AS parent_id,
|
dept.STATION_NAME AS title,
|
dept.STATION_CODE AS "value",
|
dept.STATION_CODE AS "key",
|
( SELECT CASE WHEN COUNT ( 1 ) > 0 THEN 1 ELSE 0 END FROM ZHSW_BASIN_STATION WHERE BASIN_CODE = dept.STATION_CODE ) AS "has_children"
|
FROM
|
ZHSW_BASIN_STATION dept WHERE dept.BASIN_CODE=#{code}
|
</select>
|
</mapper>
|