package com.njzscloud.supervisory.route.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.route.pojo.OrderRouteDetailEntity;
import com.njzscloud.supervisory.route.service.OrderRouteDetailService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 路线详情管理
 */
@Slf4j
@RestController
@RequestMapping("/order_route_detail")
@RequiredArgsConstructor
public class OrderRouteDetailController {

    private final OrderRouteDetailService orderRouteDetailService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody OrderRouteDetailEntity detailEntity) {
        orderRouteDetailService.add(detailEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody OrderRouteDetailEntity detailEntity) {
        orderRouteDetailService.modify(detailEntity);
        return R.success();
    }

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

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

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

}

