<?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.sqx.modules.resumes.dao.InvoiceDao">

    <select id="selectInvoiceList" resultType="com.sqx.modules.resumes.entity.Invoice">
        select i.*,c.company_name as companyName,u.user_name as userName,u.phone from invoice i
        left join company c on c.company_id=i.company_id
        left join tb_user u on u.user_id=c.user_id
        where 1=1
        <if test="userId!=null">
            and u.user_id=#{userId}
        </if>
        <if test="userName!=null and userName!=''">
            and u.user_name like concat('%',#{userName},'%')
        </if>
        <if test="companyName!=null and companyName!=''">
            and c.company_name like concat('%',#{companyName},'%')
        </if>
        <if test="title!=null and title!=''">
            and i.title like concat('%',#{title},'%')
        </if>
        <if test="content!=null and content!=''">
            and i.content like concat('%',#{content},'%')
        </if>
        <if test="phone!=null and phone!=''">
            and u.phone like concat('%',#{phone},'%')
        </if>
        <if test="status!=null and status!=0">
            and i.status=#{status}
        </if>
        order by i.create_time desc
    </select>

</mapper>