潘海瑞 9 kuukautta sitten
vanhempi
sitoutus
af58d570f8

+ 3 - 3
sky-server/src/main/java/com/sky/controller/admin/EmployeeController.java

@@ -68,9 +68,9 @@ public class EmployeeController {
 
 
     @GetMapping("/location")
-    public List<Result> getlocation(@RequestParam double volatitude, @RequestParam double volongitude){
-        ArrayList<Object> list = new ArrayList<>();
-        return Result.success(employeeService.getlocation(volatitude,volongitude));
+    public List<Employee> getlocation(@RequestParam double volatitude, @RequestParam double volongitude){
+
+        return  employeeService.getlocation(volatitude,volongitude);
 
     }
 

+ 4 - 2
sky-server/src/main/java/com/sky/mapper/EmployeeMapper.java

@@ -8,6 +8,8 @@ import com.sky.enumeration.OperationType;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 
+import java.util.List;
+
 @Mapper
 public interface EmployeeMapper {
 
@@ -59,6 +61,6 @@ public interface EmployeeMapper {
     @Select("select * from employee where id = #{id}")
     Employee getById(Integer id);
 
-    @Select("SELECT * FROM t_loc64 WHERE SQRT( POW(PI() * 12656 * COS((#{volatitude} + lat) * PI() / 360) * (#{volongitude} - lng) / 180, 2) + POW(PI() * 12656 * ((#{volatitude} - lat) / 180), 2) ) < 100 ")
-    Employee getLocation( double volatitude, double volongitude);
+    @Select("SELECT * FROM t_loc64 WHERE SQRT( POW(PI() * 12656 * COS((#{volatitude} + lat) * PI() / 360) * (#{volongitude} - lng) / 180, 2) + POW(PI() * 12656 * ((#{volatitude} - lat) / 180), 2) ) < 100 limit 3")
+    List<Employee> getLocation(double volatitude, double volongitude);
 }

+ 3 - 1
sky-server/src/main/java/com/sky/service/EmployeeService.java

@@ -6,6 +6,8 @@ import com.sky.dto.EmployeePageQueryDTO;
 import com.sky.entity.Employee;
 import com.sky.result.PageResult;
 
+import java.util.List;
+
 public interface EmployeeService {
 
     /**
@@ -48,5 +50,5 @@ public interface EmployeeService {
      */
     void update(EmployeeDTO employeeDTO);
 
-    Employee getlocation(double volatitude, double volongitude);
+    List<Employee> getlocation(double volatitude, double volongitude);
 }

+ 3 - 3
sky-server/src/main/java/com/sky/service/impl/EmployeeServiceImpl.java

@@ -162,12 +162,12 @@ public class EmployeeServiceImpl implements EmployeeService {
 
     @Override
     public List<Employee> getlocation(double volatitude, double volongitude) {
-        ArrayList<Employee> employeelist = new ArrayList<>();
 
-        Employee employee = employeeMapper.getLocation(volatitude, volongitude);
 
 
-        return null;
+
+
+        return employeeMapper.getLocation(volatitude, volongitude);
     }
 
 }