From 5a54a4564e6c0c5d11564ef0126ec149170fe391 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期五, 20 六月 2025 20:27:00 +0800 Subject: [PATCH] 左侧机房下拉 --- src/main/java/com/whyc/dto/Station/Station.java | 1 + src/main/java/com/whyc/dto/Station/City.java | 1 + src/main/java/com/whyc/dto/Station/Country.java | 1 + src/main/resources/mapper/StationInfMapper.xml | 52 +++++++++++++++++++++++++++++++++++++++++++--------- src/main/java/com/whyc/dto/Station/Provice.java | 1 + 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/whyc/dto/Station/City.java b/src/main/java/com/whyc/dto/Station/City.java index 74507c4..077cc28 100644 --- a/src/main/java/com/whyc/dto/Station/City.java +++ b/src/main/java/com/whyc/dto/Station/City.java @@ -8,5 +8,6 @@ public class City { private String provice; private String city; + private Integer uid; private List<Country> countryList; } \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Station/Country.java b/src/main/java/com/whyc/dto/Station/Country.java index ff10139..ffa75e9 100644 --- a/src/main/java/com/whyc/dto/Station/Country.java +++ b/src/main/java/com/whyc/dto/Station/Country.java @@ -9,5 +9,6 @@ private String provice; private String city; private String country; + private Integer uid; private List<Station> stationList; } \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Station/Provice.java b/src/main/java/com/whyc/dto/Station/Provice.java index 0d47a8b..95178b5 100644 --- a/src/main/java/com/whyc/dto/Station/Provice.java +++ b/src/main/java/com/whyc/dto/Station/Provice.java @@ -7,5 +7,6 @@ @Data public class Provice { private String provice; + private Integer uid; private List<City> cityList; } \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Station/Station.java b/src/main/java/com/whyc/dto/Station/Station.java index ca2412e..780a93e 100644 --- a/src/main/java/com/whyc/dto/Station/Station.java +++ b/src/main/java/com/whyc/dto/Station/Station.java @@ -12,5 +12,6 @@ private String country; private String stationName; private Integer stationId; + private Integer uid; private List<Power> pinflist; } \ No newline at end of file diff --git a/src/main/resources/mapper/StationInfMapper.xml b/src/main/resources/mapper/StationInfMapper.xml index 058e4fb..166ba9f 100644 --- a/src/main/resources/mapper/StationInfMapper.xml +++ b/src/main/resources/mapper/StationInfMapper.xml @@ -7,11 +7,12 @@ </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"> + <result property="uid" column="uid" ></result> + <collection property="cityList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.City" column="{provice=provice,uid=uid}" select="selectCity"> </collection> </resultMap> <select id="getLeftStation" resultMap="name1List"> - select distinct provice from db_station.tb_station_inf + select distinct provice,#{uid} as uid from db_station.tb_station_inf <where> <if test="uid>100"> and tb_station_inf.station_id in( @@ -26,24 +27,42 @@ <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"> + <result property="uid" column="uid" ></result> + <collection property="countryList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Country" column="{provice=provice,city=city,uid=uid}" 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 distinct #{provice} as provice,#{uid} as uid,city from db_station.tb_station_inf + <where> + provice=#{provice} + <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="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"> + <result property="uid" column="uid" ></result> + <collection property="stationList" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Station" column="{provice=provice,city=city,country=country,uid=uid}" select="selectStation"> </collection> </resultMap> <select id="selectCountry" resultMap="name3List"> - SELECT distinct #{provice} as provice, #{city} as city,country from db_station.tb_station_inf + SELECT distinct #{provice} as provice, #{city} as city,#{uid} as uid,country from db_station.tb_station_inf where provice=#{provice} and city=#{city} + <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> </select> <resultMap id="name4List" type="station"> @@ -52,12 +71,20 @@ <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.dto.Station.Power" column="{stationId=station_id}" select="selectPower"> + <result property="uid" column="uid" ></result> + <collection property="pinflist" javaType="java.util.ArrayList" ofType="com.whyc.dto.Station.Power" column="{stationId=station_id,uid=uid}" select="selectPower"> </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 + SELECT distinct #{provice} as provice, #{city} as city, #{country} as country,#{uid} as uid,station_name,station_id from db_station.tb_station_inf where provice=#{provice} and city=#{city} and country=#{country} + <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> </select> <resultMap id="name5List" type="power"> <result property="powerId" column="power_id"></result> @@ -69,6 +96,13 @@ <select id="selectPower" resultMap="name5List"> SELECT distinct tb_power_inf.power_id,power_name,station_id from db_station.tb_power_inf where tb_power_inf.station_id=#{stationId} + <if test="uid>100"> + and tb_power_inf.power_id in( + select distinct power_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> </select> <select id="selectBatt" resultType="batt"> -- Gitblit v1.9.1