sql中筛选条件为空值

<select id="getEmployeeBasicInformationList" resultType="org.springblade.entity.AllEmployeeBasicInformation">
        select a.*,b.* from blade_employee_basic_information a left join  blade_user b on a.id=b.id where a.tenant_id=#{tenantId} and a.is_deleted=0
        <if test="department !=null and department !='' ">
             and a.department like '%%${department}%%'
        </if>
        <if test="realName !=null and realName !='' ">
          and b.real_name like '%%${realName}%%'
        </if>
        <if test="entryDate !=null and entryDate !='' ">
             and a.entry_date=#{entryDate}
        </if>
        <if test="dimissionType !=null and dimissionType !='' ">
            and a.dimission_type=#{dimissionType}
        </if>
        <if test="lastWorkingDay !=null and lastWorkingDay !='' ">
            and a.last_working_day=#{lastWorkingDay}
        </if>
        <if test="workingState !=null and workingState !='' ">
            and a.working_state=#{workingState}
        </if>

        <if test="isSing =='1'">
            and (a.contract_start_date is not null) or a.contract_start_date!=''
        </if>
        <if test="isSing =='0'">
            and a.contract_start_date is not null or ifnull(a.contract_start_date,'')=''
        </if>
        <if test="dateStartTime !=null and dateStartTime !='' ">
            and a.contract_start_date &gt;= {dateStartTime}
        </if>
        <if test="dateEndTime !=null and dateEndTime !='' ">
            and a.contract_start_date &lt;= {dateEndTime}
        </if>
        <if test="endDateStart !=null and endDateStart !='' ">
            and a.contract_end_date &gt;= {endDateStart}
        </if>
        <if test="endDateEnd !=null and endDateEnd !='' ">
            and a.contract_end_date &lt;= {endDateEnd}
        </if>
        order by a.id desc

 

 process_instance_id is null or ifnull(process_instance_id,'')=''

select * from blade_process_should_pay_invoice
where is_deleted = 0
and process_instance_id is null or ifnull(process_instance_id,'')=''
and create_user = '1273086723649093633'
order by create_time desc

posted @ 2020-06-30 17:28  红尘沙漏  阅读(3542)  评论(0编辑  收藏  举报