Java Code Examples for tk.mybatis.mapper.entity.Example#Builder
The following examples show how to use
tk.mybatis.mapper.entity.Example#Builder .
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: BaseService.java From luckwheel with Apache License 2.0 | 5 votes |
/** * 通过字段查询依托通用方法 * @param pageNo 起始页 * @param pageSize * @param where * @param orderByField * @param fields * @return */ private List<T> queryByFiledBase(Integer pageNo,Integer pageSize,Sqls where,String orderByField, String ...fields){ Example.Builder builder=null; if(null==fields||fields.length==0){ //查询所有 builder = Example.builder(getTypeArguement()); }else{ //查询指定字段 builder= Example.builder(getTypeArguement()) .select(fields); } if(where!=null){ builder=builder.where(where); } if(orderByField!=null){ builder= builder .orderByDesc(orderByField); } Example example=builder.build(); if(pageNo!=null&&pageSize!=null) { PageHelper.startPage(pageNo, pageSize); //分页插件 } List list = getMapper().selectByExample(example); return list; }