<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.elephant.framework.galaxy.aroad.module.emergency.mapper.MaterialHouseMapper">

    <resultMap id="materialHouseMap" type="com.elephant.framework.galaxy.aroad.module.emergency.entity.MaterialHouse">
        <id property="rowId" column="row_id"/>
        <result property="houseName" column="house_name"/>
        <result property="address" column="address"/>
        <result property="longitude" column="longitude"/>
        <result property="dimension" column="dimension"/>
        <result property="teamId" column="team_id"/>
        <result property="teamName" column="team_name"/>
        <result property="managerPhone" column="manager_phone"/>
        <result property="materialType" column="material_type"/>
        <result property="materialName" column="material_name"/>
        <result property="unit" column="unit"/>
        <result property="amount" column="amount"/>
        <result property="manager" column="manager"/>
        <result property="telephone" column="telephone"/>
        <result property="bz" column="bz"/>
    </resultMap>

    <resultMap id="teamMap" type="com.elephant.framework.galaxy.aroad.module.emergency.dto.TeamEquipmentInfoDto">
        <id property="rowId" column="row_id"/>
        <result property="teamId" column="team_id"/>
        <result property="teamName" column="team_name"/>
        <result property="parentOrganizeName" column="parent_organize_name"/>
        <result property="parentOrganizeId" column="parent_organize_id"/>
    </resultMap>

    <resultMap id="materialHouseCoordinateDtoMap"
               type="com.elephant.framework.galaxy.aroad.module.emergency.dto.MaterialHouseCoordinateDto">
        <id column="row_id" property="rowId"/>
        <result column="longitude" property="longitude"/>
        <result column="latitude" property="latitude"/>
    </resultMap>

    <select id="getCoordinates" resultMap="materialHouseCoordinateDtoMap">
        select row_id, longitude, latitude
        from `material_house`;
    </select>

    <select id="getTeams" resultMap="teamMap">
        SELECT row_id, team_id, team_name,parent_organize_name,parent_organize_id
        FROM emergency_team_equipment;
    </select>
</mapper>
