package com.usoftchina.uas.office.controller;

import com.usoftchina.uas.office.dto.Result;
import com.usoftchina.uas.office.entity.DataCenter;
import com.usoftchina.uas.office.service.DataCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author yingp
 * @date 2020/2/15
 */
@RequestMapping(path = "/mgm")
@RestController
public class DataCenterController {
    @Autowired
    private DataCenterService dataCenterService;

    @GetMapping(path = "/dc")
    public Result getDataCenter() {
        return Result.success(dataCenterService.find());
    }

    @PostMapping(path = "/dc")
    public Result saveDataCenter(DataCenter dataCenter) throws Exception{
        dataCenterService.save(dataCenter);
        return Result.success();
    }
}
