| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.TSysBanner; |
| | | import com.ruoyi.system.query.TSysBannerQuery; |
| | | import com.ruoyi.system.service.TSysBannerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-08-20 |
| | | */ |
| | | @Api(tags = "banner管理") |
| | | @RestController |
| | | @RequestMapping("/t-sys-banner") |
| | | public class TSysBannerController { |
| | | private final TSysBannerService sysBannerService; |
| | | @Autowired |
| | | public TSysBannerController(TSysBannerService sysBannerService) { |
| | | this.sysBannerService = sysBannerService; |
| | | } |
| | | |
| | | /** |
| | | * 获取banner管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取banner管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysBanner>> pageList(@RequestBody TSysBannerQuery query) { |
| | | return R.ok(sysBannerService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取banner管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取banner管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TSysBanner>> list() { |
| | | return R.ok(sysBannerService.list(Wrappers.lambdaQuery(TSysBanner.class).orderByDesc(TSysBanner::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加banner管理管理 |
| | | */ |
| | | @Log(title = "banner管理信息-新增banner管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加banner管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TSysBanner dto) { |
| | | if (sysBannerService.isExit(dto)) { |
| | | return R.fail("banner管理名称已存在"); |
| | | } |
| | | return R.ok(sysBannerService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改banner管理 |
| | | */ |
| | | @Log(title = "banner管理信息-修改banner管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改banner管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TSysBanner dto) { |
| | | if (sysBannerService.isExit(dto)) { |
| | | return R.fail("banner管理名称已存在"); |
| | | } |
| | | return R.ok(sysBannerService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看banner管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看banner管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysBanner> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysBannerService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除banner管理 |
| | | */ |
| | | @Log(title = "banner管理信息-删除banner管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除banner管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(sysBannerService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除banner管理 |
| | | */ |
| | | @Log(title = "banner管理信息-删除banner管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除banner管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(sysBannerService.removeByIds(ids)); |
| | | } |
| | | } |
| | | |