package org.springblade.system.tool;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.annotation.RequiresPermissions;
import org.springblade.common.annotation.SysLog;
import org.springblade.common.core.controller.BaseController;
import org.springblade.common.core.domain.AjaxResult;
import org.springblade.common.core.domain.entity.KyDataCollectData;
import org.springblade.common.core.page.TableDataInfo;
import org.springblade.common.enums.OperaType;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.system.service.DataCollectDataService;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 数据汇集管理
 *
 * @author 马三炮
 * @date 2025/9/10
 */
@RestController
@RequestMapping("/data/Collect")
@Slf4j
@NonDS
public class DataCollectDataController extends BaseController {

	@Resource
	private DataCollectDataService dataCollectDataService;

	/**
	 * 根据数据类型数据汇集管理列表
	 *
	 * @param kyDataCollectData
	 * @return
	 */
	@SysLog(title = "数据汇集管理", businessType = OperaType.QUERY, module = "数据汇集管理->数据汇集管理", details = "根据数据类型数据汇集管理列表")
	@RequiresPermissions("data:Collect:list")
	@PostMapping("/list")
	public TableDataInfo list(@RequestBody KyDataCollectData kyDataCollectData) {
		List<KyDataCollectData> list = dataCollectDataService.selectKyDataCollectDataList(kyDataCollectData);
		return getDataTable(list);
	}

	@SysLog(title = "数据汇集管理详情", businessType = OperaType.QUERY, module = "数据汇集管理->数据汇集管理", details = "数据汇集管理详情")
	@GetMapping("/queryById")
	public AjaxResult queryById(KyDataCollectData kyDataCollectData) {
		Map map = dataCollectDataService.queryDetailById(kyDataCollectData);
		return AjaxResult.success(map);
	}


}
