<?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.zsc.edu.gateway.modules.iot.tsl.repo.EventLogRepository">

    <resultMap id="EventLogMap" type="com.zsc.edu.gateway.modules.iot.tsl.entity.EventLog">
        <id column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="record_id" property="recordId"/>
        <association property="recordData" javaType="com.zsc.edu.gateway.modules.iot.record.entity.RecordData">
            <result column="client_id" property="clientId"/>
            <result column="content" property="content"
                    typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
            <result column="record_time" property="recordTime"/>
            <result column="dept_id" property="deptId"/>
        </association>
    </resultMap>

    <select id="selectList" resultMap="EventLogMap">
        select iel.*, ird.*
        from iot_event_log iel,
             iot_record_data ird
        where iel.record_id = ird.id
    </select>

</mapper>