package cn.lihongjie.coal.coalWashingDailyAnalysis.controller;

import cn.lihongjie.coal.annotation.OrgScope;
import cn.lihongjie.coal.annotation.SysLog;
import cn.lihongjie.coal.base.controller.BaseController;
import cn.lihongjie.coal.base.dto.CommonQuery;
import cn.lihongjie.coal.base.dto.IdRequest;
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisDto;
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CreateCoalWashingDailyAnalysisDto;
import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.UpdateCoalWashingDailyAnalysisDto;
import cn.lihongjie.coal.coalWashingDailyAnalysis.service.CoalWashingDailyAnalysisService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
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;

@RequestMapping("/coalWashingDailyAnalysis")
@RestController
@SysLog(module = "洗煤报告表")
@OrgScope
public class CoalWashingDailyAnalysisController extends BaseController {

    @Autowired CoalWashingDailyAnalysisService service;

    @PostMapping("/calculate")
    @SysLog(action = "计算")
    public CoalWashingDailyAnalysisDto calculate(
            @RequestBody CreateCoalWashingDailyAnalysisDto dto) {
        return this.service.calculate(dto);
    }

    //    @PostMapping("/predict")
    //    @SysLog(action = "预测分析")
    //    public CoalWashingDailyAnalysisDto predict(
    //            @RequestBody CreateCoalWashingDailyAnalysisDto dto) {
    //        return this.service.predict(dto);
    //    }
    @PostMapping("/create")
    @SysLog(action = "新增")
    public CoalWashingDailyAnalysisDto create(@RequestBody CreateCoalWashingDailyAnalysisDto dto) {
        return this.service.create(dto);
    }

    @PostMapping("/update")
    @SysLog(action = "编辑")
    public CoalWashingDailyAnalysisDto update(@RequestBody UpdateCoalWashingDailyAnalysisDto dto) {
        return this.service.update(dto);
    }

    @PostMapping("/delete")
    @SysLog(action = "删除")
    public Object delete(@RequestBody IdRequest dto) {
        this.service.delete(dto);
        return true;
    }

    @PostMapping("/archive")
    @SysLog(action = "归档")
    public Object archive(@RequestBody IdRequest dto) {
        this.service.archive(dto);
        return true;
    }

    @PostMapping("/unarchive")
    @SysLog(action = "取消归档")
    public Object unarchive(@RequestBody IdRequest dto) {
        this.service.unarchive(dto);
        return true;
    }

    @PostMapping("/list")
    public Page<CoalWashingDailyAnalysisDto> list(@RequestBody CommonQuery dto) {
        return this.service.list(dto);
    }

    @PostMapping("/getById")
    public CoalWashingDailyAnalysisDto getById(@RequestBody IdRequest dto) {
        return this.service.getById(dto.getId());
    }
}
