package com.jwipc.sys.controller.pc;

import com.jwipc.sys.dto.DealtWithTargetInfoDTO;
import com.jwipc.sys.logic.DealtInfoLogic;
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 shenyang.ou
 * @date 2024/1/30 12:55
 * @desc 指标
 */
@Controller
@RequestMapping(MODULE_ROOT + "/dealt/info")
@RequiredArgsConstructor
public class DealtInfoPageController {
    private final DealtInfoLogic dealtInfoLogic;
    @GetMapping("/index")
    public String index() {
        return MODULE_ROOT + "/dealt/info/list";
    }

    @GetMapping("/detail")
    public String detail(Model model, Long id) {
        DealtWithTargetInfoDTO dto = dealtInfoLogic.getById(id);
        model.addAttribute("dwt", dto);
        return MODULE_ROOT + "/dealt/info/detail";
    }

    @GetMapping("/sql/detail")
    public String sqlDetail(Model model, Long id) {
        DealtWithTargetInfoDTO dto = dealtInfoLogic.getById(id);
        model.addAttribute("dwt", dto);
        return MODULE_ROOT + "/dealt/info/sql_detail";
    }


}
