Search in sources :

Example 1 with DataScope

use of com.company.project.common.aop.annotation.DataScope in project springboot-manager by aitangbao.

the class SysContentController method findListByPage.

@ApiOperation(value = "查询分页数据")
@PostMapping("/listByPage")
@RequiresPermissions("sysContent:list")
@DataScope
public DataResult findListByPage(@RequestBody SysContentEntity sysContent) {
    Page page = new Page(sysContent.getPage(), sysContent.getLimit());
    LambdaQueryWrapper<SysContentEntity> queryWrapper = Wrappers.lambdaQuery();
    // 查询条件示例
    if (!StringUtils.isEmpty(sysContent.getTitle())) {
        queryWrapper.like(SysContentEntity::getTitle, sysContent.getTitle());
    }
    // 数据权限示例, 需手动添加此条件 begin
    if (!CollectionUtils.isEmpty(sysContent.getCreateIds())) {
        queryWrapper.in(SysContentEntity::getCreateId, sysContent.getCreateIds());
    }
    // 数据权限示例, 需手动添加此条件 end
    IPage<SysContentEntity> iPage = sysContentService.page(page, queryWrapper);
    return DataResult.success(iPage);
}
Also used : Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) SysContentEntity(com.company.project.entity.SysContentEntity) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) DataScope(com.company.project.common.aop.annotation.DataScope) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

IPage (com.baomidou.mybatisplus.core.metadata.IPage)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 DataScope (com.company.project.common.aop.annotation.DataScope)1 SysContentEntity (com.company.project.entity.SysContentEntity)1 ApiOperation (io.swagger.annotations.ApiOperation)1 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)1