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.DriveSchoolDial;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolDialService;
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("/drivingSchool/system/dial")
public class DriveSchoolDialController extends BaseController
{
    @Autowired
    private IDriveSchoolDialService driveSchoolDialService;

    /**
     * 查询日常日志列表
     */
    @GetMapping("/list")
    public CommonResult<IPage<?>> list(DriveSchoolDial driveSchoolDial)
    {
        Page<DriveSchoolDial> page = new Page<>(driveSchoolDial.getPageNum(), driveSchoolDial.getPageSize());
        IPage<DriveSchoolDial> driveSchoolDialIPage = driveSchoolDialService.selectDriveSchoolDialList(driveSchoolDial, page);
        return CommonResult.success(driveSchoolDialIPage);
        //return getDataTable(list);
    }

    /**
     * 查询日常日志列表
     */
    @GetMapping("/appList")
    public CommonResult<IPage<?>> appList(DriveSchoolDial driveSchoolDial)
    {
        Page<DriveSchoolDial> page = new Page<>(driveSchoolDial.getPageNum(), driveSchoolDial.getPageSize());
        IPage<DriveSchoolDial> driveSchoolDialIPage = driveSchoolDialService.selectDriveSchoolDialAppList(driveSchoolDial, page);
        return CommonResult.success(driveSchoolDialIPage);
        //return getDataTable(list);
    }

    /**
     * 导出日常日志列表
     */
    //@Log(title = "日常日志", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, DriveSchoolDial driveSchoolDial)
//    {
//        List<DriveSchoolDial> list = driveSchoolDialService.selectDriveSchoolDialList(driveSchoolDial);
//        ExcelUtil<DriveSchoolDial> util = new ExcelUtil<DriveSchoolDial>(DriveSchoolDial.class);
//        util.exportExcel(response, list, "日常日志数据");
//    }

    /**
     * 获取日常日志详细信息
     */
    @GetMapping(value = "/{id}")
    public CommonResult getInfo(@PathVariable("id") Long id)
    {
        return success(driveSchoolDialService.selectDriveSchoolDialById(id));
    }

    /**
     * 新增日常日志
     */
    //@Log(title = "日常日志", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@RequestBody DriveSchoolDial driveSchoolDial)
    {
        return toAjax(driveSchoolDialService.insertDriveSchoolDial(driveSchoolDial));
    }

    /**
     * 修改日常日志
     */
    //@Log(title = "日常日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@RequestBody DriveSchoolDial driveSchoolDial)
    {
        return toAjax(driveSchoolDialService.updateDriveSchoolDial(driveSchoolDial));
    }

    /**
     * 删除日常日志
     */
    //@Log(title = "日常日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public CommonResult remove(@PathVariable Long[] ids)
    {
        return toAjax(driveSchoolDialService.deleteDriveSchoolDialByIds(ids));
    }
}
