package com.jwipc.sys.controller.pc;

import cn.hutool.core.util.StrUtil;
import com.jwipc.sys.logic.JobLogic;
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 org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

import static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Controller
@RequestMapping(MODULE_ROOT + "/job")
@RequiredArgsConstructor
public class JobManagerPageController {
    @Resource
    private JobLogic jobLogic;

    @GetMapping("index")
    public String index() {
        return MODULE_ROOT + "/job/index";
    }

    @GetMapping("addOrEdit")
    public String add(@RequestParam(required = false, defaultValue = StrUtil.EMPTY) String jobName, Model model) {
        model.addAttribute("jobName", jobName);
        return MODULE_ROOT + "/job/add_edit";
    }
}
