<?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.cf.imes.module.system.dal.mysql.datasource.DataSourceMapper">
    <resultMap id="map" type="com.cf.imes.module.system.controller.admin.datasource.vo.DataSourceRespVO">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="type" column="type"/>
        <result property="createTime" column="create_time"/>
        <result property="sqlStr" column="sql_str"/>
        <collection property="filedList" javaType="java.util.List"  ofType="com.cf.imes.module.system.dal.dataobject.datasource.DataSourceFiledDO">
            <result property="name" column="field_name"/>
            <result property="sourceId" column="field_source_id"/>
            <result property="id" column="field_id"/>
            <result property="key" column="field_key"/>
        </collection>
    </resultMap>

    <select id="selectListVO" resultMap="map">
        select a.*, b.id field_id, b.name field_name, b.source_id field_source_id, b.key field_key
        from system_data_source a
        left join system_data_source_field b on a.id = b.source_id
    </select>
</mapper>