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


    <select id="selectList"  resultType="com.github.wxiaoqi.security.admin.vo.CompanyApplyVo" parameterType="com.github.wxiaoqi.security.admin.dto.CompanyApplyFindDTO">
        SELECT
        a.*,
        i.`name` as branchName
        FROM company_info_apply a
        LEFT JOIN company_info i on a.branch_id=i.id
        <where>
            <if test="name != null and  name != ''">
                AND ( a.`name` like concat('%',#{name},'%') or i.`name` like concat('%',#{name},'%') )
            </if>
            <if test="formType != null ">
                AND  a.`form_type`= #{formType}
            </if>
            <if test="userId != null ">
                AND  a.`app_user_id`= #{userId}
            </if>
        </where>
       order by a.upd_time DESC
    </select>
</mapper>