添加了根据火点编码查询火点信息的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; package com.xkrs.controller;
import com.xkrs.service.XkRsForestRangerService; import com.xkrs.service.ForestRangerService;
import com.xkrs.utils.Result;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -15,7 +14,7 @@ import java.util.Map;
public class XkRsForestRangerController { public class XkRsForestRangerController {
@Resource @Resource
private XkRsForestRangerService xkRsForestRangerService; private ForestRangerService forestRangerService;
/** /**
* 根据区县编码查询相关护林员的信息 * 根据区县编码查询相关护林员的信息
@ -23,8 +22,9 @@ public class XkRsForestRangerController {
* @return * @return
*/ */
@GetMapping("/findByRangerCountyCode") @GetMapping("/findByRangerCountyCode")
public Result findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode){ @PreAuthorize("hasAnyAuthority('auth_general_user')")
return xkRsForestRangerService.findByRangerCountyCode(rangerCountyCode); 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 * @param token
* @return * @return
*/ */
@PreAuthorize("hasAnyRole('ROLE_city','ROLE_county')")
@GetMapping("/findAllByRangerCountyCode") @GetMapping("/findAllByRangerCountyCode")
public Result findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value="Authorization") String token){ @PreAuthorize("hasAnyAuthority('auth_general_user')")
return xkRsForestRangerService.findAllByRangerCountyCode(countyCode,token); 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 * @return
*/ */
@PostMapping("/updateLatAndLonByPhone") @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 rangerLatitude = (String) map.get("rangerLatitude");
String rangerLongitude = (String) map.get("rangerLongitude"); String rangerLongitude = (String) map.get("rangerLongitude");
String rangerPhone = (String) map.get("rangerPhone"); 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 com.xkrs.model.entity.FirePointEntity;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -11,7 +12,7 @@ import java.util.List;
* @author XinYi Song * @author XinYi Song
*/ */
@Component @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) @Query(value = "select * from fire_point where add_time like CONCAT('%',:addTime,'%')",nativeQuery = true)
List<FirePointEntity> selectTodayFirePoint(String addTime); List<FirePointEntity> selectTodayFirePoint(String addTime);
/**
* 根据火点编码查询火点信息
* @param fireCode
* @return
*/
FirePointEntity findByFireCode(String fireCode);
} }