page(Long currentPage, Integer pageSize, String userName, String roleId, String menuId,
String intfcId) {
return this.page(User.class, "sec.user.find", currentPage, pageSize, "valid", State.VALID, "roleId", roleId,
"menuId", menuId, "intfcId", intfcId, "userName", userName);
}
……
}
```
6.3 其中,封装一个基础服务类ServiceImpl,该类继承自cn.tenmg.hibernate.plus.service.impl.AbstractService以便继承对数据库的CURD操作。该类仅需注入配置的Dao并实现getDao方法即可。AbstractService主要是基于Dao的接口实现并指定了所对应的实体类型,以便简化对 Service对应的实体对象 的CURD操作。如果不进行此项封装,也可以每个Service实现类单独注入Dao,并使用Dao的接口执行CURD操作。
```
/**
* 数据库访问基础服务
*
* @author June
*
* @param
*/
public class ServiceImpl
extends cn.tenmg.hibernate.plus.service.impl.AbstractService
{
@Autowired
protected Dao dao;
@Override
protected Dao getDao() {
return dao;
}
}
```
### 7. 配置DSQL文件
配置`user.dsql.xml`,注意需要将文件放在`XMLFileDSQLFactory`扫描的路径下。
```
```
## 相关链接
dsql开源地址:https://gitee.com/tenmg/dsql
sql-paging开源地址:https://gitee.com/tenmg/sql-paging