package com.jwipc.order.controller.pc;

import com.jwipc.order.dto.AppointmentDockerDTO;
import com.jwipc.order.entity.AppointmentDocker;
import com.jwipc.order.logic.AppointmentDockerLogic;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import static com.jwipc.order.constant.ModuleConst.MODULE_ROOT;

/**
 * <p>
 * 预约工厂码头配置表 前端控制器
 * </p>
 *
 * @author WT
 * @since 2024-03-05
 */
@Controller
@RequiredArgsConstructor
@RequestMapping(MODULE_ROOT + "/appointmentDocker")
public class AppointmentDockerPageController {

private final AppointmentDockerLogic appointmentDockerLogic;

    @RequestMapping("/index")
    public String index(){
        return MODULE_ROOT +"/delivery/appointmentDocker/list";
    }

    /**
     *
     * @param model
     * @param id
     * @param type 1新增 2编辑 3查询
     * @return
     */
    @GetMapping("/detail")
    public String detail(Model model, String id, String type) {
        AppointmentDockerDTO docker = new AppointmentDockerDTO();
        if (StringUtils.isNotEmpty(id)) {
            docker = appointmentDockerLogic.selectById(id);
        }
        model.addAttribute("data", docker);
        model.addAttribute("type", type);
        return MODULE_ROOT +"/delivery/appointmentDocker/detail";
    }

}
