package com.jwipc.sys.controller.pc;

import com.jwipc.sys.dto.PurchaseOrgDTO;
import com.jwipc.sys.logic.PurchaseOrgLogic;
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 static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Controller
@RequestMapping(MODULE_ROOT + "/purchaseOrg")
@RequiredArgsConstructor
public class PurchaseOrgPageController {

    private final PurchaseOrgLogic purchaseOrgLogic;
    @GetMapping("/index")
    public String index() {
        return MODULE_ROOT + "/purchaseOrg/list";
    }
    @GetMapping("/detail")
    public String detail(Model model, Long id) {
        PurchaseOrgDTO purchaseOrg;
        purchaseOrg = purchaseOrgLogic.getById(id);
        model.addAttribute("purchaseOrg", purchaseOrg);
        return MODULE_ROOT + "/purchaseOrg/detail";
    }
    @GetMapping("userPurchaseOrgAdd")
    public String userPurchaseGroupAdd(Model model, Long userId) {
        model.addAttribute("userId", userId);
        return MODULE_ROOT + "/purchaseOrg/user_purchase_org_add";
    }
}
