| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.system.domain.TBanner; |
| | | import com.ruoyi.system.domain.TConfig; |
| | | import com.ruoyi.system.dto.TBannerDTO; |
| | | import com.ruoyi.system.query.TBannerQuery; |
| | | import com.ruoyi.system.service.TBannerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2024-02-29 |
| | | */ |
| | | @Api(tags = "banner管理") |
| | | @RestController |
| | | @RequestMapping("/tBanner") |
| | | public class TBannerController { |
| | | |
| | | private final TBannerService bannerService; |
| | | |
| | | @Autowired |
| | | public TBannerController(TBannerService bannerService) { |
| | | this.bannerService = bannerService; |
| | | } |
| | | |
| | | /** |
| | | * 获取banner列表 |
| | | */ |
| | | @ApiOperation(value = "获取banner分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TBanner>> pageList(@RequestBody TBannerQuery query) { |
| | | return AjaxResult.success(bannerService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加banner |
| | | */ |
| | | @ApiOperation(value = "添加banner") |
| | | @PostMapping(value = "/addBanner") |
| | | public AjaxResult addBanner(@RequestBody TBannerDTO dto) { |
| | | return AjaxResult.success(bannerService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改banner |
| | | */ |
| | | @ApiOperation(value = "修改banner") |
| | | @PostMapping(value = "/updateBanner") |
| | | public AjaxResult updateBanner(@RequestBody TBannerDTO dto) { |
| | | return AjaxResult.success(bannerService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看banner详情 |
| | | */ |
| | | @ApiOperation(value = "查看banner详情") |
| | | @GetMapping(value = "/getBannerDetailById") |
| | | public AjaxResult<TBanner> getBannerDetailById(@RequestParam Long id) { |
| | | return AjaxResult.success(bannerService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除banner |
| | | */ |
| | | @ApiOperation(value = "删除banner") |
| | | @GetMapping(value = "/deleteBannerById") |
| | | public AjaxResult deleteBannerById(@RequestParam Long id) { |
| | | return AjaxResult.success(bannerService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * banner上下架 |
| | | */ |
| | | @ApiOperation(value = "banner上下架") |
| | | @PostMapping(value = "/upAndDown") |
| | | public AjaxResult upAndDown(@RequestParam Long id, |
| | | @RequestParam Integer status) { |
| | | return AjaxResult.success(bannerService.upAndDown(id,status)); |
| | | } |
| | | |
| | | } |
| | | |