package com.srs.web.controller.routine;

import java.util.List;
import javax.servlet.http.HttpServletResponse;


import com.srs.routine.service.IRtStuMultiLevelReviewService;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;

import com.srs.routine.domain.RtStuMultiLevelReview;

import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.enums.BusinessType;
import com.srs.common.annotation.Log;
import com.srs.common.core.page.TableDataInfo;

/**
 * 审核信息Controller
 *
 * @author srs
 * @date 2024-05-17
 */
@RestController
@RequestMapping("/routine/stuMultiLevelReview")
@Api(value = "审核信息管理", tags = "审核信息管理")
public class RtStuMultiLevelReviewController extends BaseController {
    @Autowired
    private IRtStuMultiLevelReviewService rtStuMultiLevelReviewService;

    /**
     * 查询审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:list')")
    @GetMapping("/list")
    @ApiOperation("查询审核信息列表")
    public TableDataInfo list(RtStuMultiLevelReview rtStuMultiLevelReview) {
        startPage();
        List<RtStuMultiLevelReview> list = rtStuMultiLevelReviewService.selectRtStuMultiLevelReviewList(rtStuMultiLevelReview);
        return getDataTable(list);
    }

    /**
     * 导出审核信息列表
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:export')")
    @Log(title = "审核信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出审核信息列表")
    public void export(HttpServletResponse response, RtStuMultiLevelReview rtStuMultiLevelReview) {
        List<RtStuMultiLevelReview> list = rtStuMultiLevelReviewService.selectRtStuMultiLevelReviewList(rtStuMultiLevelReview);
        ExcelUtil<RtStuMultiLevelReview> util = new ExcelUtil<RtStuMultiLevelReview>(RtStuMultiLevelReview.class);
        util.exportExcel(response, list, "审核信息数据");
    }

    /**
     * 获取审核信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取审核信息详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(rtStuMultiLevelReviewService.selectRtStuMultiLevelReviewById(id));
    }

    /**
     * 获取审核信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:query')")
    @GetMapping(value = "getInfoByReviewerIdentity")
    @ApiOperation("获取审核信息详细信息")
    public AjaxResult getInfoByReviewerIdentity(String reviewerIdentity, String stuNo) {
        return success(rtStuMultiLevelReviewService.selectRtStuMultiLevelReviewByReviewerIdentity(reviewerIdentity, stuNo));
    }

    /**
     * 新增审核信息
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:add')")
    @Log(title = "审核信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增审核信息")
    public AjaxResult add(@RequestBody RtStuMultiLevelReview rtStuMultiLevelReview) {
        return toAjax(rtStuMultiLevelReviewService.insertRtStuMultiLevelReview(rtStuMultiLevelReview));
    }

    /**
     * 修改审核信息
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:edit')")
    @Log(title = "审核信息", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改审核信息")
    public AjaxResult edit(@RequestBody RtStuMultiLevelReview rtStuMultiLevelReview) {
        return toAjax(rtStuMultiLevelReviewService.updateRtStuMultiLevelReview(rtStuMultiLevelReview));
    }

    /**
     * 删除审核信息
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:remove')")
    @Log(title = "审核信息", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除审核信息")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(rtStuMultiLevelReviewService.deleteRtStuMultiLevelReviewByIds(ids));
    }

    /**
     * 更新审核信息并同时更新学生证补办状态
     */
    @PreAuthorize("@ss.hasPermi('routine:stuMultiLevelReview:edit')")
    @Log(title = "更新审核信息并同时更新学生证补办状态", businessType = BusinessType.UPDATE)
    @PostMapping("/updateWithStuIdReissue")
    @ApiOperation("更新审核信息并同时更新学生证补办状态")
    public AjaxResult updateWithStuIdReissue(@RequestBody RtStuMultiLevelReview rtStuMultiLevelReview) {
        return toAjax(rtStuMultiLevelReviewService.updateRtStuMultiLevelReviewWithStuIdReissue(rtStuMultiLevelReview));
    }
}
