package com.jwipc.sys.controller.pc;

import com.jwipc.security.LoginUtil;
import com.jwipc.security.dto.CurrentUserDTO;
import com.jwipc.sys.dto.ProductGroupDTO;
import com.jwipc.sys.logic.ProductGroupLogic;
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;

/**
 * @author Al
 * @create 2024-02-18 9:25
 * 物料组
 */
@Controller
@RequestMapping(MODULE_ROOT + "/productGroup")
@RequiredArgsConstructor
public class ProductGroupPageController {
    private final ProductGroupLogic productGroupLogic;
    @GetMapping("/index")
    public String index() {
        return MODULE_ROOT + "/productGroup/list";
    }
    //新增详情页
    @GetMapping("/detail")
    public String detail(Model model, Long id) {
        CurrentUserDTO user = LoginUtil.getCurrentUser();
        ProductGroupDTO productGroupDTO;
        productGroupDTO = productGroupLogic.getById(id);
        model.addAttribute("productGroupDTO", productGroupDTO);
        return MODULE_ROOT + "/productGroup/detail";
    }


    @GetMapping("/select/dialog")
    public String selectDialog(Model model) {
        return MODULE_ROOT + "/productGroup/group_dialog";
    }

}
