package com.jwipc.sys.controller.pc;

import com.jwipc.page.PageView;
import com.jwipc.sys.dto.SequenceEditDTO;
import com.jwipc.sys.logic.SequenceLogic;
import com.jwipc.sys.model.query.SequenceListQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@RestController
@RequestMapping(MODULE_ROOT + "/sequence")
@RequiredArgsConstructor
@Slf4j
public class SequenceRestController {
    private final SequenceLogic sequenceLogic;

    @GetMapping("list")
    public PageView index(SequenceListQuery query) {
        return sequenceLogic.getPageList(query);
    }

    @PostMapping("update")
    public ResponseEntity update(SequenceEditDTO sequenceEditDTO) {
        sequenceLogic.update(sequenceEditDTO);
        return ResponseEntity.ok().build();
    }


}
