package com.ruoyi.hezhi.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.hezhi.domain.TbMemberExamSimulateAll;
import com.ruoyi.hezhi.service.ITbMemberExamSimulateAllService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

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

/**
 * 我的考试、模拟题目（做过）Controller
 *
 * @author ruoyi
 * @date 2024-11-11
 */
@RestController
@RequestMapping("/hezhi/memberExamSimulateAll")
public class TbMemberExamSimulateAllController extends BaseController
{
    @Autowired
    private ITbMemberExamSimulateAllService tbMemberExamSimulateAllService;

    /**
     * 查询我的考试、模拟题目（做过）列表
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbMemberExamSimulateAll tbMemberExamSimulateAll)
    {
        startPage();
        List<TbMemberExamSimulateAll> list = tbMemberExamSimulateAllService.selectTbMemberExamSimulateAllList(tbMemberExamSimulateAll);
        return getDataTable(list);
    }

    /**
     * 导出我的考试、模拟题目（做过）列表
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:export')")
    @Log(title = "我的考试、模拟题目（做过）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbMemberExamSimulateAll tbMemberExamSimulateAll)
    {
        List<TbMemberExamSimulateAll> list = tbMemberExamSimulateAllService.selectTbMemberExamSimulateAllList(tbMemberExamSimulateAll);
        ExcelUtil<TbMemberExamSimulateAll> util = new ExcelUtil<TbMemberExamSimulateAll>(TbMemberExamSimulateAll.class);
        util.exportExcel(response, list, "我的考试、模拟题目（做过）数据");
    }

    /**
     * 获取我的考试、模拟题目（做过）详细信息
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:query')")
    @GetMapping(value = "/{memberExamSimulateAllId}")
    public AjaxResult getInfo(@PathVariable("memberExamSimulateAllId") Long memberExamSimulateAllId)
    {
        return success(tbMemberExamSimulateAllService.selectTbMemberExamSimulateAllByMemberExamSimulateAllId(memberExamSimulateAllId));
    }

    /**
     * 新增我的考试、模拟题目（做过）
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:add')")
    @Log(title = "我的考试、模拟题目（做过）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbMemberExamSimulateAll tbMemberExamSimulateAll)
    {
        return toAjax(tbMemberExamSimulateAllService.insertTbMemberExamSimulateAll(tbMemberExamSimulateAll));
    }

    /**
     * 修改我的考试、模拟题目（做过）
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:edit')")
    @Log(title = "我的考试、模拟题目（做过）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbMemberExamSimulateAll tbMemberExamSimulateAll)
    {
        return toAjax(tbMemberExamSimulateAllService.updateTbMemberExamSimulateAll(tbMemberExamSimulateAll));
    }

    /**
     * 删除我的考试、模拟题目（做过）
     */
    @PreAuthorize("@ss.hasPermi('hezhi:memberExamSimulateAll:remove')")
    @Log(title = "我的考试、模拟题目（做过）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{memberExamSimulateAllIds}")
    public AjaxResult remove(@PathVariable Long[] memberExamSimulateAllIds)
    {
        return toAjax(tbMemberExamSimulateAllService.deleteTbMemberExamSimulateAllByMemberExamSimulateAllIds(memberExamSimulateAllIds));
    }
}
