package com.njzscloud.supervisory.order.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.order.pojo.entity.OrderCarInOutEntity;
import com.njzscloud.supervisory.order.service.OrderCarInOutService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 订单车辆进出场信息
 */
@Slf4j
@RestController
@RequestMapping("/order_car_in_out")
@RequiredArgsConstructor
public class OrderCarInOutController {

    private final OrderCarInOutService orderCarInOutService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody OrderCarInOutEntity orderCarInOutEntity) {
        orderCarInOutService.add(orderCarInOutEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody OrderCarInOutEntity orderCarInOutEntity) {
        orderCarInOutService.modify(orderCarInOutEntity);
        return R.success();
    }

    /**
     * 删除
     */
    @PostMapping("/del")
    public R<?> del(@RequestBody List<Long> ids) {
        orderCarInOutService.del(ids);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<OrderCarInOutEntity> detail(@RequestParam Long id) {
        return R.success(orderCarInOutService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<OrderCarInOutEntity>> paging(PageParam pageParam, OrderCarInOutEntity orderCarInOutEntity) {
        return R.success(orderCarInOutService.paging(pageParam, orderCarInOutEntity));
    }

}
