New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TBanner; |
| | | 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.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 轮播图管理 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author xiaochen |
| | | * @since 2025-02-07 |
| | | */ |
| | | @Api(tags = "轮播图管理") |
| | | @RestController |
| | | @RequestMapping("/t-banner") |
| | | public class TBannerController { |
| | | |
| | | private final TBannerService bannerService; |
| | | @Autowired |
| | | public TBannerController(TBannerService bannerService) { |
| | | this.bannerService = bannerService; |
| | | } |
| | | |
| | | /** |
| | | * 获取轮播图管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:list')") |
| | | @ApiOperation(value = "获取轮播图分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TBanner>> pageList(@RequestBody TBannerQuery query) { |
| | | return R.ok(bannerService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加轮播图管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:add')") |
| | | @Log(title = "轮播图信息-新增轮播图", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加轮播图") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TBanner dto) { |
| | | return R.ok(bannerService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:edit')") |
| | | @Log(title = "轮播图信息-修改轮播图", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改轮播图") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TBanner dto) { |
| | | return R.ok(bannerService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看轮播图详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:detail')") |
| | | @ApiOperation(value = "查看轮播图详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TBanner> getDetailById(@RequestParam String id) { |
| | | return R.ok(bannerService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:delete')") |
| | | @Log(title = "轮播图信息-删除轮播图", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除轮播图") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(bannerService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除轮播图 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:banner:delete')") |
| | | @Log(title = "轮播图信息-删除轮播图", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除轮播图") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(bannerService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |