From 5c6b1469792343d30781074c18880259498109b4 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 09 一月 2025 18:11:37 +0800
Subject: [PATCH] 修改bug
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java | 52 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
index d8785a1..d216f92 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BannerController.java
@@ -1,17 +1,15 @@
package com.ruoyi.other.controller;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.other.api.domain.Banner;
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.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import io.swagger.annotations.ApiParam;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@@ -26,19 +24,55 @@
*/
@RestController
@RequestMapping("/banner")
-@Api(tags = "轮播图")
+@Api("轮播图")
public class BannerController {
@Resource
private BannerService bannerService;
@GetMapping("/list")
@ApiOperation(value = "banner列表", tags = {"小程序-banner"})
- public R<List<Banner>> list(String name, Integer jumpType, Integer position){
+ public R<List<Banner>> list(@ApiParam("名称") String name,
+ @ApiParam("跳转类型(1=无跳转,2=外部链接,3=商品详情,4=秒杀商品详情,5=领券中心)") Integer jumpType,
+ @ApiParam("位置(1=首页,2=商城首页)") 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 = "广告管理-banner管理-添加", tags = {"管理后台"})
+ public R add(@RequestBody Banner banner){
+ bannerService.save(banner);
+ return R.ok();
+ }
+ @GetMapping("/delete")
+ @ApiOperation(value = "广告管理-banner管理-删除", tags = {"管理后台"})
+ public R delete(@RequestParam Integer id){
+ bannerService.removeById(id);
+ return R.ok();
+ }
+ @PostMapping("/edit")
+ @ApiOperation(value = "广告管理-banner管理-修改", tags = {"管理后台"})
+ public R edit(@RequestBody Banner banner){
+ bannerService.updateById(banner);
+ return R.ok();
+ }
+ @GetMapping("/detail")
+ @ApiOperation(value = "广告管理-banner管理-详情", tags = {"管理后台"})
+ public R detail(@RequestParam Integer id){
+ Banner byId = bannerService.getById(id);
+ return R.ok(byId);
+ }
+ @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(jumpType!=null,Banner::getJumpType, jumpType)
+ .eq(position!=null,Banner::getPosition, position)
+ .page(Page.of(pageNum, pageSize));
+ return R.ok(page);
+ }
+
}
--
Gitblit v1.7.1