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

 

posted on 2019-09-03 17:25  以启山林  阅读(3538)  评论(0编辑  收藏  举报

导航