<?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.DataSourceFiledMapper">


    <select id="selectFiledList" resultType="com.cf.imes.module.system.controller.admin.datasource.vo.DataSourceFiledReqVO"
            parameterType="java.lang.Long">


        select distinct
            * from system_data_source_field

                 where
        <foreach item="id" collection="ids" open="(" separator="OR" close=")">
            source_id LIKE CONCAT('%', #{id}, '%')
        </foreach>

    </select>

    <select id="selectFiled" resultType="com.cf.imes.module.system.dal.dataobject.datasource.DataSourceFiledDO">

        select distinct
        *
        from system_data_source_field

        where

        <foreach item="sourceField" collection="sourceFields" open="(" separator="OR" close=")">
            source_id LIKE CONCAT('%', #{sourceField.parentId}, '%')
        </foreach>
        and
            `key` in
        <foreach collection="sourceFields" item="sourceField" open="(" close=")" separator=",">
            #{sourceField.key}
        </foreach>

    </select>

    <select id="selectFiledListByKey" resultType="com.cf.imes.module.system.dal.dataobject.datasource.DataSourceFiledDO">

        select distinct
                *
        from system_data_source_field

        where
            `key` in
        <foreach collection="keyList" item="key" open="(" close=")" separator=",">
             #{key}
        </foreach>

    </select>


</mapper>