| | |
| | | |
| | | private final Snowflake snowflake; |
| | | |
| | | /** |
| | | * 获取banner跳转列表 |
| | | */ |
| | | public List<BannerPositionDto> listPosition() { |
| | | return ListUtil.of(new BannerPositionDto("首页1", 0), new BannerPositionDto("首页2", 1), |
| | | new BannerPositionDto("首页3", 2), new BannerPositionDto("首页4", 3)); |
| | | } |
| | | // /** |
| | | // * 获取banner跳转列表 |
| | | // */ |
| | | // public List<BannerPositionDto> listPosition() { |
| | | // return ListUtil.of(new BannerPositionDto("首页1", 0), new BannerPositionDto("首页2", 1), |
| | | // new BannerPositionDto("首页3", 2), new BannerPositionDto("首页4", 3)); |
| | | // } |
| | | |
| | | /** |
| | | * 添加banner |
| | |
| | | banner.setId(snowflake.nextId()); |
| | | banner.setBannerUrl(ResUtils.removePrefix(bannerParam.getUrl())); |
| | | banner.setAuthor(SecurityUtils.getUsername()); |
| | | banner.setPosition(bannerParam.getPosition()); |
| | | banner.setBindingAuthor(bannerParam.getBinding_author()); |
| | | return save(banner); |
| | | } |
| | | |
| | |
| | | throw new BusinessException("找不到banner"); |
| | | } |
| | | Banner update = new Banner(); |
| | | // BeanUtils.copyProperties(bannerParam, update); |
| | | // BeanUtils.copyProperties(bannerParam, update); |
| | | update.setId(bannerId); |
| | | update.setPosition(bannerParam.getPosition()); |
| | | update.setBannerUrl(bannerParam.getUrl()); |
| | | update.setId(bannerId); |
| | | return updateById(update); |
| | | } |
| | | |
| | | /** |
| | | * 删除banner |
| | | * |
| | | * @param bannerId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询banner |
| | | * |
| | | * @return |
| | | */ |
| | | public List<Banner> listBanner() { |
| | | LambdaQueryWrapper<Banner> wrapper = Wrappers.lambdaQuery(Banner.class).eq(Banner::getPosition, 0); |
| | | LambdaQueryWrapper<Banner> wrapper = Wrappers.lambdaQuery(Banner.class); |
| | | List<Banner> list = list(wrapper); |
| | | for (Banner banner : list) { |
| | | banner.setBannerUrl(ResUtils.addPrefix(banner.getBannerUrl())); |