SceneController.java 1.27 KB
package com.glsx.smart.controller;

import java.util.List;
import com.glsx.smart.dao.entity.SmartScene;
import com.glsx.smart.service.SmartSceneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Description:
 * <p>Project: chejia-smart
 *
 * @author wbh
 * @date 2021-03-15
 */
@Slf4j
@RestController
@RequestMapping("/scene")
public class SceneController {
    @Autowired
    private SmartSceneService sceneService;

    @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
    public List<SmartScene> getList(SmartScene scene) {
        return sceneService.selectByExample(scene);
    }

    @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
    public SmartScene getById(Long id) {
        return sceneService.selectByPrimaryKey(id);
    }

    @RequestMapping(value = "/save", method = {RequestMethod.POST})
    public void save(@RequestBody SmartScene scene) {
        sceneService.insertOrUpdate(scene);
    }
}