Package net.guerlab.cloud.web.provider
Class BaseQueryController<E extends net.guerlab.cloud.commons.entity.IBaseEntity,Q extends net.guerlab.cloud.searchparams.SearchParams,A extends net.guerlab.cloud.commons.api.QueryApi<E,Q>,V>
java.lang.Object
net.guerlab.cloud.web.provider.BaseQueryController<E,Q,A,V>
- Type Parameters:
E- 实体类型Q- 搜索参数类型A- api接口类型V- 返回对象类型
- Direct Known Subclasses:
BaseManageController
public abstract class BaseQueryController<E extends net.guerlab.cloud.commons.entity.IBaseEntity,Q extends net.guerlab.cloud.searchparams.SearchParams,A extends net.guerlab.cloud.commons.api.QueryApi<E,Q>,V>
extends Object
基础查询控制器实现.
- Author:
- guer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterFind(Collection<V> list, Q searchParams) 查询后置焕然.protected booleanbeforeFind(Q searchParams) 查询前置环绕.protected abstract V实体对象转换为输出对象.protected voidentityCheck(E entity) 对象检查.protected RuntimeException当对象为空的时候抛出的异常.selectById(Long id, Q searchParams) 通过Id查询单一结果.longselectCount(Q searchParams) 查询总记录数.selectList(Q searchParams) 查询列表.查询单一结果.net.guerlab.cloud.core.result.Pageable<V>selectPage(Q searchParams, int pageId, int pageSize) 查询分页列表.
-
Field Details
-
api
api.
-
-
Constructor Details
-
BaseQueryController
根据api实例创建控制器.- Parameters:
api- api实例
-
-
Method Details
-
convert
实体对象转换为输出对象.- Parameters:
entity- 实体对象- Returns:
- 输出对象
-
selectById
@Nullable @GetMapping("/{id:\\d+}") public V selectById(@PathVariable("id") Long id, @Nullable Q searchParams) 通过Id查询单一结果.- Parameters:
id- IDsearchParams- 搜索参数- Returns:
- 实体数据
-
selectOne
查询单一结果.- Parameters:
searchParams- 搜索参数对象- Returns:
- 实体数据
-
entityCheck
对象检查.- Parameters:
entity- 实体
-
nullPointException
当对象为空的时候抛出的异常.- Returns:
- 当对象为空的时候抛出的异常
-
selectList
查询列表.- Parameters:
searchParams- 搜索参数对象- Returns:
- 列表
-
selectPage
@PostMapping("/search/page") public net.guerlab.cloud.core.result.Pageable<V> selectPage(@RequestBody Q searchParams, @RequestParam(name="pageId",defaultValue="1",required=false) int pageId, @RequestParam(name="pageSize",defaultValue="10",required=false) int pageSize) 查询分页列表.- Parameters:
searchParams- 搜索参数对象pageId- 分页IDpageSize- 分页尺寸- Returns:
- 分页结果
-
selectCount
查询总记录数.- Parameters:
searchParams- 搜索参数对象- Returns:
- 总记录数
-
beforeFind
查询前置环绕.- Parameters:
searchParams- 搜索参数- Returns:
- 是否继续查询
-
afterFind
查询后置焕然.- Parameters:
list- 结果列表searchParams- 搜索参数
-