package com.nantian.cloud.jljc.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nantian.cloud.jljc.entity.TDualcontrolProgressLog;
import com.nantian.cloud.jljc.service.TDualcontrolProgressLogService;
import com.nantian.sc.cloud.common.core.util.R;
import com.nantian.sc.cloud.common.log.annotation.SysLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * 能耗双控-完成情况填报修改日志
 */
@CrossOrigin
@RestController
@AllArgsConstructor
@RequestMapping("/tDualcontrolProgressLog")
@Api(value="tDualcontrolProgressLog",tags = "能耗双控-完成情况填报修改日志表")
public class TDualcontrolProgressLogController {

    @Autowired
    private TDualcontrolProgressLogService logService;

    @GetMapping("/listByProgressId")
    @SysLog("查询完成情况修改记录（双控）")
    @ApiOperation(value = "查询完成情况修改记录", notes = "查询完成情况修改记录")
    public R ListByProgressId(Long id){
       TDualcontrolProgressLog log = new TDualcontrolProgressLog();
       log.setDelFlag("1");
       log.setProgressId(id);
        return R.ok(logService.list(Wrappers.query(log)));
    }

    @GetMapping("/page")
    @SysLog("查询日志记录（双控）")
    @ApiOperation(value = "查询日志记录", notes = "查询日志记录")
    public R ListByRetreat(Page page, TDualcontrolProgressLog progressLog){
        progressLog.setDelFlag("1");
        return R.ok(logService.page(page,Wrappers.query(progressLog)));
    }

}
