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.DriveSchoolDailyManagement;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDailyManagementService;
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-24
 */
@RestController
@RequestMapping("/system/dailyManagement")
public class DriveSchoolDailyManagementController extends BaseController
{
    @Autowired
    private IDriveSchoolDailyManagementService driveSchoolDailyManagementService;

    /**
     * 查询驾校日常管理列表
     */
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveSchoolDailyManagement driveSchoolDailyManagement)
    {
        Page<DriveSchoolDailyManagement> page = new Page<>(driveSchoolDailyManagement.getPageNum(), driveSchoolDailyManagement.getPageSize());
        IPage<DriveSchoolDailyManagement> driveSchoolDailyManagementIPage = driveSchoolDailyManagementService.selectDriveSchoolDailyManagementList(driveSchoolDailyManagement, page);
        return success(driveSchoolDailyManagementIPage);
        //return getDataTable(list);
    }

    /**
     * 导出驾校日常管理列表
     */
    //@Log(title = "驾校日常管理", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, DriveSchoolDailyManagement driveSchoolDailyManagement)
//    {
//        List<DriveSchoolDailyManagement> list = driveSchoolDailyManagementService.selectDriveSchoolDailyManagementList(driveSchoolDailyManagement);
//        ExcelUtil<DriveSchoolDailyManagement> util = new ExcelUtil<DriveSchoolDailyManagement>(DriveSchoolDailyManagement.class);
//        util.exportExcel(response, list, "驾校日常管理数据");
//    }

    /**
     * 获取驾校日常管理详细信息
     */
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(driveSchoolDailyManagementService.selectDriveSchoolDailyManagementById(id));
    }

    /**
     * 新增驾校日常管理
     */
    //@Log(title = "驾校日常管理", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@RequestBody DriveSchoolDailyManagement driveSchoolDailyManagement)
    {
        return toAjax(driveSchoolDailyManagementService.insertDriveSchoolDailyManagement(driveSchoolDailyManagement));
    }

    /**
     * 修改驾校日常管理
     */
    //@Log(title = "驾校日常管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@RequestBody DriveSchoolDailyManagement driveSchoolDailyManagement)
    {
        return toAjax(driveSchoolDailyManagementService.updateDriveSchoolDailyManagement(driveSchoolDailyManagement));
    }

    /**
     * 删除驾校日常管理
     */
    //@Log(title = "驾校日常管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(driveSchoolDailyManagementService.deleteDriveSchoolDailyManagementByIds(ids));
    }
}
