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.DriveSchoolCourseOrder;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolCourseOrderService;
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-03-25
 */
@RestController
@RequestMapping("/drivingSchool/system/driveSchoolCourseOrder")
public class DriveSchoolCourseOrderController extends BaseController
{
    @Autowired
    private IDriveSchoolCourseOrderService driveSchoolCourseOrderService;

    /**
     * 查询驾照报名订单列表
     */
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveSchoolCourseOrder driveSchoolCourseOrder)
    {
        Page<DriveSchoolCourseOrder> page = new Page<>(driveSchoolCourseOrder.getPageNum(), driveSchoolCourseOrder.getPageSize());
        IPage<DriveSchoolCourseOrder> driveSchoolCourseOrderIPage = driveSchoolCourseOrderService.selectDriveSchoolCourseOrderList(driveSchoolCourseOrder, page);
        return success(driveSchoolCourseOrderIPage);
        //return getDataTable(list);
    }

    /**
     * 导出驾照报名订单列表
     */
    //@Log(title = "驾照报名订单", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, DriveSchoolCourseOrder driveSchoolCourseOrder)
//    {
//        List<DriveSchoolCourseOrder> list = driveSchoolCourseOrderService.selectDriveSchoolCourseOrderList(driveSchoolCourseOrder);
//        ExcelUtil<DriveSchoolCourseOrder> util = new ExcelUtil<DriveSchoolCourseOrder>(DriveSchoolCourseOrder.class);
//        util.exportExcel(response, list, "驾照报名订单数据");
//    }

    /**
     * 获取驾照报名订单详细信息
     */
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(driveSchoolCourseOrderService.selectDriveSchoolCourseOrderById(id));
    }

    /**
     * 新增驾照报名订单
     */
    //@Log(title = "驾照报名订单", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@RequestBody DriveSchoolCourseOrder driveSchoolCourseOrder)
    {
        return toAjax(driveSchoolCourseOrderService.insertDriveSchoolCourseOrder(driveSchoolCourseOrder));
    }

    /**
     * 修改驾照报名订单
     */
    //@Log(title = "驾照报名订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@RequestBody DriveSchoolCourseOrder driveSchoolCourseOrder)
    {
        return toAjax(driveSchoolCourseOrderService.updateDriveSchoolCourseOrder(driveSchoolCourseOrder));
    }

    /**
     * 删除驾照报名订单
     */
    //@Log(title = "驾照报名订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(driveSchoolCourseOrderService.deleteDriveSchoolCourseOrderByIds(ids));
    }
}
