| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.domain.QueryField; |
| | | import com.zy.asrs.framework.domain.QueryType; |
| | | import com.zy.asrs.wcs.utils.Utils; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.Arrays; |
| | |
| | | |
| | | private final U where; |
| | | |
| | | /** |
| | | * 是否把字段名称驼峰转下划线 |
| | | */ |
| | | private final boolean isToUnderlineCase; |
| | | |
| | | public PageParam() { |
| | | this(null); |
| | | } |
| | | |
| | | public PageParam(U where) { |
| | | this(where, true); |
| | | } |
| | | |
| | | public PageParam(U where, boolean isToUnderlineCase) { |
| | | super(); |
| | | this.where = where; |
| | | |
| | | this.isToUnderlineCase = isToUnderlineCase; |
| | | if (where != null) { |
| | | if (where.getPageIdx() != null) { |
| | | setCurrent(where.getPageIdx()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param excludes 不包含的字段 |
| | | */ |
| | | public QueryWrapper<T> getWrapper(String... excludes) { |
| | | return buildWrapper(null, Arrays.asList(excludes)); |
| | | } |
| | | |
| | | /** |
| | | * @param columns 只包含的字段 |
| | | */ |
| | | public QueryWrapper<T> getWrapperWith(String... columns) { |
| | | return buildWrapper(Arrays.asList(columns), null); |
| | | } |
| | | |
| | | |
| | | private QueryWrapper<T> buildWrapper(List<String> columns, List<String> excludes) { |
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>(); |
| | |
| | | if (!Cools.isEmpty(queryField.value())) { |
| | | fieldName = queryField.value(); |
| | | } |
| | | if (queryField.type() != null) { |
| | | queryType = queryField.type(); |
| | | } |
| | | queryField.type(); |
| | | queryType = queryField.type(); |
| | | } else { |
| | | // 过滤非本表的字段 |
| | | TableField tableField = field.getAnnotation(TableField.class); |