package com.zcloud.modules.custormerInfo.controller;

import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.modules.custormerInfo.entity.BusCustomerAuditRecordsEntity;
import com.zcloud.modules.custormerInfo.service.BusCustomerAuditRecordsService;
import com.zcloud.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;

/**
 * @Author makejava
 * @Desc 客户企业审核记录表(BusCustomerAuditRecords)表控制层
 * @Date 2024-03-29 19:30:07
 */
@Api(tags = "客户企业审核记录表")
@RestController
@RequestMapping("busCustomerAuditRecords")
public class BusCustomerAuditRecordsController extends AbstractController {

    @Autowired
    private BusCustomerAuditRecordsService busCustomerAuditRecordsService;

    @ApiOperation("客户企业审核记录表-新增数据")
    @SysLog("客户企业审核记录表-新增数据")
    @PostMapping("/save")
    public R insert(@RequestBody BusCustomerAuditRecordsEntity param) {
        param.setCreator(getUserId());
		param.setOperator(getUserId());
        busCustomerAuditRecordsService.save(param);

        return R.ok();
    }

    @ApiOperation("客户企业审核记录表-编辑数据")
    @SysLog("客户企业审核记录表-编辑数据")
    @PostMapping("/update")
    public R update(@RequestBody BusCustomerAuditRecordsEntity param) throws Exception {
        param.setOperator(getUserId());
        busCustomerAuditRecordsService.addAndUpdateInfo(param,getUserId());

        return R.ok();
    }


    @ApiOperation("客户企业审核记录表-删除数据")
    @SysLog("客户企业审核记录表-删除数据")
    @PostMapping("/delete")
    public R delete(@RequestBody BusCustomerAuditRecordsEntity param) {
        busCustomerAuditRecordsService.delete(param.getCustomerAuditRecordsId(),getUserId());
        return R.ok();
    }

    @ApiOperation("客户企业审核记录表-分页查询")
    @SysLog("客户企业审核记录表-分页查询")
    @PostMapping("/listPage")
    public R listPage(@RequestBody Map<String, Object> params) {
        PageUtils page = busCustomerAuditRecordsService.listPage(params);

		return R.ok().put("page", page);
    }


    @ApiOperation("客户企业审核记录表-根据ID查详情")
    @SysLog("客户企业审核记录表-根据ID查详情")
    @PostMapping("/info")
    public R info(@RequestBody BusCustomerAuditRecordsEntity param) {
        BusCustomerAuditRecordsEntity busCustomerAuditRecords = busCustomerAuditRecordsService.getById(param.getCustomerAuditRecordsId());
        return R.ok().put("busCustomerAuditRecords", busCustomerAuditRecords);
    }

}
