package com.xinelu.manage.controller.knowledgebase;

import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.manage.dto.knowledgebase.KnowledgeBaseSaveDto;
import com.xinelu.manage.dto.operationinfo.BaseInfoQueryDto;
import com.xinelu.manage.service.knowledgebase.IKnowledgeBaseService;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
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;

/**
 * @description: 知识库公共接口
 * @author: haown
 * @create: 2024-07-08 16:29
 **/
@Slf4j
@RestController
@RequestMapping("/manage/knowledge")
public class KnowledgeBaseController {

	@Resource
	private IKnowledgeBaseService knowlageBaseService;

	/**
	 * 知识库复制查询虚拟机构列表
	 */
	@ApiOperation("知识库复制查询虚拟机构知识库列表")
	@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:list')")
	@GetMapping("/getBaseList")
	public TableDataInfo getBaseInfoList(BaseInfoQueryDto baseInfoQueryDto) {
		return knowlageBaseService.getBaseInfoList(baseInfoQueryDto);
	}

	/**
	 * 新增知识库信息
	 */
	@ApiOperation("新增知识库信息")
	@PreAuthorize("@ss.hasPermi('operationInfo:operationInfo:add')")
	@PostMapping(value = "/copyBaseInfo")
	public R<String> copyBaseInfo(@RequestBody KnowledgeBaseSaveDto knowledgeBaseSaveDto) {
		knowlageBaseService.copyBaseInfo(knowledgeBaseSaveDto);
		return R.ok();
	}
}
