添加了查询所有市的接口
This commit is contained in:
parent
613c4cf2b3
commit
956efcd15d
@ -49,6 +49,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers(HttpMethod.GET,"/selectFirePointNum").permitAll()
|
.antMatchers(HttpMethod.GET,"/selectFirePointNum").permitAll()
|
||||||
.antMatchers(HttpMethod.GET,"/api/user/booleanUserName").permitAll()
|
.antMatchers(HttpMethod.GET,"/api/user/booleanUserName").permitAll()
|
||||||
.antMatchers(HttpMethod.GET,"/websocketTest").permitAll()
|
.antMatchers(HttpMethod.GET,"/websocketTest").permitAll()
|
||||||
|
.antMatchers(HttpMethod.GET,"/selectCityName").permitAll()
|
||||||
// 所有其它请求需要身份认证
|
// 所有其它请求需要身份认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
@ -25,6 +25,7 @@ public enum PromptMessageEnum{
|
|||||||
|
|
||||||
// 数据返回错误:3001-3999
|
// 数据返回错误:3001-3999
|
||||||
DATA_NONE(3001, "sys.message.data.none"),
|
DATA_NONE(3001, "sys.message.data.none"),
|
||||||
|
|
||||||
DATA_WRONG(3002, "sys.message.data.wrong"),
|
DATA_WRONG(3002, "sys.message.data.wrong"),
|
||||||
DATA_EXIT(3003,"sys.message.exit"),
|
DATA_EXIT(3003,"sys.message.exit"),
|
||||||
|
|
||||||
|
@ -213,4 +213,16 @@ public class FirePointController {
|
|||||||
|
|
||||||
WebSocketServer.broadInfo(message);
|
WebSocketServer.broadInfo(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该省所有的市
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectCityName")
|
||||||
|
public String selectCityName(){
|
||||||
|
// 获取区域信息
|
||||||
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
|
List<Map<String, Object>> maps = firePointService.selectCityName();
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xkrs
|
* @author xkrs
|
||||||
@ -21,4 +22,11 @@ public interface CityDao extends JpaRepository<CityEntity,Long>, JpaSpecificatio
|
|||||||
*/
|
*/
|
||||||
@Query(value = "select city_name,city_code,city_latitude,city_longitude from city where pro_code = ?",nativeQuery = true)
|
@Query(value = "select city_name,city_code,city_latitude,city_longitude from city where pro_code = ?",nativeQuery = true)
|
||||||
List<Object[]> selectCityNameAndLatAndLog(String proCode);
|
List<Object[]> selectCityNameAndLatAndLog(String proCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有市和对应的编码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Query(value = "select city_name cityname,city_code citycode from city",nativeQuery = true)
|
||||||
|
List<Map<String,Object>> selectCityName();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author XinYi Song
|
* @author XinYi Song
|
||||||
@ -95,4 +96,10 @@ public interface FirePointService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String selectFirePointNumWeek();
|
String selectFirePointNumWeek();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该省所有的市
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> selectCityName();
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,9 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
@Resource
|
@Resource
|
||||||
private FireTaskPhotoDao fireTaskPhotoDao;
|
private FireTaskPhotoDao fireTaskPhotoDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CityDao cityDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加火点信息
|
* 添加火点信息
|
||||||
* @param firePointQo
|
* @param firePointQo
|
||||||
@ -347,4 +350,13 @@ public class FirePointServiceImpl implements FirePointService {
|
|||||||
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该省所有的市
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectCityName() {
|
||||||
|
return cityDao.selectCityName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ public class Query {
|
|||||||
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
public Predicate toPredicate(Root<FirePointEntity> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (cityCode != null && !"".equals(cityCode)) {
|
if (cityCode != null && !"".equals(cityCode)) {
|
||||||
String substring = cityCode.substring(0, 4);
|
//String substring = cityCode.substring(0, 4);
|
||||||
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + substring + "%"));
|
list.add(criteriaBuilder.like(root.get("countyCode").as(String.class), "%" + cityCode + "%"));
|
||||||
}
|
}
|
||||||
if (satelliteType != null && !"".equals(satelliteType)) {
|
if (satelliteType != null && !"".equals(satelliteType)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
list.add(criteriaBuilder.equal(root.get("satelliteType").as(String.class), satelliteType));
|
||||||
|
Loading…
Reference in New Issue
Block a user