package cn.iocoder.yudao.module.jx.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.jx.core.controller.BaseController;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolReimbursement;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolReimbursementService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 报销审核Controller
 *
 * @author ruoyi
 * @date 2024-05-19
 */
@RestController
@RequestMapping("/drivingSchool/system/reimbursement")
public class DriveSchoolReimbursementController extends BaseController
{
    @Autowired
    private IDriveSchoolReimbursementService driveSchoolReimbursementService;

    /**
     * 查询报销审核列表
     */
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveSchoolReimbursement driveSchoolReimbursement)
    {
        Page<DriveSchoolReimbursement> page = new Page<>(driveSchoolReimbursement.getPageNum(), driveSchoolReimbursement.getPageSize());
        IPage<DriveSchoolReimbursement> driveSchoolReimbursementIPage = driveSchoolReimbursementService.selectDriveSchoolReimbursementList(driveSchoolReimbursement, page);
        return CommonResult.success(driveSchoolReimbursementIPage);
        //return getDataTable(list);
    }

    /**
     * 导出报销审核列表
     */
    //@Log(title = "报销审核", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, DriveSchoolReimbursement driveSchoolReimbursement)
//    {
//        List<DriveSchoolReimbursement> list = driveSchoolReimbursementService.selectDriveSchoolReimbursementList(driveSchoolReimbursement);
//        ExcelUtil<DriveSchoolReimbursement> util = new ExcelUtil<DriveSchoolReimbursement>(DriveSchoolReimbursement.class);
//        util.exportExcel(response, list, "报销审核数据");
//    }

    /**
     * 获取报销审核详细信息
     */
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(driveSchoolReimbursementService.selectDriveSchoolReimbursementById(id));
    }

    /**
     * 新增报销审核
     */
    //@Log(title = "报销审核", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@RequestBody DriveSchoolReimbursement driveSchoolReimbursement)
    {
        return toAjax(driveSchoolReimbursementService.insertDriveSchoolReimbursement(driveSchoolReimbursement));
    }

    /**
     * 修改报销审核
     */
    //@Log(title = "报销审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@RequestBody DriveSchoolReimbursement driveSchoolReimbursement)
    {
        return toAjax(driveSchoolReimbursementService.updateDriveSchoolReimbursement(driveSchoolReimbursement));
    }

    /**
     * 删除报销审核
     */
    //@Log(title = "报销审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(driveSchoolReimbursementService.deleteDriveSchoolReimbursementByIds(ids));
    }
}
