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.DriveCarBind;
import cn.iocoder.yudao.module.jx.service.IDriveCarBindService;
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-04-01
 */
@RestController
@RequestMapping("/drivingSchool/system/drivingSchoolBind")
public class DriveCarBindController extends BaseController
{
    @Autowired
    private IDriveCarBindService driveCarBindService;

    /**
     * 查询车辆绑定（教练）列表
     */
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveCarBind driveCarBind)
    {
        Page<DriveCarBind> page = new Page<>(driveCarBind.getPageNum(), driveCarBind.getPageSize());
        IPage<DriveCarBind> driveCarBindIPage = driveCarBindService.selectDriveCarBindList(driveCarBind, page);
        return CommonResult.success(driveCarBindIPage);
        //return getDataTable(list);
    }

    /**
     * 导出车辆绑定（教练）列表
     */
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, DriveCarBind driveCarBind)
//    {
//        List<DriveCarBind> list = driveCarBindService.selectDriveCarBindList(driveCarBind);
//        ExcelUtil<DriveCarBind> util = new ExcelUtil<DriveCarBind>(DriveCarBind.class);
//        util.exportExcel(response, list, "车辆绑定（教练）数据");
//    }

    /**
     * 获取车辆绑定（教练）详细信息
     */
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(driveCarBindService.selectDriveCarBindById(id));
    }

    /**
     * 新增车辆绑定（教练）
     */
    @PostMapping
    public CommonResult add(@RequestBody DriveCarBind driveCarBind)
    {
        return toAjax(driveCarBindService.insertDriveCarBind(driveCarBind));
    }

    /**
     * 修改车辆绑定（教练）
     */
    @PutMapping
    public CommonResult edit(@RequestBody DriveCarBind driveCarBind)
    {
        return toAjax(driveCarBindService.updateDriveCarBind(driveCarBind));
    }

    /**
     * 删除车辆绑定（教练）
     */
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(driveCarBindService.deleteDriveCarBindByIds(ids));
    }


}
