<?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.api.app.dao.butler.AppAlarmDao">

    <insert id="insertAlarmRecord" parameterType="com.api.model.app.AppAlarm">
        insert into sys_one_button_alarm(
            estate_id,
            create_id,
            create_date
        )values (
            #{estateId},
            #{createId},
            #{createDate}
        )
    </insert>
    <select id="findRoomNameByEstateId" parameterType="java.lang.Integer" resultType="java.lang.String">
        select concat(cb.no,'-',cbu.no,'-',cbue.room_number) as room_name
        from cpm_building_unit_estate as cbue,cpm_building_unit as cbu,cpm_building as cb
        where cbue.building_unit_id = cbu.id and cbu.building_id = cb.id and cbue.id = #{estateId}
    </select>
    <select id="findNameByResidentId" parameterType="java.lang.Integer" resultType="java.lang.String">
        select name from user_resident where id = #{createId}
    </select>
    <select id="findTelByResidentId" resultType="java.lang.String">
        select tel from user_resident where id = #{createId}
    </select>
</mapper>