fengxiang
2018-01-25 56e81073389ebb511562ddf85e1b22a8db0585a9
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
package com.moral.controller;
 
import com.moral.common.bean.PageBean;
import com.moral.common.bean.ResultBean;
import com.moral.entity.MonitorPoint;
import com.moral.service.MonitorPointService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
 
@RestController
@RequestMapping("monitor-point")
@CrossOrigin(origins = "*", maxAge = 3600)
public class MonitorPointController {
    @Resource
    MonitorPointService monitorPointService;
    @GetMapping("page-list")
    public PageBean pageList(PageBean pageBean) {
        return monitorPointService.queryByPageBean(pageBean);
    }
    @PostMapping("delete-by-ids")
    public ResultBean deleteByIds(@RequestBody Integer [] ids){
        monitorPointService.deleteByIds(ids);
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        return resultBean;
    }
 
    /**
     * 根据 监控点id 获取 监控点
     * @param id
     * @return
     */
    @GetMapping("get-by-id")
    public ResultBean getById(Integer id){
        MonitorPoint monitorPoint = monitorPointService.selectWithRelationById(id);
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        resultBean.setData(monitorPoint);
        return resultBean;
    }
    @PostMapping("add-or-modify")
    public ResultBean addOrModify(@RequestBody MonitorPoint monitorPoint){
        monitorPointService.addOrModify(monitorPoint);
        ResultBean resultBean = new ResultBean(ResultBean.SUCCESS);
        return resultBean;
    }
}