添加了根据火点编码查询火点信息的sql语句

This commit is contained in:
DESKTOP-4U0TDEF\20371 2021-07-16 08:52:20 +08:00
parent 5de2d50145
commit fea3440c5b
2 changed files with 20 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package com.xkrs.controller;
import com.xkrs.service.XkRsForestRangerService;
import com.xkrs.utils.Result;
import com.xkrs.service.ForestRangerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -15,7 +14,7 @@ import java.util.Map;
public class XkRsForestRangerController {
@Resource
private XkRsForestRangerService xkRsForestRangerService;
private ForestRangerService forestRangerService;
/**
* 根据区县编码查询相关护林员的信息
@ -23,8 +22,9 @@ public class XkRsForestRangerController {
* @return
*/
@GetMapping("/findByRangerCountyCode")
public Result findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode){
return xkRsForestRangerService.findByRangerCountyCode(rangerCountyCode);
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value="Authorization") String token){
return forestRangerService.findByRangerCountyCode(rangerCountyCode);
}
/**
@ -33,10 +33,10 @@ public class XkRsForestRangerController {
* @param token
* @return
*/
@PreAuthorize("hasAnyRole('ROLE_city','ROLE_county')")
@GetMapping("/findAllByRangerCountyCode")
public Result findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value="Authorization") String token){
return xkRsForestRangerService.findAllByRangerCountyCode(countyCode,token);
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value="Authorization") String token){
return forestRangerService.findAllByRangerCountyCode(countyCode,token);
}
/**
@ -45,11 +45,12 @@ public class XkRsForestRangerController {
* @return
*/
@PostMapping("/updateLatAndLonByPhone")
public Result updateLatAndLonByPhone(@RequestBody Map map){
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value="Authorization") String token){
String rangerLatitude = (String) map.get("rangerLatitude");
String rangerLongitude = (String) map.get("rangerLongitude");
String rangerPhone = (String) map.get("rangerPhone");
return xkRsForestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
return forestRangerService.updateLatAndLonByPhone(rangerLatitude,rangerLongitude,rangerPhone);
}

View File

@ -2,6 +2,7 @@ package com.xkrs.dao;
import com.xkrs.model.entity.FirePointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
@ -11,7 +12,7 @@ import java.util.List;
* @author XinYi Song
*/
@Component
public interface FirePointDao extends JpaRepository<FirePointEntity,Long> {
public interface FirePointDao extends JpaRepository<FirePointEntity,Long>, JpaSpecificationExecutor<FirePointEntity> {
/**
* 查询今天的火点信息
@ -20,4 +21,11 @@ public interface FirePointDao extends JpaRepository<FirePointEntity,Long> {
*/
@Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%')",nativeQuery = true)
List<FirePointEntity> selectTodayFirePoint(String addTime);
/**
* 根据火点编码查询火点信息
* @param fireCode
* @return
*/
FirePointEntity findByFireCode(String fireCode);
}