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
相關文章
相關標籤/搜索