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.OrderCargoPlaceEntity;
import com.njzscloud.supervisory.order.service.OrderCargoPlaceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 装货地址
 */
@Slf4j
@RestController
@RequestMapping("/order_cargo_place")
@RequiredArgsConstructor
public class OrderCargoPlaceController {

    private final OrderCargoPlaceService orderCargoPlaceService;

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody OrderCargoPlaceEntity orderCargoPlaceEntity) {
        orderCargoPlaceService.modify(orderCargoPlaceEntity);
        return R.success();
    }

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

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

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

}
