<?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="com.whyc.mapper.StationInfMapper">
|
|
<select id="getMaxStationId" resultType="java.lang.Integer">
|
select ifnull(max(station_id),0) from db_station.tb_station_inf where station_id>0;
|
</select>
|
<resultMap id="name1List" type="provice">
|
<result property="provice" column="provice" ></result>
|
<collection property="cityList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.City" column="{provice=provice}" select="selectCity">
|
</collection>
|
</resultMap>
|
<select id="getLeftStation" resultMap="name1List">
|
select distinct provice from db_station.tb_station_inf
|
<where>
|
<if test="uid>100">
|
and tb_station_inf.station_id in(
|
select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
|
where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
|
and tb_baojigroup_usr.uid=#{uid}
|
)
|
</if>
|
</where>
|
</select>
|
|
<resultMap id="name2List" type="city">
|
<result property="provice" column="provice"></result>
|
<result property="city" column="city" ></result>
|
<collection property="countryList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Country" column="{provice=provice,city=city}" select="selectCountry">
|
</collection>
|
</resultMap>
|
<select id="selectCity" resultMap="name2List">
|
SELECT distinct #{provice} as provice,city from db_station.tb_station_inf
|
where provice=#{provice}
|
</select>
|
|
<resultMap id="name3List" type="country">
|
<result property="provice" column="provice"></result>
|
<result property="city" column="city" ></result>
|
<result property="country" column="country" ></result>
|
<collection property="stationList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Station" column="{provice=provice,city=city,country=country}" select="selectStation">
|
</collection>
|
</resultMap>
|
<select id="selectCountry" resultMap="name3List">
|
SELECT distinct #{provice} as provice, #{city} as city,country from db_station.tb_station_inf
|
where provice=#{provice} and city=#{city}
|
</select>
|
|
<resultMap id="name4List" type="station">
|
<result property="provice" column="provice"></result>
|
<result property="city" column="city" ></result>
|
<result property="country" column="country" ></result>
|
<result property="stationName" column="station_name" ></result>
|
<result property="stationId" column="station_id" ></result>
|
<collection property="pinflist" javaType="java.util.ArrayList" ofType="com.whyc.pojo.db_station.PowerInf" column="{stationId=station_id}" select="selectPowerInf">
|
</collection>
|
</resultMap>
|
<select id="selectStation" resultMap="name4List">
|
SELECT distinct #{provice} as provice, #{city} as city, #{country} as country,station_name,station_id from db_station.tb_station_inf
|
where provice=#{provice} and city=#{city} and country=#{country}
|
</select>
|
|
<select id="selectPowerInf" resultType="powerInf">
|
SELECT distinct tb_power_inf.* from db_station.tb_power_inf,db_station.tb_station_inf
|
where tb_power_inf.station_id=tb_station_inf.station_id and tb_power_inf.station_id=#{stationId}
|
</select>
|
|
<select id="getProviceByUid" resultType="java.lang.String">
|
select distinct provice from db_station.tb_station_inf
|
<where>
|
<if test="uid>100">
|
and tb_station_inf.station_id in(
|
select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
|
where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
|
and tb_baojigroup_usr.uid=#{uid}
|
)
|
</if>
|
</where>
|
</select>
|
<select id="getCityByUid" resultType="java.lang.String">
|
select distinct city from db_station.tb_station_inf
|
<where>
|
<if test="provice!=null">
|
and provice=#{provice}
|
</if>
|
<if test="uid>100">
|
and tb_station_inf.station_id in(
|
select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
|
where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
|
and tb_baojigroup_usr.uid=#{uid}
|
)
|
</if>
|
</where>
|
</select>
|
<select id="getCountryByUid" resultType="java.lang.String">
|
select distinct country from db_station.tb_station_inf
|
<where>
|
<if test="provice!=null">
|
and provice=#{provice}
|
</if>
|
<if test="city!=null">
|
and city=#{city}
|
</if>
|
<if test="uid>100">
|
and tb_station_inf.station_id in(
|
select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
|
where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
|
and tb_baojigroup_usr.uid=#{uid}
|
)
|
</if>
|
</where>
|
</select>
|
<select id="getStationByUid" resultType="java.lang.String">
|
select distinct station_name from db_station.tb_station_inf
|
<where>
|
<if test="provice!=null">
|
and provice=#{provice}
|
</if>
|
<if test="city!=null">
|
and city=#{city}
|
</if>
|
<if test="country!=null">
|
and country=#{country}
|
</if>
|
<if test="uid>100">
|
and tb_station_inf.station_id in(
|
select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
|
where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
|
and tb_baojigroup_usr.uid=#{uid}
|
)
|
</if>
|
</where>
|
</select>
|
</mapper>
|