<?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.github.wxiaoqi.security.admin.mapper.BranchCompanyBannerMapper">


    <select id="selectList"  resultType="com.github.wxiaoqi.security.admin.vo.BranchCompanyBannerVo" parameterType="com.github.wxiaoqi.security.admin.dto.BranchCompanyBannerDTO">
        SELECT
        a.*,
        b.`name` as companyName
        FROM branch_company_banner a
        LEFT JOIN  branch_company b on a.company_id=b.id
        LEFT JOIN  company_info i on  b.company_id=i.id
        <where>
             a.is_del = 0
            <if test="status != null ">
                AND  a.`status`= #{status}
            </if>
            <if test="dataCompanyIds != null and dataCompanyIds.size > 0">
                and b.id in
                <foreach collection="dataCompanyIds" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            <if test="dataCorporationIds != null and dataCorporationIds.size > 0">
                and  b.company_id  in
                <foreach collection="dataCorporationIds" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>

        </where>
       order by a.upd_time DESC
    </select>
</mapper>