| | |
| | | import com.ruoyi.other.service.BannerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/banner") |
| | | @Api(tags = "轮播图") |
| | | @Api("轮播图") |
| | | public class BannerController { |
| | | @Resource |
| | | private BannerService bannerService; |
| | |
| | | @ApiOperation(value = "banner列表", tags = {"小程序-banner"}) |
| | | public R<List<Banner>> list(String name, Integer jumpType, Integer position){ |
| | | List<Banner> list = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name) |
| | | .eq(Banner::getJumpType, jumpType) |
| | | .eq(Banner::getPosition, position) |
| | | .eq(jumpType!=null,Banner::getJumpType, jumpType) |
| | | .eq(position!=null,Banner::getPosition, position) |
| | | .list(); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加", tags = {"后台-广告管理-banner管理"}) |
| | | @ApiOperation(value = "广告管理-banner管理-添加", tags = {"管理后台"}) |
| | | public R add(@RequestBody Banner banner){ |
| | | bannerService.save(banner); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/delete") |
| | | @ApiOperation(value = "删除", tags = {"后台-广告管理-banner管理"}) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(value = "广告管理-banner管理-删除", tags = {"管理后台"}) |
| | | public R delete(@RequestParam Integer id){ |
| | | bannerService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/edit") |
| | | @ApiOperation(value = "修改", tags = {"后台-广告管理-banner管理"}) |
| | | @ApiOperation(value = "广告管理-banner管理-修改", tags = {"管理后台"}) |
| | | public R edit(@RequestBody Banner banner){ |
| | | bannerService.updateById(banner); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping("/detail") |
| | | @ApiOperation(value = "详情", tags = {"后台-广告管理-banner管理"}) |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "广告管理-banner管理-详情", tags = {"管理后台"}) |
| | | public R detail(@RequestParam Integer id){ |
| | | Banner byId = bannerService.getById(id); |
| | | return R.ok(byId); |
| | | } |
| | | @PostMapping("/page/list") |
| | | @ApiOperation(value = "列表", tags = {"后台-广告管理--banner"}) |
| | | @GetMapping("/page/list") |
| | | @ApiOperation(value = "广告管理-banner-列表", tags = {"管理后台"}) |
| | | public R<Page<Banner>> pagelist(String name, Integer jumpType, Integer position,Integer pageNum,Integer pageSize){ |
| | | Page<Banner> page = bannerService.lambdaQuery().like(StringUtils.isNotEmpty(name), Banner::getName, name) |
| | | .eq(Banner::getJumpType, jumpType) |
| | | .eq(Banner::getPosition, position) |
| | | .eq(jumpType!=null,Banner::getJumpType, jumpType) |
| | | .eq(position!=null,Banner::getPosition, position) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |