/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称:
 * 创建日期:2023/8/7
 */
package org.springblade.modules.report.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.report.dto.WeekReportInfoDTO;
import org.springblade.modules.report.entity.WeekOrgCountInfoEntity;
import org.springblade.modules.report.service.IWeekOrgCountService;
import org.springblade.modules.report.vo.WeekReportInfoVO;
import org.springblade.modules.report.wrapper.WeekReportInfoWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

/***
 * Date:2023/8/7
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@RestController
@RequestMapping("galaxy-business/report")
@RequiredArgsConstructor
@Api(value = "报表管理模块", tags = "报表管理模块")
public class ReportController extends BladeController {

	@Resource
	private IWeekOrgCountService weekReportService;

	@GetMapping("/week/page")
	@ApiOperationSupport(order = 3)
	@ApiOperation(value = "分页", notes = "传入实体类CheckOrderInfoDTO")
	public R<IPage<WeekReportInfoVO>> page(@ApiIgnore WeekReportInfoDTO dto, Query query) {
		BladeUser user = AuthUtil.getUser();
		IPage<WeekOrgCountInfoEntity> pages = weekReportService.page(Condition.getPage(query));
		return R.data(WeekReportInfoWrapper.build().pageVO(pages));
	}

	/**
	 * 删除
	 */
	@PostMapping("/week/remove")
	@ApiOperationSupport(order = 7)
	@ApiOperation(value = "逻辑删除", notes = "传入ID数组")
	public R weekRemove(@ApiParam(value = "主键集合") @RequestParam String ids) {
		boolean temp = weekReportService.deleteLogic(Func.toLongList(ids));
		return R.status(temp);
	}

}
