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.BusInvoicingAuditHistoryEntity;
import com.zcloud.modules.custormerInfo.service.BusInvoicingAuditHistoryService;
import com.zcloud.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.List;
import java.util.Map;
 
/**
 * @Author lizenan
 * @Desc 开票表(用于记录原值，每次更新开票表都插入原来的值)(BusInvoicingAuditHistory)表控制层
 * @Date 2024-04-03 15:20:56
 */
@Api(tags = "开票表(用于记录原值，每次更新开票表都插入原来的值)")
@RestController
@RequestMapping("busInvoicingAuditHistory")
public class BusInvoicingAuditHistoryController extends AbstractController {
 
    @Autowired
    private BusInvoicingAuditHistoryService busInvoicingAuditHistoryService;
 
    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-新增数据")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-新增数据")
    @PostMapping("/save")
    public R insert(@RequestBody BusInvoicingAuditHistoryEntity param) {
        param.setCreator(getUserId());
		param.setOperator(getUserId());
        busInvoicingAuditHistoryService.save(param);
        
        return R.ok();
    }
    
    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-编辑数据")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-编辑数据")
    @PostMapping("/update")
    public R update(@RequestBody BusInvoicingAuditHistoryEntity param) {
        param.setOperator(getUserId());
        busInvoicingAuditHistoryService.updateById(param);
        
        return R.ok();
    }
    
     
    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-删除数据")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-删除数据")
    @PostMapping("/delete")
    public R delete(@RequestBody BusInvoicingAuditHistoryEntity param) {
        busInvoicingAuditHistoryService.delete(param.getInvoicingAuditHistoryId(),getUserId());
        return R.ok();
    }
 
    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-分页查询")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-分页查询")
    @PostMapping("/listPage")
    public R listPage(@RequestBody Map<String, Object> params) {
        PageUtils page = busInvoicingAuditHistoryService.listPage(params);

		return R.ok().put("page", page);
    }
    
 
    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-根据ID查详情")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-根据ID查详情")
    @PostMapping("/info")
    public R info(@RequestBody BusInvoicingAuditHistoryEntity param) {
        BusInvoicingAuditHistoryEntity busInvoicingAuditHistory = busInvoicingAuditHistoryService.info(param.getInvoicingAuditHistoryId());
        return R.ok().put("data", busInvoicingAuditHistory);
    }

    @ApiOperation("开票表(用于记录原值，每次更新开票表都插入原来的值)-根据ID查详情")
    @SysLog("开票表(用于记录原值，每次更新开票表都插入原来的值)-根据ID查详情")
    @PostMapping("/listByInvoicingId")
    public R listByInvoicingId(@RequestBody BusInvoicingAuditHistoryEntity param) {
        List<BusInvoicingAuditHistoryEntity> list = busInvoicingAuditHistoryService.listByInvoicingId(param.getInvoicingId());
        return R.ok().put("data", list);
    }
 
}
