package com.njzscloud.dispose.cst.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.dispose.cst.order.pojo.entity.OrderTransEntity;
import com.njzscloud.dispose.cst.order.pojo.param.OrderTransQueryParam;
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
import com.njzscloud.dispose.cst.order.service.OrderTransService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 运输信息
 *
 * @author ljw
 */
@Slf4j
@RestController
@RequestMapping("/order_trans")
@RequiredArgsConstructor
public class OrderTransController {

    private final OrderTransService orderTransService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody OrderTransEntity orderTransEntity) {
        orderTransService.add(orderTransEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody OrderTransEntity orderTransEntity) {
        orderTransService.modify(orderTransEntity);
        return R.success();
    }

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

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

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<OrderTransResult>> paging(PageParam pageParam, OrderTransQueryParam queryParam) {
        return R.success(orderTransService.paging(pageParam, queryParam));
    }
}
