<?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.zcloud.basic.info.persistence.mapper.CorpFormMapper">


    <select id="selectListByType" resultType="com.zcloud.basic.info.persistence.dataobject.CorpFormDO">
        SELECT
        f.type,
        f.info_id AS infoId,
        f.item_code AS itemCode,
        f.item_name AS itemName,
        c.corp_name AS corpName
        FROM
        corp_form f
        LEFT JOIN corp_info c ON f.info_id = c.id
        WHERE
        f.info_id = #{infoId} and f.delete_enum='false'
        AND f.type IN
        <foreach collection="typeList" item="type" open="(" close=")" separator=",">
            #{type}
        </foreach>
    </select>
    <select id="getCorpListByTypeList" resultType="com.zcloud.basic.info.persistence.dataobject.CorpFormDO">
        SELECT
        f.type,
        f.info_id AS infoId,
        f.item_code AS itemCode,
        f.item_name AS itemName,
        c.corp_name AS corpName
        FROM
        corp_form f
        LEFT JOIN corp_info c ON f.info_id = c.id
        WHERE
        f.info_id IN
        <foreach collection="corpInfoIdList" item="infoId" open="(" close=")" separator=",">
            #{infoId}
        </foreach>
        AND f.type IN
        <foreach collection="typeList" item="type" open="(" close=")" separator=",">
            #{type}
        </foreach>
        AND f.delete_enum='false'
    </select>
</mapper>

