src/main/java/com/whyc/controller/ConditionController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/dto/Station/Station.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/db_station/PowerInf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/StationInfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/PowerInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/StationInfMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/ConditionController.java
@@ -29,23 +29,23 @@ @ApiOperation("获取省下的市(下拉)") @GetMapping("getCityByUid") public Response getCityByUid(@RequestParam(required = false) String stationName1) { public Response getCityByUid(@RequestParam(required = false) String provice) { User uinf= ActionUtil.getUser(); return stationInfService.getCityByUid(uinf.getId(),stationName1); return stationInfService.getCityByUid(uinf.getId(),provice); } @ApiOperation("获取省市下的区县(下拉)") @GetMapping("getCountryByUid") public Response getCountryByUid(@RequestParam(required = false) String stationName1,@RequestParam(required = false) String stationName2) { public Response getCountryByUid(@RequestParam(required = false) String provice,@RequestParam(required = false) String city) { User uinf= ActionUtil.getUser(); return stationInfService.getCountryByUid(uinf.getId(),stationName1,stationName2); return stationInfService.getCountryByUid(uinf.getId(),provice,city); } @ApiOperation("获取省市区县下的站点(下拉)") @GetMapping("getStationByUid") public Response getStationByUid(@RequestParam(required = false) String stationName1,@RequestParam(required = false) String stationName2,@RequestParam(required = false) String stationName3) { public Response getStationByUid(@RequestParam(required = false) String provice,@RequestParam(required = false) String city,@RequestParam(required = false) String country) { User uinf= ActionUtil.getUser(); return stationInfService.getStationByUid(uinf.getId(),stationName1,stationName2,stationName3); return stationInfService.getStationByUid(uinf.getId(),provice,city,country); } src/main/java/com/whyc/dto/Station/Station.java
@@ -1,6 +1,9 @@ package com.whyc.dto.Station; import com.whyc.pojo.db_station.PowerInf; import lombok.Data; import java.util.List; @Data public class Station { @@ -9,4 +12,5 @@ private String country; private String stationName; private Integer stationId; private List<PowerInf> pinflist; } src/main/java/com/whyc/pojo/db_station/PowerInf.java
@@ -63,5 +63,18 @@ @TableField(exist = false) private String stationName; @TableField(exist = false) private String provice; @TableField(exist = false) private String city; @TableField(exist = false) private String country; @TableField(exist = false) private String fullName; } src/main/java/com/whyc/service/StationInfService.java
@@ -29,18 +29,18 @@ return new Response().setII(1,list.size()>0,list,"获取所有的省份"); } //获取省下的市 public Response getCityByUid(int uid, String stationName1) { List<String> list=mapper.getCityByUid(uid,stationName1); public Response getCityByUid(int uid, String provice) { List<String> list=mapper.getCityByUid(uid,provice); return new Response().setII(1,list.size()>0,list,"获取省下的市"); } //获取省市下的区县 public Response getCountryByUid(int uid, String stationName1, String stationName2) { List<String> list=mapper.getCountryByUid(uid,stationName1,stationName2); public Response getCountryByUid(int uid, String provice, String city) { List<String> list=mapper.getCountryByUid(uid,provice,city); return new Response().setII(1,list.size()>0,list,"获取省市下的区县"); } //获取省市区县下的站点 public Response getStationByUid(int uid, String stationName1, String stationName2, String stationName3) { List<String> list=mapper.getStationByUid(uid,stationName1,stationName2,stationName3); public Response getStationByUid(int uid, String provice, String city, String country) { List<String> list=mapper.getStationByUid(uid,provice,city,country); return new Response().setII(1,list.size()>0,list,"获取省市区县下的站点"); } } src/main/resources/mapper/PowerInfMapper.xml
@@ -11,7 +11,7 @@ select ifnull(max(power_id),0) from db_station.tb_power_inf where power_id>0; </select> <select id="getPower" resultType="com.whyc.pojo.db_station.PowerInf"> select tb_power_inf.*,tb_station_inf.station_name select tb_power_inf.*,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name from db_station.tb_power_inf,db_station.tb_station_inf where tb_power_inf.station_id=tb_station_inf.station_id <if test="provice!=null"> src/main/resources/mapper/StationInfMapper.xml
@@ -12,15 +12,15 @@ </resultMap> <select id="getLeftStation" resultMap="name1List"> select distinct provice from db_station.tb_station_inf where station_id in( select distinct station_id from db_user.tb_user_baojigroup_power,db_user.tb_baojigroup_usr <where> tb_user_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id <if test="uid>100"> and tb_baojigroup_usr.uid=#{uid} </if> </where> ) <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"> @@ -52,23 +52,30 @@ <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 tb_station_inf.station_id in( select distinct station_id from db_user.tb_user_baojigroup_power,db_user.tb_baojigroup_usr <where> tb_user_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id <if test="uid>100"> and tb_baojigroup_usr.uid=#{uid} </if> </where> ) <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 @@ -76,15 +83,13 @@ <if test="provice!=null"> and provice=#{provice} </if> and tb_station_inf.station_id in( select distinct station_id from db_user.tb_user_baojigroup_power,db_user.tb_baojigroup_usr <where> tb_user_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id <if test="uid>100"> and tb_baojigroup_usr.uid=#{uid} </if> </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="getCountryByUid" resultType="java.lang.String"> @@ -96,15 +101,13 @@ <if test="city!=null"> and city=#{city} </if> and tb_station_inf.station_id in( select distinct station_id from db_user.tb_user_baojigroup_power,db_user.tb_baojigroup_usr <where> tb_user_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id <if test="uid>100"> and tb_baojigroup_usr.uid=#{uid} </if> </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="getStationByUid" resultType="java.lang.String"> @@ -119,15 +122,13 @@ <if test="country!=null"> and country=#{country} </if> and tb_station_inf.station_id in( select distinct station_id from db_user.tb_user_baojigroup_power,db_user.tb_baojigroup_usr <where> tb_user_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id <if test="uid>100"> and tb_baojigroup_usr.uid=#{uid} </if> </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> </mapper>