package com.starry.admin.modules.order.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.order.module.vo.PlayOrderContinueQueryVo;
import com.starry.admin.modules.order.module.vo.PlayOrderContinueReturnVo;
import com.starry.admin.modules.order.module.vo.PlayOrderReviewStateEditVo;
import com.starry.admin.modules.order.service.IPlayOrderContinueInfoService;
import com.starry.common.result.R;
import org.springframework.validation.annotation.Validated;
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;

/**
 * 订单续单信息Controller
 *
 * @author admin
 * @since 2024-05-10
 */
@RestController
@RequestMapping("/order/continue")
public class PlayOrderContinueInfoController {
    @Resource
    private IPlayOrderContinueInfoService playOrderContinueInfoService;

    /**
     * 查询订单续单信息列表
     */
    @PostMapping("/listByPage")
    public R list(@Validated @RequestBody PlayOrderContinueQueryVo vo) {
        IPage<PlayOrderContinueReturnVo> list = playOrderContinueInfoService.selectPlayByPage(vo);
        return R.ok(list);
    }

    /**
     * 审批续单申申请
     */
    //@PreAuthorize("@customSs.hasPermission('order:continue:update')")
    @PostMapping("/updateReviewState")
    public R updateReviewState(@Validated @RequestBody PlayOrderReviewStateEditVo vo) {
        playOrderContinueInfoService.updateReviewState(vo);
        return R.ok("成功");
    }
}
