package com.cf.imes.module.system.controller.admin.customplateno;

import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.controller.admin.customplateno.vo.CustomPlateNoRuleResetModeReqVO;
import com.cf.imes.module.system.service.customplateno.CustomPlateNoSeqService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.validation.Valid;

import static com.cf.imes.framework.common.pojo.CommonResult.success;

/**
 * 自定义板编号管理控制器
 *
 * @author Gqr
 * @since 2024/11/7 16:36
 */
@Tag(name = "管理后台 - 系统配置 - 自定义板编号")
@RestController
@RequestMapping("/system/config/customplateno")
@Validated
public class CustomPlateNoController {
    @Resource
    private CustomPlateNoSeqService customPlateNoSeqService;

    @PostMapping("/initValue")
    @Operation(summary = "手动复位/清零")
    @PreAuthorize("@ss.hasPermission('system:base-setting:setting')")
    public CommonResult<Boolean> updateRuleResetMode(@Valid @RequestBody CustomPlateNoRuleResetModeReqVO reqVO) {
        customPlateNoSeqService.updateRuleResetMode(reqVO);
        return success(true);
    }
}
