<?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="cn.com.ctop.crawler.modules.pangolin.mapper.PangolinAppMapper">
    <select id="getListByParams" resultType="cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp">
        select app.*
            from ctop_pangolin_app app
        left join ctop_bind_account_login login on login.account_name = app.account_name
        where
        1=1
        <if test="userId!=null">
            and login.user_id = #{userId}
        </if>
        <if test="accountNames!=null or projectIds!=null">
            and  ( 1=0
              <if test="accountNames!=null">
                  or login.account_name in
                  <foreach item="item" index="index" collection="accountNames" open="(" separator="," close=")">
                      #{item}
                  </foreach>
              </if>
            <if test="projectIds!=null">
                or login.project_id in
                <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
              )
        </if>
    </select>
</mapper>
