package com.copy.trade.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.copy.trade.entity.form.StatisticsDataForm;
import com.copy.trade.entity.form.TraderDataQueryForm;
import com.copy.trade.entity.po.StatisticsData;
import com.copy.trade.entity.po.TraderData;
import com.copy.trade.enums.TraderEnum;
import com.copy.trade.service.IStatisticsDataService;
import com.copy.trade.util.WebAssert;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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;
/**
 * <p>
 * 统计数据表 前端控制器
 * </p>
 *
 * @author wz
 * @since 2022-11-29
 */
@Api(value = "每日统计数据表", tags = "每日统计数据表")
@RestController
@RequestMapping("/statistics-data")
public class StatisticsDataController {

	IStatisticsDataService statisticsDataServiceImpl;

	/**
	 * 推荐使用构造器注入
	 * @param statisticsDataServiceImpl
	 */	
	@Autowired
	StatisticsDataController(IStatisticsDataService statisticsDataServiceImpl) {
		this.statisticsDataServiceImpl = statisticsDataServiceImpl;
	}
	
	@ApiOperation(value = "每日统计数据列表")
	@PostMapping("/list/{traderId}")
	public List<StatisticsData> list(@PathVariable Long traderId){
		WebAssert.isNotNull(traderId,"chk.trader.traderId.not.null");
		return statisticsDataServiceImpl.traderDataList(traderId);
	}
	
	@ApiOperation(value = "修改交易员每日统计数据")
	@PostMapping("/edit")
	public Boolean edit(@RequestBody List<StatisticsDataForm> statisticsDataForms){
		return statisticsDataServiceImpl.edit(statisticsDataForms);
	}

}
