package com.nantian.cloud.jljc.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nantian.cloud.jljc.entity.EnterpriseStandard;
import com.nantian.cloud.jljc.service.EnterpriseStandardService;
import com.nantian.sc.cloud.common.core.util.R;
import com.nantian.sc.cloud.common.log.annotation.SysLog;
import com.nantian.sc.cloud.common.security.service.ScUser;
import com.nantian.sc.cloud.common.security.util.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@AllArgsConstructor
@RequestMapping("/EnterpriseStandard")
@Api(value = "EnterpriseStandard",tags ="企业对标")
public class EnterpriseStandardController {
    private EnterpriseStandardService enterpriseStandardService;
    /**
     * 对标查询
     */
    @GetMapping("/selectall")
    @SysLog("企业对标基本信息")
    @ApiOperation(value = "企业对标基本信息", notes = "获取企业对标基本信息")
    @ApiImplicitParam(name = "enterpriseStandard", value = "enterpriseStandard", required = false, dataType = "json", paramType = "path")
    public R selectall(Page page, EnterpriseStandard enterpriseStandard) {
        ScUser u = SecurityUtils.getUser();
        enterpriseStandard.setEpc(u.getEnterpriseCode());
        enterpriseStandard.setDelFlag("1"); //筛选未删除项
        return R.ok(enterpriseStandardService.selectall(page,enterpriseStandard));
    }

    /**
     *修改企业对标
     */
    @PutMapping("/updateall")
    @SysLog("修改企业对标")
    @ApiOperation(value = "修改企业对标", notes = "修改企业对标")
    @ApiImplicitParam(name = "enterpriseStandard", value = "企业对标", required = true, dataType = "Boolean", paramType = "path")
    public boolean updateAll(@RequestBody EnterpriseStandard enterpriseStandard)  {
        return enterpriseStandardService.updateall(enterpriseStandard);
    }
}
