AdMgrController.java
2.66 KB
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
package com.glsx.controller;
import cn.com.glsx.openplatform.model.PlatformAd;
import cn.com.glsx.openplatform.service.AdMgrService;
import cn.com.glsx.openplatform.vo.R;
import cn.hutool.db.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
//@Api
@RestController
@RequestMapping(value = "/admgr")
public class AdMgrController {
/**
* 日志
*/
private final static Logger LOGGER = LoggerFactory.getLogger(AdMgrController.class);
@Autowired
private AdMgrService adMgrService;
@RequestMapping(value = "/getAdMgrList", method = RequestMethod.GET)
@ResponseBody
public R getAdMgrList(Page page, PlatformAd ad) {
R adMgrList = adMgrService.getAdMgrList(page, ad);
return adMgrList;
}
@RequestMapping(value = "/insertAd", method = RequestMethod.POST)
@ResponseBody
public R insertAd(PlatformAd ad) {
int num = adMgrService.insertAd(ad);
if (num == 0) {
return R.error("新增广告失败");
}
return R.ok("新增广告成功");
}
@RequestMapping(value = "/updateAd", method = RequestMethod.POST)
@ResponseBody
public R updateAd(PlatformAd ad) {
int num = adMgrService.updateAd(ad);
if (num == 0) {
return R.error("编辑广告失败");
}
return R.ok("编辑广告成功");
}
@RequestMapping(value = "/startandstop", method = RequestMethod.POST)
@ResponseBody
public R startandstop(int id, int status) {
int num = adMgrService.startandstop(id, status);
if (num == 0) {
return R.error("修改广告投放状态失败");
}
return R.ok("修改广告投放状态成功");
}
// @RequestMapping(value = "/start", method = RequestMethod.POST)
// @ResponseBody
// public R start(int id) {
// int num = adMgrService.startandstop(id,1);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
//
// @RequestMapping(value = "/stop", method = RequestMethod.POST)
// @ResponseBody
// public R stop(int id) {
// Integer num = adMgrService.startandstop(id,0);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
}