package cn.com.taiji.track.mapper;

import cn.com.taiji.track.dto.ContainsDTO;
import cn.com.taiji.track.entity.WarningAreaEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;


/**
 * @author kok20
 */
@Mapper
public interface WarningAreaMapper extends BaseMapper<WarningAreaEntity> {
    @Select("SELECT * FROM\n" +
            "(\n" +
            "SELECT\n" +
            "`name`,\n" +
            "ST_Contains ( ST_Polygon ( location ), ST_Point(${longitude},${latitude})) ct \n" +
            "FROM\n" +
            "`ax_beidou_warning_area` \n" +
            "WHERE\n" +
            "location is not null  \n" +
            ") AS a \n" +
            "WHERE\n" +
            "a.ct = 1")
    List<ContainsDTO> containsPoint(@Param("longitude") String longitude, @Param("latitude") String latitude);
}

