package com.ruoyi.web.controller.ie;

import java.util.List;
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.ie.domain.AWishRecord;
import com.ruoyi.ie.service.IAWishRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 志愿记录Controller
 * 
 * @author voluntary
 * @date 2023-11-26
 */
@RestController
@RequestMapping("/ie/aWishRecord")
public class AWishRecordController extends BaseController
{
    @Autowired
    private IAWishRecordService aWishRecordService;

    /**
     * 查询志愿记录列表
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(AWishRecord aWishRecord)
    {
        startPage();
        List<AWishRecord> list = aWishRecordService.selectAWishRecordList(aWishRecord);
        return getDataTable(list);
    }

    /**
     * 导出志愿记录列表
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:export')")
    @Log(title = "志愿记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AWishRecord aWishRecord)
    {
        List<AWishRecord> list = aWishRecordService.selectAWishRecordList(aWishRecord);
        ExcelUtil<AWishRecord> util = new ExcelUtil<AWishRecord>(AWishRecord.class);
        util.exportExcel(response, list, "志愿记录数据");
    }

    /**
     * 获取志愿记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(aWishRecordService.selectAWishRecordById(id));
    }

    /**
     * 新增志愿记录
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:add')")
    @Log(title = "志愿记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AWishRecord aWishRecord)
    {
        return toAjax(aWishRecordService.insertAWishRecord(aWishRecord));
    }

    /**
     * 修改志愿记录
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:edit')")
    @Log(title = "志愿记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AWishRecord aWishRecord)
    {
        return toAjax(aWishRecordService.updateAWishRecord(aWishRecord));
    }

    /**
     * 删除志愿记录
     */
    @PreAuthorize("@ss.hasPermi('ie:aWishRecord:remove')")
    @Log(title = "志愿记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(aWishRecordService.deleteAWishRecordByIds(ids));
    }
}
