com.baomidou.mybatisplus.plugins.Page Java Examples

The following examples show how to use com.baomidou.mybatisplus.plugins.Page. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StaffExpressController.java    From express-ssm with Apache License 2.0 6 votes vote down vote up
/**
 * 获取所有等待接单的订单
 * @author jitwxs
 * @since 2018/5/14 17:39
 */
@RequestMapping("/list")
public Map listExpress(Integer rows, Integer page, ExpressSelectWrapper esw, @RequestParam(defaultValue = "createDate") String order) {
    // Get请求中文编码
    try {
        esw.setName(globalFunction.iso8859ToUtf8(esw.getName()));
        esw.setAddress(globalFunction.iso8859ToUtf8(esw.getAddress()));
        esw.setStaffName(globalFunction.iso8859ToUtf8(esw.getStaffName()));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    // 得到筛选条件
    EntityWrapper<Express> expressWrapper = globalFunction.getExpressWrapper(esw);
    // 设置仅查找等待接单的订单
    expressWrapper.eq("status", ExpressStatusEnum.WAIT_DIST.getIndex());
    Page<Express> selectPage = expressService.selectPage(new Page<>(page, rows,order,false), expressWrapper);

    List<ExpressDto> list = globalFunction.express2dto(selectPage.getRecords());

    Map<String,Object> map = new HashMap<>();
    map.put("total", selectPage.getTotal());
    map.put("rows", list);
    return map;
}
 
Example #2
Source File: NetworkController.java    From paas with Apache License 2.0 6 votes vote down vote up
/**
 * 获取网络列表 - 用户接口
 * @param type 1:公共网络;2:个人网络;其他:个人网络 + 公共网络
 * @author jitwxs
 * @since 2018/7/14 16:43
 */
@GetMapping("/list")
@PreAuthorize("hasRole('ROLE_USER')")
public ResultVO listNetwork(@RequestParam(defaultValue = "-1") int type, @RequestAttribute String uid,
                            @RequestParam(defaultValue = "1") Integer current,
                            @RequestParam(defaultValue = "10") Integer size) {
    Page<SysNetwork> page = new Page<>(current,size,"create_date",false);
    switch (type) {
        case 1:
            return ResultVOUtils.success(networkService.listAllNetwork(page, true));
        case 2:
            return ResultVOUtils.success(networkService.listSelfNetwork(page, uid));
        default:
            return ResultVOUtils.success(networkService.listSelfAndPublicNetwork(page, uid));
    }
}
 
Example #3
Source File: BlogPageController.java    From mysiteforme with Apache License 2.0 6 votes vote down vote up
/**
 * 跳转文章专栏列表页
 * @param httpServletRequest
 * @param model
 * @return
 */
@GetMapping(value = {"/wzzl","/wzzl/**"})
public String articleParttener(@RequestParam(value = "page",defaultValue = "1")Integer page,
                               @RequestParam(value = "limit",defaultValue = "10")Integer limit,
                               HttpServletRequest httpServletRequest,Model model) {
    String href = httpServletRequest.getRequestURI();
    href = href.replaceFirst("/showBlog","");
    if(href.endsWith("/")){
        href = href.substring(0,href.length()-1);
    }
    Map<String,Object> map = Maps.newHashMap();
    BlogChannel blogChannel = blogChannelService.getChannelByHref(href);
    if(blogChannel == null){
        throw new MyException("地址没找到",404);
    }
    if(blogChannel.getParentId() == null){
        map.put("rootId",blogChannel.getParentIds());
    }else {
        map.put("channelId",blogChannel.getId());
    }
    model.addAttribute("channel",blogChannel);
    Page<BlogArticle> pageList = blogArticleService.selectDetailArticle(map,new Page<BlogArticle>(page,limit));
    model.addAttribute("pagelist",pageList);
    return "blog/article";
}
 
Example #4
Source File: UserServiceImpl.java    From easyweb-shiro with MIT License 6 votes vote down vote up
@Override
public PageResult<User> list(int pageNum, int pageSize, boolean showDelete, String column, String value) {
    Wrapper<User> wrapper = new EntityWrapper<>();
    if (StringUtil.isNotBlank(column)) {
        wrapper.like(column, value);
    }
    if (!showDelete) {  // 不显示锁定的用户
        wrapper.eq("state", 0);
    }
    Page<User> userPage = new Page<>(pageNum, pageSize);
    List<User> userList = userMapper.selectPage(userPage, wrapper.orderBy("create_time", true));
    if (userList != null && userList.size() > 0) {
        // 查询user的角色
        List<UserRole> userRoles = userRoleMapper.selectByUserIds(getUserIds(userList));
        for (User one : userList) {
            List<Role> tempURs = new ArrayList<>();
            for (UserRole ur : userRoles) {
                if (one.getUserId().equals(ur.getUserId())) {
                    tempURs.add(new Role(ur.getRoleId(), ur.getRoleName()));
                }
            }
            one.setRoles(tempURs);
        }
    }
    return new PageResult<>(userPage.getTotal(), userList);
}
 
Example #5
Source File: StaffExpressController.java    From express-ssm with Apache License 2.0 6 votes vote down vote up
/**
 * 获取所有个人的订单
 * @author jitwxs
 * @since 2018/5/14 17:39
 */
@RequestMapping("/selfList")
public Map listSelfExpress(Integer rows, Integer page, ExpressSelectWrapper esw, @RequestParam(defaultValue = "createDate") String order) {
    // Get请求中文编码
    try {
        esw.setName(globalFunction.iso8859ToUtf8(esw.getName()));
        esw.setAddress(globalFunction.iso8859ToUtf8(esw.getAddress()));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    // 得到筛选条件
    EntityWrapper<Express> expressWrapper = globalFunction.getExpressWrapper(esw);
    // 设置查找当前用户的订单
    expressWrapper.eq("staff", globalFunction.getUserId());
    Page<Express> selectPage = expressService.selectPage(new Page<>(page, rows, order, false), expressWrapper);

    List<ExpressDto> list = globalFunction.express2dto(selectPage.getRecords());

    Map<String,Object> map = new HashMap<>();
    map.put("total", selectPage.getTotal());
    map.put("rows", list);
    return map;
}
 
Example #6
Source File: StaffController.java    From express-ssm with Apache License 2.0 6 votes vote down vote up
/**
 * 获取所有职员
 * @author jitwxs
 * @since 2018/5/2 16:50
 */
@GetMapping("/list")
public Map listStaff(Integer rows, Integer page, SysUserSelectWrapper usw) {
    // Get请求中文编码
    try {
        usw.setName(globalFunction.iso8859ToUtf8(usw.getName()));
        usw.setAddress(globalFunction.iso8859ToUtf8(usw.getAddress()));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    // 得到筛选条件
    EntityWrapper<SysUser> userWrapper = globalFunction.getSysUserWrapper(usw);
    // 不显示admin角色
    userWrapper.ne("role_id", RoleEnum.ADMIN.getIndex());
    Page<SysUser> selectPage = userService.selectPage(new Page<>(page, rows), userWrapper);

    List<SysUserDto> list = globalFunction.sysUser2dto(selectPage.getRecords());

    Map<String,Object> map = new HashMap<>();
    map.put("total", selectPage.getTotal());
    map.put("rows", list);

    return map;
}
 
Example #7
Source File: UserConteroller.java    From mysiteforme with Apache License 2.0 6 votes vote down vote up
@RequiresPermissions("sys:user:list")
@PostMapping("list")
@ResponseBody
public LayerData<User> list(@RequestParam(value = "page",defaultValue = "1")Integer page,
                            @RequestParam(value = "limit",defaultValue = "10")Integer limit,
                            ServletRequest request){
    Map map = WebUtils.getParametersStartingWith(request, "s_");
    LayerData<User> userLayerData = new LayerData<>();
    EntityWrapper<User> userEntityWrapper = new EntityWrapper<>();
    if(!map.isEmpty()){
        String keys = (String) map.get("key");
        if(StringUtils.isNotBlank(keys)) {
            userEntityWrapper.like("login_name", keys).or().like("tel", keys).or().like("email", keys);
        }
    }
    Page<User> userPage = userService.selectPage(new Page<>(page,limit),userEntityWrapper);
    userLayerData.setCount(userPage.getTotal());
    userLayerData.setData(userPage.getRecords());
    return  userLayerData;
}
 
Example #8
Source File: OrderController.java    From MeetingFilm with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "getOrderInfo", method = RequestMethod.POST)
public ResponseVO getOrderInfo(
        @RequestParam(name = "nowPage", required = false, defaultValue = "1") Integer nowPage,
        @RequestParam(name = "pageSize", required = false, defaultValue = "5") Integer pageSize
) {

    // 获取当前登陆人的信息
    String userId = CurrentUser.getCurrentUser();

    // 使用当前登陆人获取已经购买的订单
    Page<OrderVO> page = new Page<>(nowPage, pageSize);
    if (userId != null && userId.trim().length() > 0) {
        Page<OrderVO> result = orderServiceAPI.getOrderByUserId(Integer.parseInt(userId), page);
        // 合并结果
        int totalPages = (int) result.getPages();

        List<OrderVO> orderVOList = new ArrayList<>();
        orderVOList.addAll(result.getRecords());
        return ResponseVO.success(nowPage, totalPages, "", orderVOList);

    } else {
        return ResponseVO.serviceFail("用户未登陆");
    }
}
 
Example #9
Source File: CinemaController.java    From MeetingFilm with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "getCinemas")
public ResponseVO getCinemas(CinemaQueryVO cinemaQueryVO) {
    try {
        // 按照五个条件进行筛选
        Page<CinemaVO> cinemas = cinemaServiceAPI.getCinemas(cinemaQueryVO);
        // 判断是否有满足条件的影院
        if (cinemas.getRecords() == null || cinemas.getRecords().size() == 0) {
            return ResponseVO.success("没有影院可查");
        } else {
            return ResponseVO.success(cinemas.getCurrent(), (int) cinemas.getPages(), "", cinemas.getRecords());
        }

    } catch (Exception e) {
        // 如果出现异常,应该如何处理
        log.error("获取影院列表异常", e);
        return ResponseVO.serviceFail("查询影院列表失败");
    }
}
 
Example #10
Source File: FeedbackController.java    From express-ssm with Apache License 2.0 6 votes vote down vote up
/**
 * 获取所有反馈
 * @author jitwxs
 * @since 2018/5/14 14:35
 */
@GetMapping("/list")
public Map listFeedback(Integer rows, Integer page, FeedbackSelectWrapper fsw, @RequestParam(defaultValue = "createDate") String order) {
    // Get请求中文编码
    try {
        fsw.setName(globalFunction.iso8859ToUtf8(fsw.getName()));
        fsw.setStaffName(globalFunction.iso8859ToUtf8(fsw.getStaffName()));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    // 得到筛选条件
    EntityWrapper<Feedback> feedbackWrapper = globalFunction.getFeedbackWrapper(fsw);
    Page<Feedback> selectPage = feedbackService.selectPage(new Page<>(page, rows,order,false), feedbackWrapper);

    List<FeedbackDto> list = globalFunction.feedback2dto(selectPage.getRecords());

    Map<String,Object> map = new HashMap<>();
    map.put("total", selectPage.getTotal());
    map.put("rows", list);
    return map;
}
 
Example #11
Source File: CrudServiceImpl.java    From Ffast-Java with MIT License 6 votes vote down vote up
@Override
public ServiceRowsResult findListByPage(T m, Page<T> page, String[] properties) {
    ServiceRowsResult result = new ServiceRowsResult(false);
    EntityWrapper ew = new EntityWrapper<T>(m);
    if (properties != null) {
        ew.setSqlSelect(properties);
    }
    ServiceRowsResult beforeResult = listBefore(m, ew);
    if (beforeResult != null) {
        return beforeResult;
    }

    page = selectPage(page, ew);
    ServiceRowsResult afterResult = listAfter(m, page.getRecords());
    if (afterResult != null) {
        return afterResult;
    }
    result.setPage(page.getRecords(), page.getTotal());
    result.setSuccess(true);
    return result;
}
 
Example #12
Source File: ContainerController.java    From paas with Apache License 2.0 6 votes vote down vote up
/**
 * 获取容器列表
 * 普通用户获取本人容器,系统管理员获取所有容器
 *
 * @param name 容器名
 * @author jitwxs
 * @since 2018/7/9 11:19
 */
@GetMapping("/list")
@PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_SYSTEM')")
public ResultVO listContainer(@RequestAttribute String uid, String name, Integer status,
                              @RequestParam(defaultValue = "1") Integer current,
                              @RequestParam(defaultValue = "10") Integer size) {
    // 鉴权
    String roleName = loginService.getRoleName(uid);
    // 角色无效
    if (StringUtils.isBlank(roleName)) {
        return ResultVOUtils.error(ResultEnum.AUTHORITY_ERROR);
    }

    Page<UserContainer> page = new Page<>(current, size, "update_date", false);
    Page<UserContainerDTO> selectPage = null;

    if (RoleEnum.ROLE_USER.getMessage().equals(roleName)) {
        selectPage = containerService.listContainerByUserId(uid, name, status, page);
    } else if (RoleEnum.ROLE_SYSTEM.getMessage().equals(roleName)) {
        selectPage = containerService.listContainerByUserId(null, name, status, page);
    }

    return ResultVOUtils.success(selectPage);
}
 
Example #13
Source File: ServiceController.java    From paas with Apache License 2.0 6 votes vote down vote up
/**
 * 获取服务列表
 * 普通用户获取本人服务,系统管理员获取所有服务
 * @author hf
 * @since 2018/7/13 11:19
 */
@GetMapping("/list")
@PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_SYSTEM')")
public ResultVO listService(@RequestAttribute String uid, Page<UserService> page) {
    // 鉴权
    String roleName = loginService.getRoleName(uid);
    // 角色无效
    if(StringUtils.isBlank(roleName)) {
        return ResultVOUtils.error(ResultEnum.AUTHORITY_ERROR);
    }

    Page<UserServiceDTO> selectPage = null;

    if(RoleEnum.ROLE_USER.getMessage().equals(roleName)) {
        selectPage = userServiceService.listUserServiceByUserId(uid, page);
    } else if(RoleEnum.ROLE_SYSTEM.getMessage().equals(roleName)) {
        selectPage = userServiceService.listUserServiceByUserId(null, page);
    }
    return ResultVOUtils.success(selectPage);
}
 
Example #14
Source File: ServiceController.java    From paas with Apache License 2.0 6 votes vote down vote up
/**
 * 获取项目服务列表
 * 普通用户获取本人项目的容器,系统管理员任意项目的容器
 * @author hf
 * @since 2018/7/13 15:16
 */
@GetMapping("{projectId}/list")
@PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_SYSTEM')")
public ResultVO listServiceByProject(@RequestAttribute String uid, @PathVariable String projectId, Page<UserService> page) {
    // 1、鉴权
    String roleName = loginService.getRoleName(uid);
    // 1.1、角色无效
    if(StringUtils.isBlank(roleName)) {
        return ResultVOUtils.error(ResultEnum.AUTHORITY_ERROR);
    }
    // 1.2、越权访问
    if(RoleEnum.ROLE_USER.getMessage().equals(roleName)) {
        if(!projectService.hasBelong(projectId, uid)) {
            return ResultVOUtils.error(ResultEnum.PERMISSION_ERROR);
        }
    }

    // 2、查询
    Page<UserService> selectPage = userServiceService.selectPage(page,
            new EntityWrapper<UserService>().eq("project_id", projectId));

    return ResultVOUtils.success(dtoConvert.convert(selectPage));
}
 
Example #15
Source File: AdminTagController.java    From MI-S with MIT License 5 votes vote down vote up
/**
 * 分页加载标签
 * @param pages 分页对象
 * @param param  搜索条件
 * @param model
 * @return
 */
@RequestMapping("/list")
public String selectPage(Page pages, String param, Model model) {
    Page<Tag> page;
    EntityWrapper<Tag> ex = new EntityWrapper<>();
    if (StringUtils.checkValNotNull(param)) {
        ex.where("tag_name like concat('%',{0},'%')", param);
    }
    ex.orderBy("sort", true);
    ex.orderBy("create_time", true);
    page = iTagService.selectPage(new Page(pages.getCurrent(), pages.getSize()), ex);
    model.addAttribute("page", page);
    return "admin/tag/tagTable";
}
 
Example #16
Source File: IosVersionServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult listSort(int page, int pageSize, EntityWrapper<IosVersion> wrapper) {
    Page<IosVersion> versionPage = new Page<>(page,pageSize);
    List<IosVersion> iosVersions = iosVersionMapper.selectList(wrapper);
    iosVersions.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getAppVersion(),o1.getAppVersion()));
    List<IosVersion> pageList = iosVersions.subList((page-1) * pageSize, pageSize * page >= iosVersions.size() ? iosVersions.size() : pageSize * page);
    versionPage.setRecords(pageList);
    versionPage.setTotal(iosVersions.size());
    basicService.formatCreatedBy(versionPage.getRecords());
    return ServiceResult.ok(versionPage);
}
 
Example #17
Source File: SysVolumeServiceImpl.java    From paas with Apache License 2.0 5 votes vote down vote up
@Override
public ResultVO listByObjId(Page<SysVolumeVO> page, String objId, String uid) {
    // 鉴权
    String roleName = loginService.getRoleName(uid);
    if(StringUtils.isBlank(roleName)) {
        return ResultVOUtils.error(ResultEnum.AUTHORITY_ERROR);
    }
    if(RoleEnum.ROLE_USER.getMessage().equals(roleName)) {
        // 判断Obj类型
        UserContainer container = containerMapper.selectById(objId);
        UserService service = null;
        if(container == null) {
            service = serviceMapper.selectById(objId);
        }

        if(container == null && service == null) {
            return ResultVOUtils.success(ResultEnum.VOLUME_OBJ_NOT_EXIST);
        }

        if(container != null && !containerMapper.hasBelongSb(objId, uid)) {
            return ResultVOUtils.error(ResultEnum.PERMISSION_ERROR);
        } else if(service != null && !serviceMapper.hasBelong(objId, uid)) {
            return ResultVOUtils.error(ResultEnum.PERMISSION_ERROR);
        }
    }

    // 查询
    try {
        List<SysVolumeVO> voList = sysVolume2VO(volumesMapper.selectByObjId(objId, page));
        return ResultVOUtils.success(page.setRecords(voList));
    } catch (Exception e) {
        return ResultVOUtils.error(ResultEnum.VOLUME_INFO_ERROR.getCode(), e.getMessage());
    }
}
 
Example #18
Source File: DictController.java    From cola-cloud with MIT License 5 votes vote down vote up
/**
 * 获取数据字典目录列表
 */
@GetMapping(value = "/list")
@ApiOperation("获取数据字典目录列表")
public Result<Page<List<Dict>>> list(String code, String name) {
    EntityWrapper wrapper = new EntityWrapper();
    wrapper.like("code",code);
    wrapper.like("name",name);
    return this.success(dictService.selectPage(this.getPagination(),wrapper));
}
 
Example #19
Source File: ApkServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult getApkPageWithChannelCode(int page, int pageSize, Integer versionId, String channelCode, String md5, Integer deliveryStatus) {
    AndroidVersion androidVersion = androidVersionMapper.selectById(versionId);
    if (androidVersion == null) {
        return ServiceResultConstants.VERSION_NOT_EXISTS;
    }
    Page<ApkExt> apkPage = new Page<>();
    apkPage.setCurrent(page);
    apkPage.setSize(pageSize);
    apkPage.setRecords(apkMapper.selectApkWithChannelCode(apkPage, versionId, channelCode, md5, deliveryStatus));
    basicService.formatCreatedBy(apkPage.getRecords());
    return ServiceResult.ok(apkPage);
}
 
Example #20
Source File: AndroidVersionServiceImpl.java    From app-version with Apache License 2.0 5 votes vote down vote up
@Override
public ServiceResult listSort(int page, int pageSize, EntityWrapper<AndroidVersion> wrapper) {
    Page<AndroidVersion> pageEntity = new Page<>(page, pageSize);
    List<AndroidVersion> androidVersions = androidVersionMapper.selectList(wrapper);
    androidVersions.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getAppVersion(),o1.getAppVersion()));
    List<AndroidVersion> pageList = androidVersions.subList((page-1) * pageSize, pageSize * page >= androidVersions.size() ? androidVersions.size() : pageSize * page);
    pageEntity.setRecords(pageList);
    pageEntity.setTotal(androidVersions.size());
    basicService.formatCreatedBy(pageEntity.getRecords());
    return ServiceResult.ok(pageEntity);
}
 
Example #21
Source File: LogServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
public ServiceRowsResult findListByPage(Log m, Page<Log> page, String[] properties) {
    ServiceRowsResult result = new ServiceRowsResult(false);
    page.setRecords(baseMapper.listByPage(page, m));
    result.setPage(page.getRecords(), page.getTotal());
    result.setSuccess(true);
    return result;
}
 
Example #22
Source File: BaseController.java    From xmanager with Apache License 2.0 5 votes vote down vote up
public <T> Page<T> getPage(int current, int size, String sort, String order){
    Page<T> page = new Page<T>(current, size, sort);
    if ("desc".equals(order)) {
        page.setAsc(false);
    } else {
        page.setAsc(true);
    }
    return page;
}
 
Example #23
Source File: RescourceController.java    From mysiteforme with Apache License 2.0 5 votes vote down vote up
@RequiresPermissions("sys:rescource:list")
@PostMapping("list")
@ResponseBody
public LayerData<Rescource> list(@RequestParam(value = "page",defaultValue = "1")Integer page,
                                 @RequestParam(value = "limit",defaultValue = "10")Integer limit,
                                 ServletRequest request){
    Map map = WebUtils.getParametersStartingWith(request, "s_");
    LayerData<Rescource> layerData = new LayerData<>();
    EntityWrapper<Rescource> wrapper = new EntityWrapper<>();
    if(!map.isEmpty()){
        String type = (String) map.get("type");
        if(StringUtils.isNotBlank(type)) {
            wrapper.like("file_type", type);
        }
        String hash = (String)map.get("hash");
        if(StringUtils.isNotBlank(hash)){
            wrapper.eq("hash",hash);
        }
        String source = (String)map.get("source");
        if(StringUtils.isNotBlank(source)){
            wrapper.eq("source",source);
        }
    }
    Page<Rescource> dataPage = rescourceService.selectPage(new Page<>(page,limit),wrapper);
    layerData.setCount(dataPage.getTotal());
    layerData.setData(dataPage.getRecords());
    return layerData;
}
 
Example #24
Source File: BaseController.java    From xmanager with Apache License 2.0 5 votes vote down vote up
public <T> PageInfo pageToPageInfo(Page<T> page) {
    PageInfo pageInfo = new PageInfo();
    pageInfo.setRows(page.getRecords());
    pageInfo.setTotal(page.getTotal());
    pageInfo.setOrder(page.getOrderByField());
    return pageInfo;
}
 
Example #25
Source File: DefaultFilmServiceImpl.java    From MeetingFilm with Apache License 2.0 5 votes vote down vote up
/**
 * 票房排行榜
 *
 * @return
 */
@Override
public List<FilmInfo> getBoxRanking() {
    // 条件 -> 正在上映的,票房前10名
    EntityWrapper<MoocFilmT> entityWrapper = new EntityWrapper<>();
    entityWrapper.eq("film_status", "1");

    Page<MoocFilmT> page = new Page<>(1, 10, "film_box_office", false);

    List<MoocFilmT> moocFilms = moocFilmTMapper.selectPage(page, entityWrapper);

    List<FilmInfo> filmInfos = getFilmInfos(moocFilms);

    return filmInfos;
}
 
Example #26
Source File: MonitorController.java    From paas with Apache License 2.0 5 votes vote down vote up
/**
 * 获取系统日志
 * @author jitwxs
 * @since 2018/7/11 9:59
 */
@GetMapping("/log")
@PreAuthorize("hasRole('ROLE_SYSTEM')")
public ResultVO listSystemLog(SysLogSelect sysLogSelect,
                              @RequestParam(defaultValue = "1") Integer current,
                              @RequestParam(defaultValue = "10") Integer size) {
    Page<SysLogDTO> selectPage = sysLogService.listSystemLog(sysLogSelect,
            new Page<>(current, size, "create_date", false));
    return ResultVOUtils.success(selectPage);
}
 
Example #27
Source File: DefaultFilmServiceImpl.java    From MeetingFilm with Apache License 2.0 5 votes vote down vote up
@Override
public List<FilmInfo> getTop() {
    // 条件 -> 正在上映的,评分前10名
    EntityWrapper<MoocFilmT> entityWrapper = new EntityWrapper<>();
    entityWrapper.eq("film_status", "1");

    Page<MoocFilmT> page = new Page<>(1, 10, "film_score", false);

    List<MoocFilmT> moocFilms = moocFilmTMapper.selectPage(page, entityWrapper);

    List<FilmInfo> filmInfos = getFilmInfos(moocFilms);

    return filmInfos;
}
 
Example #28
Source File: ImageController.java    From paas with Apache License 2.0 5 votes vote down vote up
/**
 * 查找本地(服务器)镜像
 * 包含本地公共和本地用户镜像
 * @author jitwxs
 * @since 2018/7/3 15:46
 */
@GetMapping("/list/local")
@PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_SYSTEM')")
public ResultVO searchLocalImage(@RequestAttribute String uid,  String name, Integer type,
                                 @RequestParam(defaultValue = "1") Integer current,
                                 @RequestParam(defaultValue = "10") Integer size) {
    // 判断参数
    if(type == null) {
        return ResultVOUtils.error(ResultEnum.PARAM_ERROR);
    }

    Page<SysImageDTO> page = new Page<>(current, size, "create_date", false);

    String roleName = loginService.getRoleName(uid);

    if (type == ImageTypeEnum.LOCAL_PUBLIC_IMAGE.getCode()) {
        // 本地公共镜像
        return ResultVOUtils.success(imageService.listLocalPublicImage(name, page));
    } else if (type == ImageTypeEnum.LOCAL_USER_IMAGE.getCode()) {
        // 系统管理员查看所有本地用户镜像,普通用户只能查看公开的本地用户镜像和自己镜像
        if(RoleEnum.ROLE_USER.getMessage().equals(roleName)) {
            return ResultVOUtils.success(imageService.listLocalUserImage(name, true, uid, page));
        } else {
            return ResultVOUtils.success(imageService.listLocalUserImage(name, false, uid, page));
        }

    } else {
        return ResultVOUtils.error(ResultEnum.PARAM_ERROR);
    }
}
 
Example #29
Source File: SiteController.java    From WebStack-Guns with MIT License 5 votes vote down vote up
/**
 * 获取网站列表
 */
@RequestMapping(value = "/list")
@ResponseBody
public Object list(@RequestParam(required = false) String title) {
    Map map = new HashMap();
    map.put("title",title);
    Page<Site> page = new PageFactory<Site>().defaultPage();
    Pager<Site> pages = siteService.getPage(map, page.getOffset(), page.getLimit());
    page.setTotal(pages.getTotal());
    page.setRecords(pages.getList());
    return new PageInfoBT<>(page);
}
 
Example #30
Source File: SysUserServiceImpl.java    From pig with MIT License 5 votes vote down vote up
@Override
public Page selectWithRolePage(Query query, UserVO userVO) {
    DataScope dataScope = new DataScope();
    dataScope.setScopeName("deptId");
    dataScope.setIsOnly(true);
    dataScope.setDeptIds(getChildDepts(userVO));
    Object username = query.getCondition().get("username");
    query.setRecords(sysUserMapper.selectUserVoPageDataScope(query, username, dataScope));
    return query;
}