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> list(String name, String pageName,Integer state, Integer pageNum, Integer pageSize) { EntityWrapper 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 strings = new ArrayList<>(); strings.add("id"); wrapper.orderDesc(strings); wrapper.ne("state",3); List res = bannerService.selectList(wrapper); // PageHelper.startPage(pageNum,pageSize); PageInfo 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 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(); } }