package com.jwipc.sys.controller.pc;

import com.jwipc.sys.dto.SequenceEditDTO;
import com.jwipc.sys.logic.SequenceLogic;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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 + "/sequence")
@RequiredArgsConstructor
@Slf4j
public class SequencePageController {
    private final SequenceLogic sequenceLogic;

    @RequestMapping("index")
    public String index() {
        return MODULE_ROOT + "/sequence/index";
    }

    @RequestMapping("edit")
    public String edit(Long id, Model model) {
        SequenceEditDTO sequenceEditDTO = sequenceLogic.getForEdit(id);
        model.addAttribute("sequence", sequenceEditDTO);
        return MODULE_ROOT + "/sequence/edit";
    }
}
