package io.renren.modules.aspen.controller;

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

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.modules.aspen.entity.TDashboarddayelecEntity;
import io.renren.modules.aspen.service.TDashboarddayelecService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 电厂大屏每日0：00抓取数据
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-03-12 10:53:44
 */
@RestController
@RequestMapping("aspen/tdashboarddayelec")
public class TDashboarddayelecController {
    @Autowired
    private TDashboarddayelecService tDashboarddayelecService;

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

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("aspen:tdashboarddayelec:info")
    public R info(@PathVariable("id") Integer id){
		TDashboarddayelecEntity tDashboarddayelec = tDashboarddayelecService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("aspen:tdashboarddayelec:save")
    public R save(@RequestBody TDashboarddayelecEntity tDashboarddayelec){
		tDashboarddayelecService.save(tDashboarddayelec);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("aspen:tdashboarddayelec:update")
    public R update(@RequestBody TDashboarddayelecEntity tDashboarddayelec){
		tDashboarddayelecService.updateById(tDashboarddayelec);

        return R.ok();
    }

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

        return R.ok();
    }

}
