44323
2024-04-23 16b704d18a875d1fb63827aaa507790ba2bef5be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package com.stylefeng.guns.modular.code.controller;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.stylefeng.guns.modular.system.dto.OrderQuery;
import com.stylefeng.guns.modular.system.model.Package;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.vo.OrderDetailVO;
import com.stylefeng.guns.modular.system.vo.OrderListVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
/**
 * @author 无关风月
 * @Date 2024/2/6 18:25
 */
@Slf4j
@RestController
@RequestMapping("")
public class BannerController {
    @Autowired
    private IFitnessTypeService fitnessTypeService;
    @Autowired
    private IFitnessPositionService fitnessPositionService;
    @Autowired
    private IAppUserService appUserService;
    @Autowired
    private ICourseService courseService;
    @Autowired
    private ICourseVideoService courseVideoService;
    @Autowired
    private IOrderService orderService;
    @Autowired
    private IOrderCourseService orderCourseService;
    @Autowired
    private ICouponService couponService;
    @Autowired
    private IPackageService packageService;
    @Autowired
    private IProtocolService protocolService;
    @Autowired
    private IBannerService bannerService;
 
    @ResponseBody
    @PostMapping("/base/banner/list")
    @ApiOperation(value = "列表查询", tags = {"banner管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "banner名称", name = "name"),
            @ApiImplicitParam(value = "跳转页面", name = "pageName"),
            @ApiImplicitParam(value = "状态1上架2下架", name = "state"),
            @ApiImplicitParam(value = "页码,首页1", name = "pageNum", dataType = "int"),
            @ApiImplicitParam(value = "页条数", name = "pageSize", dataType = "int"),
    })
    public ResultUtil<PageInfo<Banner>> list(String name, String pageName,Integer state, Integer pageNum, Integer pageSize) {
        EntityWrapper<Banner> wrapper = new EntityWrapper<>();
        if (StringUtils.hasLength(name)){
            wrapper.like("name",name);
        }
        if (StringUtils.hasLength(pageName)){
            wrapper.like("pageName",pageName);
        }
        if (state!=null){
            wrapper.eq("state",state);
        }
        List<String> strings = new ArrayList<>();
        strings.add("id");
        wrapper.orderDesc(strings);
        wrapper.ne("state",3);
        List<Banner> res = bannerService.selectList(wrapper);
//        PageHelper.startPage(pageNum,pageSize);
        PageInfo<Banner> info=new PageInfo<>(res);
        return ResultUtil.success(info);
    }
 
 
    @ResponseBody
    @PostMapping("/base/banner/addOrUpdateBanner")
    @ApiOperation(value = "banner新增/修改", tags = {"banner管理"})
    public ResultUtil courseList(Banner banner) {
        if (banner.getId()!=null){
            bannerService.updateById(banner);
        }else{
            bannerService.insert(banner);
        }
        return ResultUtil.success();
    }
 
    @ResponseBody
    @PostMapping("/base/banner/bannerInfo")
    @ApiOperation(value = "banner详情", tags = {"banner管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "bannerId", name = "id"),
    })
    public ResultUtil<Banner> bannerInfo(Integer id) {
        Banner banner = bannerService.selectById(id);
        return ResultUtil.success(banner);
    }
 
    @ResponseBody
    @PostMapping("/base/banner/changeState")
    @ApiOperation(value = "修改banner状态", tags = {"banner管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "bannerid", name = "id"),
            @ApiImplicitParam(value = "状态1=上架 2=下架 3=删除", name = "state"),
    })
    public ResultUtil changeState(Integer id,Integer state) {
        Banner banner = bannerService.selectById(id);
        banner.setState(state);
        bannerService.updateById(banner);
        return ResultUtil.success();
    }
}