package com.jwipc.sys.controller.pc;

import com.jwipc.log.annotation.AuditLogInter;
import com.jwipc.sys.dto.MoldSettingsDTO;
import com.jwipc.sys.logic.MoldSettingsLogic;
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-01 10:21
 * 模具-产品设置
 */
@Controller
@RequestMapping(MODULE_ROOT + "/mold/moldSettings")
@RequiredArgsConstructor
public class MoldSettingsPageController {
    private final MoldSettingsLogic moldSettingsLogic;
    //主页面
    @GetMapping("/index")
    public String index() {
        return MODULE_ROOT + "/mold/moldSettings/list";
    }
    //详情页
    @AuditLogInter(value = "详情页数据", module = "摸具与产品关联")
    @GetMapping("/detail")
    public String detail(Model model, Long id) {
        MoldSettingsDTO moldSettings;
        moldSettings = moldSettingsLogic.getById(id);
        model.addAttribute("moldSettings", moldSettings);
        return MODULE_ROOT + "/mold/moldSettings/detail";
    }

    @AuditLogInter(value = "查看页数据", module = "摸具与产品关联")
    @GetMapping("/look")
    public String look(Model model, Long id) {
        MoldSettingsDTO moldSettings;
        moldSettings = moldSettingsLogic.getById(id);
        model.addAttribute("moldSettings", moldSettings);
        return MODULE_ROOT + "/mold/moldSettings/look";
    }
    //模具选择弹窗
    @GetMapping("/select")
    public String indexSelect() {
        return MODULE_ROOT + "/mold/moldSettings/select";
    }
}
