package com.jwipc.sys.controller.pc;

import com.jwipc.sys.logic.SupplierNameConvertLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jwipc.supplier.dto.SupplierNameConvertDTO;
import static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

/**
 * 供应商名称转换
 */
@Controller
@RequestMapping(MODULE_ROOT +"/supplierNameConvert")
@RequiredArgsConstructor
public class SupplierNameConvertPageController {

    private final SupplierNameConvertLogic supplierNameConvertLogic;

    @GetMapping("/index")
    public String index() {
        return MODULE_ROOT + "/supplierNameConvert/list";
    }
    @GetMapping("/detail")
    public String detail(Model model, Long id) {
        SupplierNameConvertDTO supplierNameConvert = null;
        if (id != null) {
            supplierNameConvert = supplierNameConvertLogic.getById(id);
        } else {
            supplierNameConvert = new SupplierNameConvertDTO();
        }
        model.addAttribute("supplierNameConvert", supplierNameConvert);
        return MODULE_ROOT + "/supplierNameConvert/detail";
    }

}
