package com.ruoyi.zongzhi.controller;

import java.util.List;
import io.swagger.annotations.Api;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zongzhi.domain.TcBjsj;
import com.ruoyi.zongzhi.service.ITcBjsjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 本级上级网评指令比列 (月)Controller
 * 
 * @author ruoyi
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/zongzhi/bjsj")
@Api(tags = " 本级上级网评指令比列 (月)")
public class TcBjsjController extends BaseController
{
    @Autowired
    private ITcBjsjService tcBjsjService;

    /**
     * 查询本级上级网评指令比列 (月)列表
     */

    @GetMapping("/list")
    public TableDataInfo list(TcBjsj tcBjsj)
    {
        startPage();
        List<TcBjsj> list = tcBjsjService.selectTcBjsjList(tcBjsj);
        return getDataTable(list);
    }

    /**
     * 导出本级上级网评指令比列 (月)列表
     */

    @PostMapping("/export")
    public void export(HttpServletResponse response, TcBjsj tcBjsj)
    {
        List<TcBjsj> list = tcBjsjService.selectTcBjsjList(tcBjsj);
        ExcelUtil<TcBjsj> util = new ExcelUtil<TcBjsj>(TcBjsj.class);
        util.exportExcel(response, list, "本级上级网评指令比列 (月)数据");
    }

    /**
     * 获取本级上级网评指令比列 (月)详细信息
     */

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tcBjsjService.selectTcBjsjById(id));
    }

    /**
     * 新增本级上级网评指令比列 (月)
     */

    @PostMapping
    public AjaxResult add(@RequestBody TcBjsj tcBjsj)
    {
        tcBjsj.setIsStatus(true);
        return toAjax(tcBjsjService.insertTcBjsj(tcBjsj));
    }

    /**
     * 修改本级上级网评指令比列 (月)
     */

    @PutMapping
    public AjaxResult edit(@RequestBody TcBjsj tcBjsj)
    {
        return toAjax(tcBjsjService.updateTcBjsj(tcBjsj));
    }

    /**
     * 删除本级上级网评指令比列 (月)
     */

	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tcBjsjService.deleteTcBjsjByIds(ids));
    }
}
