From 3551081008a364919bc1bb24ea2c60b8f49ac4dc Mon Sep 17 00:00:00 2001 From: Suomm <1474983351@qq.com> Date: Sat, 22 Jul 2023 21:06:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=90=8D=E7=A7=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/query/QueryWrapperChain.java | 96 ++++++++----------- 1 file changed, 42 insertions(+), 54 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryWrapperChain.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryWrapperChain.java index 82630dc1..d420c43b 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryWrapperChain.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/query/QueryWrapperChain.java @@ -61,104 +61,92 @@ public class QueryWrapperChain extends QueryWrapperAdapter R getOneAs(Class asType) { + public R oneAs(Class asType) { return baseMapper.selectOneByQueryAs(this, asType); } - public T getOneWithRelations() { + public T oneWithRelations() { return baseMapper.selectOneWithRelationsByQuery(this); } - public R getOneWithRelationsAs(Class asType) { + public R oneWithRelationsAs(Class asType) { return baseMapper.selectOneWithRelationsByQueryAs(this, asType); } - public Optional getOneOpt() { + public Optional oneOpt() { return Optional.ofNullable(baseMapper.selectOneByQuery(this)); } - public Optional getOneAsOpt(Class asType) { + public Optional oneAsOpt(Class asType) { return Optional.ofNullable(baseMapper.selectOneByQueryAs(this, asType)); } - public Optional getOneWithRelationsOpt() { + public Optional oneWithRelationsOpt() { return Optional.ofNullable(baseMapper.selectOneWithRelationsByQuery(this)); } - public Optional getOneWithRelationsAsOpt(Class asType) { + public Optional oneWithRelationsAsOpt(Class asType) { return Optional.ofNullable(baseMapper.selectOneWithRelationsByQueryAs(this, asType)); } - - - public List getList() { - return baseMapper.selectListByQuery(this); - } - - public List getListWithRelations() { - return baseMapper.selectListWithRelationsByQuery(this); - } - - public List getListAs(Class asType) { - return baseMapper.selectListByQueryAs(this, asType); - } - - public List getListWithRelationsAs(Class asType) { - return baseMapper.selectListWithRelationsByQueryAs(this, asType); - } - - public Page getPage(Page page) { - return baseMapper.paginate(page, this); - } - - public Page getPageWithRelations(Page page) { - return baseMapper.paginateWithRelations(page, this); - } - - public Page getPageAs(Page page, Class asType) { - return baseMapper.paginateAs(page, this, asType); - } - - public Page getPageWithRelationsAs(Page page, Class asType) { - return baseMapper.paginateWithRelationsAs(page, this, asType); - } - - - public Object getObj() { + public Object obj() { return baseMapper.selectObjectByQuery(this); } - public R getObjAs(Class asType) { + public R objAs(Class asType) { return baseMapper.selectObjectByQueryAs(this, asType); } - public Optional getObjOpt() { + public Optional objOpt() { return Optional.ofNullable(baseMapper.selectObjectByQuery(this)); } - public Optional getObjAsOpt(Class asType) { + public Optional objAsOpt(Class asType) { return Optional.ofNullable(baseMapper.selectObjectByQueryAs(this, asType)); } - - public List getObjList() { + public List objList() { return baseMapper.selectObjectListByQuery(this); } - public List getObjListAs(Class asType) { + public List objListAs(Class asType) { return baseMapper.selectObjectListByQueryAs(this, asType); } - public Optional getObjListOpt() { - return Optional.ofNullable(baseMapper.selectObjectListByQuery(this)); + public List list() { + return baseMapper.selectListByQuery(this); } - public Optional> getObjListAsOpt(Class asType) { - return Optional.ofNullable(baseMapper.selectObjectListByQueryAs(this, asType)); + public List listWithRelations() { + return baseMapper.selectListWithRelationsByQuery(this); + } + + public List listAs(Class asType) { + return baseMapper.selectListByQueryAs(this, asType); + } + + public List listWithRelationsAs(Class asType) { + return baseMapper.selectListWithRelationsByQueryAs(this, asType); + } + + public Page page(Page page) { + return baseMapper.paginate(page, this); + } + + public Page pageWithRelations(Page page) { + return baseMapper.paginateWithRelations(page, this); + } + + public Page pageAs(Page page, Class asType) { + return baseMapper.paginateAs(page, this, asType); + } + + public Page pageWithRelationsAs(Page page, Class asType) { + return baseMapper.paginateWithRelationsAs(page, this, asType); } }