123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package com.gyee.viewticket.comm.base;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
- import java.util.Collection;
- public class ExcludeQueryWrapper <T> extends QueryWrapper<T> {
- @Override
- public QueryWrapper<T> eq(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.eq(condition, column, val);
- }
- @Override
- public QueryWrapper<T> in(boolean condition, String column, Collection<?> val) {
- condition = !(null == val || val.size() <= 0);
- // condition = !ObjectUtils.isEmpty(val);
- return super.in(condition, column, val);
- }
- @Override
- public QueryWrapper<T> ne(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.ne(condition, column, val);
- }
- @Override
- public QueryWrapper<T> gt(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.gt(condition, column, val);
- }
- @Override
- public QueryWrapper<T> ge(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.ge(condition, column, val);
- }
- @Override
- public QueryWrapper<T> lt(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.lt(condition, column, val);
- }
- @Override
- public QueryWrapper<T> le(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.le(condition, column, val);
- }
- @Override
- public QueryWrapper<T> like(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.like(condition, column, val);
- }
- @Override
- public QueryWrapper<T> notLike(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.notLike(condition, column, val);
- }
- @Override
- public QueryWrapper<T> likeLeft(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.likeLeft(condition, column, val);
- }
- @Override
- public QueryWrapper<T> likeRight(boolean condition, String column, Object val) {
- condition = !ObjectUtils.isEmpty(val);
- return super.likeRight(condition, column, val);
- }
- @Override
- public QueryWrapper<T> between(boolean condition, String column, Object val1, Object val2) {
- if (ObjectUtils.isEmpty(val1) && ObjectUtils.isEmpty(val2)) {
- condition = false;
- } else if (ObjectUtils.isEmpty(val1)) {
- return super.lt(true, column, val2);
- } else if (ObjectUtils.isEmpty(val2)) {
- return super.ge(true, column, val1);
- }
- return super.between(condition, column, val1, val2);
- }
- @Override
- public QueryWrapper<T> notBetween(boolean condition, String column, Object val1, Object val2) {
- if (ObjectUtils.isEmpty(val1) && ObjectUtils.isEmpty(val2)) {
- condition = false;
- } else if (ObjectUtils.isEmpty(val1)) {
- return super.lt(true, column, val2);
- } else if (ObjectUtils.isEmpty(val2)) {
- return super.ge(true, column, val1);
- }
- return super.notBetween(condition, column, val1, val2);
- }
- }
|