package io.renren.modules.aspen.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.aspen.entity.TDashboarddayEntity;
import io.renren.modules.aspen.service.TDashboarddayService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

@RestController
@RequestMapping("aspen/tDashboardday")
public class TDashboarddayController {
    @Autowired
    private TDashboarddayService tDashboarddayService;

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

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("aspen:talarmstatisticsday:info")
    public R info(@PathVariable("id") Integer id){
		TDashboarddayEntity tDashboardday = tDashboarddayService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("aspen:talarmstatisticsday:save")
    public R save(@RequestBody TDashboarddayEntity tDashboardday){
        tDashboarddayService.save(tDashboardday);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("aspen:talarmstatisticsday:update")
    public R update(@RequestBody TDashboarddayEntity tDashboardday){
        tDashboarddayService.updateById(tDashboardday);

        return R.ok();
    }

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

        return R.ok();
    }

}
