12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package cn.stylefeng.guns.zjxl.cnotroller;
- import cn.stylefeng.guns.zjxl.model.ZjxlPartner;
- import cn.stylefeng.guns.zjxl.service.ZjxlPartnerService;
- import cn.stylefeng.guns.zjxlUtil.BaseController;
- import cn.stylefeng.guns.zjxlUtil.PageUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.List;
- /***
- * @ClassName: ZjxlPartnerController
- * @Description: 公司官网-合作伙伴
- * @Auther: shi kejing
- * @Date: 2020/11/3 14:56
- */
- @RestController
- @Api(description = "公司官网-合作伙伴")
- @RequestMapping(value = "/zjxl/partner")
- public class ZjxlPartnerController extends BaseController {
- @Autowired
- private ZjxlPartnerService partnerService;
- @RequestMapping(value = "/findPartenrById", method = RequestMethod.GET)
- @ApiOperation("查询合作伙伴")
- public String findPartenrById(
- @ApiParam(name = "id", value = "partnerId", required = false) @RequestParam(value = "id", required = false)String id,
- @ApiParam(name = "name", value = "partnername", required = false) @RequestParam(value = "name", required = false)String name,
- @ApiParam(name = "pageNo", value = "第几页", defaultValue = "1") @RequestParam(value = "pageNo", required = false) Integer pageNo,
- @ApiParam(name = "pageSize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pageSize", required = false) Integer pageSize){
- try {
- List<ZjxlPartner> partnerList = partnerService.findPartenrById(id,name,pageNo-1,pageSize);
- return write(200,"查询成功", "data", PageUtil.getPage(partnerList,pageNo,pageSize,partnerService.allCount()));
- }catch (Exception e){
- e.printStackTrace();
- return write(-1,"查询失败");
- }
- }
- @RequestMapping(value = "/addPartenr", method = RequestMethod.POST)
- @ApiOperation(value = "添加合作伙伴")
- public String addPartenr(@ApiParam(name = "partnerName", value = "合作伙伴名称", required = false) @RequestParam(value = "partnerName", required = false)String partnerName,
- @ApiParam(name = "partnerImg", value = "合作伙伴图片", required = false) @RequestParam(value = "partnerImg", required = false)String partnerImg,
- @ApiParam(name = "partnerSort", value = "排序", required = false) @RequestParam(value = "partnerSort", required = false)Integer partnerSort,
- @ApiParam(name = "partnerIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "partnerIsLine", required = false)Integer partnerIsLine){
- try {
- ZjxlPartner partner = new ZjxlPartner();
- partner.setPartnerName(partnerName);
- partner.setPartnerImg(partnerImg);
- partner.setPartnerSort(partnerSort);
- partner.setPartnerIsLine(partnerIsLine);
- return write(200,"添加成功","data",partnerService.addPartenr(partner));
- }catch (Exception e){
- e.printStackTrace();
- return write(-1,"添加失败");
- }
- }
- @RequestMapping(value = "/updatePartner", method = RequestMethod.POST)
- @ApiOperation(value = "合作伙伴修改上线")
- public String updatePartner(String id, Integer isLine){
- try {
- return write(200,"修改上线成功","data",partnerService.updatePartner(id,isLine));
- }catch (Exception e){
- e.printStackTrace();
- return write(-1,"修改上线失败");
- }
- }
- @RequestMapping(value = "/deletePartner", method = RequestMethod.POST)
- @ApiOperation(value = "删除合作伙伴")
- public String deletePartner(String id){
- try {
- return write(200,"删除成功","data",partnerService.deletePartner(id));
- }catch (Exception e){
- e.printStackTrace();
- return write(-1,"删除失败");
- }
- }
- }
|