From a21e7c0c99e35481c0b352763e0f7987eef742bf Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 23 十月 2023 09:45:10 +0800
Subject: [PATCH] 10.23bug2

---
 cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java |   76 +++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
index 924484e..5c317de 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/BannerController.java
@@ -1,10 +1,12 @@
 package com.dsh.other.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.dsh.other.entity.Banner;
-import com.dsh.other.entity.CreateHistoryDto;
-import com.dsh.other.entity.GetHistoryDto;
+import com.dsh.other.entity.*;
+import com.dsh.other.feignclient.model.AdvertisementChangeStateDTO;
+import com.dsh.other.feignclient.model.AdvertisementQuery;
 import com.dsh.other.model.BannerVo;
+import com.dsh.other.model.dto.siteDto.SelectDto;
+import com.dsh.other.model.vo.questionVo.QuestionSearchVO;
 import com.dsh.other.service.IBannerService;
 import com.dsh.other.util.ResultUtil;
 import io.swagger.annotations.ApiImplicitParam;
@@ -30,7 +32,47 @@
     private IBannerService bannerService;
 
 
+    /**
+     * 获取广告管理
+     * @return
+     */
+    @RequestMapping("/base/advertisement/listAll")
+    public List<Banner> listAll(@RequestBody AdvertisementQuery query){
+        return  bannerService.listAll(query);
+    }
+    /**
+     * 上/下架、删除常见问题 state=1为上架 2为下架
+     */
+    @RequestMapping("/base/advertisement/changeState")
+    public Object changeState(@RequestBody AdvertisementChangeStateDTO dto){
+        return bannerService.changeState(dto);
+    }
 
+    /**
+     * 根据id获取广告数据
+     */
+    @RequestMapping("/base/advertisement/getById")
+    public Banner changeState(@RequestBody Integer bannerId){
+        return bannerService.getById(bannerId);
+    }
+
+    /**
+     * 添加广告管理
+     * @return
+     */
+    @RequestMapping("/base/advertisement/addAdvertisement")
+    Object addAdvertisement(@RequestBody Banner banner){
+        return bannerService.save(banner);
+    }
+
+    /**
+     * 修改广告管理
+     * @return
+     */
+    @RequestMapping("/base/advertisement/updateAdvertisement")
+    Object updateAdvertisement(@RequestBody Banner banner){
+        return bannerService.updateById(banner);
+    }
 
     @ResponseBody
     @PostMapping("/base/banner/queryBannerList")
@@ -41,13 +83,32 @@
     public ResultUtil<List<BannerVo>> queryBannerList(Integer position){
         try {
             List<Banner> list = bannerService.list(new QueryWrapper<Banner>().eq("position", position).eq("state", 1).orderByAsc("sort"));
+
+            List<Banner> list2 = bannerService.list1(position);
+
             List<BannerVo> list1 = new ArrayList<>();
-            for (Banner banner : list) {
+            for (Banner banner : list2) {
                 BannerVo bannerVo = new BannerVo();
                 BeanUtils.copyProperties(banner, bannerVo);
                 list1.add(bannerVo);
             }
             return ResultUtil.success(list1);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+
+
+
+
+    @ResponseBody
+    @PostMapping("/base/banner/index")
+    @ApiOperation(value = "获取首页图片", tags = {"获取首页图片"})
+    public ResultUtil querySiteTimes(){
+        try {
+            String result =bannerService.getFirst();
+            return ResultUtil.success(result);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
@@ -68,9 +129,12 @@
     @ResponseBody
     @PostMapping("/class/gethisotory")
     public  List<GetHistoryDto> getHistory(@RequestBody Integer studentId){
+        List<GetHistoryDto> list =   bannerService.gethistory(studentId);
 
-      return   bannerService.gethistory(studentId);
-
+        System.out.println("=-======GetHistoryDto========"+list);
+      return   list;
 
     }
+
+
 }

--
Gitblit v1.7.1