工作中用的sql

//字段是空字符串或者null
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
//动态sql
<select id="getMyJoinMeetingPage"  resultType="org.springblade.desk.meeting.entity.MeetingEntity">
        select a.* from blade_meeting a left join blade_meeting_person b on a.meeting_code=b.meeting_code
        where b.join_person_code=#{joinPersonCode}
        <if test="meetingName != null">
            and (meeting_name like '%%${meetingName}%%')
        </if>
        <if test="meetingDate != null">
            and (meeting_date like '%%${meetingDate}%%')
        </if>
    </select>

//查询teacher_name字段不能等于空并且也不能等于空字符
SELECT * FROM sys_teacher WHERE teacher_name IS NOT NULL AND teacher_name <>''
//查询teacher_name字段等于null或等于空字符
SELECT * FROM sys_teacher WHERE teacher_name = '' OR teacher_name IS NULL

 

posted @ 2020-07-02 11:04  红尘沙漏  阅读(128)  评论(0编辑  收藏  举报