package com.yifu.cloud.plus.v1.yifu.archives.controller;

import com.yifu.cloud.plus.v1.yifu.archives.entity.TContractPreDetail;
import com.yifu.cloud.plus.v1.yifu.archives.service.TContractPreDetailService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
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 java.util.List;

/**
 * 合同流程中信息记录表
 *
 * @author system
 * @date 2026-04-23
 */
@RestController
@RequestMapping("/tcontractpredetail")
@RequiredArgsConstructor
public class TContractPreDetailController {

	private final TContractPreDetailService tContractPreDetailService;

	/**
	 * 批量保存合同流程中信息
	 */
	@Operation(description = "批量保存合同流程中信息")
	@Inner
	@PostMapping("/inner/saveBatch")
	public Boolean saveBatch(@RequestBody List<TContractPreDetail> detailList) {
		if (Common.isEmpty(detailList)) {
			return true;
		}
		return tContractPreDetailService.saveBatch(detailList);
	}
}
