 package com.huimv.management.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huimv.management.entity.OutdoorEnvironmentEntity;
import com.huimv.management.service.OutdoorEnvironmentService;
import com.huimv.common.utils.PageUtils;
import com.huimv.common.utils.R;



/**
 * 室外环境信息Controller
 *
 * @author yinhao
 * @version 1.0
 * @date 2021-05-07 15:32:42
 */
@Api(tags = "室外环境信息Controller")
@RestController
@RequestMapping("management/outdoorEnvironment")
public class OutdoorEnvironmentController {
    @Autowired
    private OutdoorEnvironmentService outdoorEnvironmentService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = outdoorEnvironmentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		OutdoorEnvironmentEntity outdoorEnvironment = outdoorEnvironmentService.getById(id);

        return R.ok().put("outdoorEnvironment", outdoorEnvironment);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody OutdoorEnvironmentEntity outdoorEnvironment){
		outdoorEnvironmentService.save(outdoorEnvironment);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody OutdoorEnvironmentEntity outdoorEnvironment){
		outdoorEnvironmentService.updateById(outdoorEnvironment);

        return R.ok();
    }

    /**
     * 删除
     */
    @GetMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		outdoorEnvironmentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
