| | |
| | | package com.dsh.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.Banner; |
| | | import com.dsh.other.entity.FrequentlyAskedQuestions; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 获取广告管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/advertisement/listAll") |
| | | public List<Banner> listAll(@RequestBody AdvertisementQuery query){ |
| | | return bannerService.listAll(query); |
| | | public List<Banner> listAll(@RequestBody AdvertisementQuery query) { |
| | | return bannerService.listAll(query); |
| | | } |
| | | |
| | | /** |
| | | * 上/下架、删除常见问题 state=1为上架 2为下架 |
| | | */ |
| | | @RequestMapping("/base/advertisement/changeState") |
| | | public Object changeState(@RequestBody AdvertisementChangeStateDTO dto){ |
| | | public Object changeState(@RequestBody AdvertisementChangeStateDTO dto) { |
| | | return bannerService.changeState(dto); |
| | | } |
| | | |
| | |
| | | * 根据id获取广告数据 |
| | | */ |
| | | @RequestMapping("/base/advertisement/getById") |
| | | public Banner changeState(@RequestBody Integer bannerId){ |
| | | public Banner changeState(@RequestBody Integer bannerId) { |
| | | return bannerService.getById(bannerId); |
| | | } |
| | | |
| | | /** |
| | | * 添加广告管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/advertisement/addAdvertisement") |
| | | Object addAdvertisement(@RequestBody Banner banner){ |
| | | Object addAdvertisement(@RequestBody Banner banner) { |
| | | return bannerService.save(banner); |
| | | } |
| | | |
| | | /** |
| | | * 修改广告管理 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/advertisement/updateAdvertisement") |
| | | Object updateAdvertisement(@RequestBody Banner banner){ |
| | | Object updateAdvertisement(@RequestBody Banner banner) { |
| | | return bannerService.updateById(banner); |
| | | } |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题)", name = "position", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil<List<BannerVo>> queryBannerList(Integer position){ |
| | | public ResultUtil<List<BannerVo>> queryBannerList(Integer position) { |
| | | List<BannerVo> list2 = bannerService.list1(position); |
| | | return ResultUtil.success(list2); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/banner/index") |
| | | @ApiOperation(value = "获取首页图片", tags = {"获取首页图片"}) |
| | | public ResultUtil querySiteTimes() { |
| | | try { |
| | | List<Banner> list = bannerService.list(new QueryWrapper<Banner>().eq("position", position).eq("state", 1).orderByAsc("sort")); |
| | | List<BannerVo> list1 = new ArrayList<>(); |
| | | for (Banner banner : list) { |
| | | BannerVo bannerVo = new BannerVo(); |
| | | BeanUtils.copyProperties(banner, bannerVo); |
| | | list1.add(bannerVo); |
| | | } |
| | | return ResultUtil.success(list1); |
| | | }catch (Exception e){ |
| | | String result = bannerService.getFirst(); |
| | | return ResultUtil.success(result); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/class/hisotory") |
| | | public void createHistory(@RequestBody CreateHistoryDto createHistoryDto) { |
| | | createHistoryDto.setDate(new Date()); |
| | | |
| | | bannerService.createHistory(createHistoryDto); |
| | | |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/class/gethisotory") |
| | | public List<GetHistoryDto> getHistory(@RequestBody Integer studentId) { |
| | | List<GetHistoryDto> list = bannerService.gethistory(studentId); |
| | | |
| | | System.out.println("=-======GetHistoryDto========" + list); |
| | | return list; |
| | | |
| | | } |
| | | |
| | | |
| | | } |