You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.7 KiB
Java

5 years ago
package com.gszc.controller;
5 years ago
import com.alibaba.fastjson.JSONObject;
5 years ago
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.gszc.build.Result;
import com.gszc.build.ResultBuilder;
import com.gszc.entity.Banner;
import com.gszc.entity.Invoice;
import com.gszc.service.impl.BannerServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@Api(value = "工商注册 API", tags = {"banner api"})
@RestController
@RequestMapping("/banner")
public class BannerController {
@Autowired
BannerServiceImpl bannerService;
@PostMapping("/addBanner")
@ApiOperation(value = "增加banner", notes = "增加banner")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result addBanner(@ModelAttribute @Valid Banner banner) {
bannerService.addBanner(banner);
return ResultBuilder.success().build();
}
@PostMapping("/deleteBanner")
@ApiOperation(value = "删除banner", notes = "删除banner")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result deleteBanner(@ModelAttribute @Valid Banner banner) {
bannerService.deleteBanner(banner);
return ResultBuilder.success().build();
}
@PostMapping("/updateBanner")
@ApiOperation(value = "更新banner", notes = "更新banner")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result updateBanner(@ModelAttribute @Valid Banner banner) {
bannerService.updateBanner(banner);
return ResultBuilder.success().build();
}
@PostMapping("/queryBanner")
@ApiOperation(value = "查看banner", notes = "查看banner")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
})
@ResponseBody
public Result queryBanner(Integer pageNum,Integer pageSize) {
5 years ago
JSONObject result = bannerService.queryBanner(pageNum, pageSize);
return ResultBuilder.withPayload(result).build();
5 years ago
}
}