构建基类服务查询条件
This commit is contained in:
parent
cf6c040eee
commit
a36b4df86b
10
README.md
10
README.md
@ -55,6 +55,16 @@ Ruoyi-Flex是一套全部开源的快速开发平台,使用MIT开源许可协
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
## 开源协议
|
||||||
|
|
||||||
|
**为什么推荐使用本项目?**
|
||||||
|
|
||||||
|
① 本项目采用比 Apache 2.0 更宽松的 [MIT License](https://gitee.com/dataprince/ruoyi-flex/blob/master/LICENSE) 开源协议,个人与企业可 100% 免费使用,不用保留类作者、Copyright 信息。
|
||||||
|
|
||||||
|
② 代码全部开源,不会像其它项目一样,只开源部分代码,让你无法了解整个项目的架构设计。
|
||||||
|
|
||||||
|
如果这个项目让您有所收获,记得 Star 关注哦,这对我是非常不错的鼓励与支持。
|
||||||
|
|
||||||
## 演示图
|
## 演示图
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
Binary file not shown.
@ -1,14 +0,0 @@
|
|||||||
package com.ruoyi.common.orm.core.service.impl;
|
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.mybatisflex.spring.service.impl.CacheableServiceImpl;
|
|
||||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
|
||||||
import com.ruoyi.common.orm.core.service.IBaseService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义的缓存服务基类的实现类
|
|
||||||
*
|
|
||||||
* @author dataprince数据小王子
|
|
||||||
*/
|
|
||||||
public abstract class BaseCacheableServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> extends CacheableServiceImpl<M , T> implements IBaseService<T> {
|
|
||||||
}
|
|
@ -1,7 +1,12 @@
|
|||||||
package com.ruoyi.common.orm.core.service.impl;
|
package com.ruoyi.common.orm.core.service.impl;
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.core.page.TableSupport;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||||
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
import com.ruoyi.common.orm.core.domain.BaseEntity;
|
||||||
import com.ruoyi.common.orm.core.service.IBaseService;
|
import com.ruoyi.common.orm.core.service.IBaseService;
|
||||||
|
|
||||||
@ -10,5 +15,19 @@ import com.ruoyi.common.orm.core.service.IBaseService;
|
|||||||
*
|
*
|
||||||
* @author dataprince数据小王子
|
* @author dataprince数据小王子
|
||||||
*/
|
*/
|
||||||
public abstract class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> extends ServiceImpl<M , T> implements IBaseService<T> {
|
public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> extends ServiceImpl<M , T> implements IBaseService<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造基本查询条件
|
||||||
|
* @return QueryWrapper
|
||||||
|
*/
|
||||||
|
protected QueryWrapper buildBaseQueryWrapper(){
|
||||||
|
QueryWrapper queryWrapper = query();
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
queryWrapper.orderBy(orderBy);
|
||||||
|
}
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user