MYSQL多字段条件模糊查询


        select
            mo.id as id,
            mo.name as name,
            mo.user_id as userId,
            mo.actual_name as actualName,
            mo.login_ip as loginIp,
            mo.last_login_time as lastLoginTime,
            mo.last_login_status as lastLoginStatus
        from t_login_monitor mo
        where mo.deleted = '0'
        <if test="parameter.lastLoginTime != null">
            and date_format(mo.last_login_time,'%Y-%m-%d') = date_format(#{parameter.lastLoginTime},'%Y-%m-%d')
        </if>
        <if test="parameter.queryParam != null">
            and CONCAT(IFNULL(`name`,''),IFNULL(`login_ip`,''),IFNULL(`actual_name`,'')) like CONCAT('%',#{parameter.queryParam},'%')
        </if>
        order by mo.last_login_time DESC

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM