package com.yuchen.saas.park.service.controller.work;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.work.SaasWorkOrderDispatchUserDto;
import com.yuchen.saas.park.api.vo.work.SaasWorkOrderDispatchUserVo;
import com.yuchen.saas.park.service.service.work.ISaasWorkOrderDispatchUserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 派工人员设置表 前端控制器
 * </p>
 *
 * @author caiwq
 * @since 2024-10-15
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/workOrderDispatchUser")
public class SaasWorkOrderDispatchUserController {

    @Resource
    private ISaasWorkOrderDispatchUserService baseService;


    /**
     * 添加派工人员设置
     * @param dto 派工人员设置列表Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/add")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "添加派工人员设置", notes = "添加派工人员设置")
    public R<Boolean> add(@RequestBody @Validated SaasWorkOrderDispatchUserDto dto) {
        return R.data(baseService.add(dto));
    }



    /**
     * 派工人员设置详情
     * @return 派工人员设置详情Vo
     */
    @GetMapping("/getDetail/{customerId}")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "派工人员设置详情", notes = "派工人员设置详情")
    public R<SaasWorkOrderDispatchUserVo> getDetail(@ApiParam(name = "customerId", value = "客户ID", required = true) @PathVariable("customerId") Long customerId) {
        return R.data(baseService.getDetail(customerId));
    }



}
