package com.bonus.sharedstation.app.controller;


import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.app.domain.CarServiceDTO;
import com.bonus.sharedstation.app.dto.CarPageDTO;
import com.bonus.sharedstation.app.service.ICarServiceService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@Tag(name = "app-车辆服务")
@RestController
@RequestMapping("/information/carservice/app")
public class CarServiceAppController {

    @Resource
    private ICarServiceService carServiceService;


    @PostMapping(value = "/add", produces = "application/json; charset=utf-8")
    @ApiOperation("车辆服务-新增")
    public AjaxResult add(@RequestBody @Valid CarServiceDTO dto) {
        return carServiceService.insert(dto);
    }


    @PostMapping(value = "/delete", produces = "application/json; charset=utf-8")
    @ApiOperation("车辆服务-删除")
    public AjaxResult deleteById(@RequestBody CarServiceDTO dto){
        return carServiceService.delete(dto);
    }

    @ApiOperation("车辆服务-修改")
    @PostMapping("/update")
    public AjaxResult update(@RequestBody @Valid CarServiceDTO dto){
        return carServiceService.updateInfoById(dto);
    }


    /**
     * 分页查询
     * @param dto
     * @return
     */
    @ApiOperation("车辆服务-查询")
    @PostMapping("/getList")
    public AjaxResult getList(@RequestBody CarPageDTO dto){
        return carServiceService.getListPageApp(dto);

    }

    /**
     * 详情
     * @param
     * @return
     */
    @PostMapping(value = "selectById", produces = "application/json; charset=utf-8")
    @ApiOperation("车辆服务-查询详情")
    public AjaxResult selectInfoById(@RequestBody CarServiceDTO dto){
        return carServiceService.selectInfoById(dto);
    }


}
