Java Code Examples for com.baomidou.mybatisplus.core.toolkit.ObjectUtils#isNotEmpty()

The following examples show how to use com.baomidou.mybatisplus.core.toolkit.ObjectUtils#isNotEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityMap.java    From open-cloud with MIT License 6 votes vote down vote up
public EntityMap put(String key, Object value) {
   /* List<Object> dictKeys = redisUtils.getList("DICT_KEYS");
    *//*判断字段是否是字典类型*//*
    if (dictKeys.contains(key) && ObjectUtils.isNotEmpty(value)) {
        Object dictValue = dataMaps.get(key + "_" + value.toString());
        *//*返回数据中添加字典显示值*//*
        super.put(key + "Title", dictValue);
    }*/
    if (ObjectUtils.isNotEmpty(interceptors)) {
        interceptors.convert(this, key, value);
    }
    if (ObjectUtils.isNotNull(value)) {
        super.put(key, value);
    } else {
        super.put(key, "");
    }
    return this;
}
 
Example 2
Source File: SmsRecordServiceImpl.java    From hdw-dubbo with Apache License 2.0 6 votes vote down vote up
public PageVo selectSmsRecordPageList(SmsRecordDTO smsRecordDTO) {
    QueryWrapper<SmsRecord> wrapper = new QueryWrapper(smsRecordDTO);
    wrapper.like(ObjectUtils.isNotEmpty(smsRecordDTO.getUserName()), "t3.name", smsRecordDTO.getUserName())
            .ge(ObjectUtils.isNotEmpty(smsRecordDTO.getStartTime()), "t.push_time", smsRecordDTO.getStartTime())
            .le(ObjectUtils.isNotEmpty(smsRecordDTO.getEndTime()), "t.push_time", smsRecordDTO.getEndTime())
            .eq(ObjectUtils.isNotEmpty(smsRecordDTO.getUserId()), "t.user_id", smsRecordDTO.getUserId());
    if (ObjectUtils.isNotEmpty(smsRecordDTO.getStatus())){
        if(smsRecordDTO.getStatus() == "-1"){
            wrapper.and(i -> i.ne("t.status", "0").ne("t.status", "3"));
        }else{
            wrapper.eq(ObjectUtils.isNotEmpty(smsRecordDTO.getStatus()), "t.status", smsRecordDTO.getStatus());
        }
    }
    wrapper.orderByDesc("t.push_time");
    Page page = new Page();
    // 设置当前页码
    page.setCurrent(smsRecordDTO.getPage());
    // 设置页大小
    page.setSize(smsRecordDTO.getLimit());
    IPage ipage = this.baseMapper.selectSmsRecordPageList(page, wrapper);
    return new PageVo(ipage);
}
 
Example 3
Source File: CriteriaQuery.java    From open-cloud with MIT License 5 votes vote down vote up
public CriteriaQuery(PageParams pageParams) {
    this.pageParams = pageParams;
    String sort = pageParams.getSort();
    apply("1=1");
    if (ObjectUtils.isNotEmpty(sort)) {
        //自动添加ordery by
        String order = pageParams.getOrder();
        Boolean isAsc = StringUtils.equalsIgnoreCase(SqlKeyword.ASC.name(), order);
        sort = StringUtils.camelToUnderline(sort);
        orderBy(true, isAsc, sort);
    }
}
 
Example 4
Source File: CriteriaQuery.java    From open-cloud with MIT License 5 votes vote down vote up
/**
 * 创建外键表关联对象,需要在mapper(xml)中编写join
 */
public void createAlias(Class cla) {
    TableAlias tableAlias = AnnotationUtils.getAnnotation(cla, TableAlias.class);
    if (ObjectUtils.isNotEmpty(tableAlias)) {
        this.aliasMap.put(tableAlias.value(), tableAlias.value());
    }
}
 
Example 5
Source File: CriteriaQuery.java    From open-cloud with MIT License 5 votes vote down vote up
public String getSelect() {
    StringBuffer str = new StringBuffer();
    String sqlSelect = getSqlSelect();
    if (ObjectUtils.isNotEmpty(sqlSelect)) {
        select.add(String.join(",", sqlSelect));
    }
    if (CollectionUtils.isEmpty(select)) {
        select.add("*");
    }
    return String.join(",", select);
}
 
Example 6
Source File: EntityMap.java    From open-cloud with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T get(String key) {
    T t = null;
    Object obj = super.get(key);
    if (ObjectUtils.isNotEmpty(obj)) {
        t = (T) obj;
    }
    return t;
}
 
Example 7
Source File: EntityMap.java    From open-cloud with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> T get(String key, T def) {
    Object obj = super.get(key);
    if (ObjectUtils.isNotEmpty(obj)) {
        return (T) obj;
    } else {
        return def;
    }
}
 
Example 8
Source File: CriteriaQuery.java    From open-cloud with MIT License 4 votes vote down vote up
/**
 * 等于
 */
@Override
public CriteriaQuery<T> eq(String column, Object val) {
    super.eq(ObjectUtils.isNotEmpty(val) && !val.equals(-1) && !val.equals(-1L), column, val);
    return this;
}