package io.renren.modules.aspen.controller;

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

import io.renren.modules.aspen.entity.TDashboarddayeleceightEntity;
import io.renren.modules.aspen.service.TDashboarddayeleceightService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 电厂大屏每日8：00抓取数据
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-03-12 10:53:43
 */
@RestController
@RequestMapping("aspen/tdashboarddayeleceight")
public class TDashboarddayeleceightController {
    @Autowired
    private TDashboarddayeleceightService tDashboarddayeleceightService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("aspen:tdashboarddayeleceight:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tDashboarddayeleceightService.queryPage(params);

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("aspen:tdashboarddayeleceight:info")
    public R info(@PathVariable("id") Integer id){
		TDashboarddayeleceightEntity tDashboarddayeleceight = tDashboarddayeleceightService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("aspen:tdashboarddayeleceight:save")
    public R save(@RequestBody TDashboarddayeleceightEntity tDashboarddayeleceight){
		tDashboarddayeleceightService.save(tDashboarddayeleceight);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("aspen:tdashboarddayeleceight:update")
    public R update(@RequestBody TDashboarddayeleceightEntity tDashboarddayeleceight){
		tDashboarddayeleceightService.updateById(tDashboarddayeleceight);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("aspen:tdashboarddayeleceight:delete")
    public R delete(@RequestBody Integer[] ids){
		tDashboarddayeleceightService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
