package com.dk.mdm.controller.mac;

import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mac.MacTransfer;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.mac.MacTransferQuery;
import com.dk.mdm.model.response.mac.MacTransferResponse;
import com.dk.mdm.model.vo.mac.MacTransferVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import com.dk.mdm.service.mac.MacTransferService;

import java.util.Map;

@Api(tags = "资金转账API接口")
@RestController
@RequestMapping("/mac/transfer")
public class MacTransferController {

    public BaseService<MacTransfer> getService() {
        return macTransferService;
    }

    @Autowired
    private MacTransferService macTransferService;

    /**
     * @desc : 条件查询
     * @author : 付斌
     * @date : 2023/1/9 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<MacTransferResponse>> selectByCond(@RequestBody MacTransferQuery macTransferQuery) {
        return macTransferService.selectByCond(macTransferQuery);
    }

    /**
     * @desc : 查询转账明细
     * @author : 付斌
     * @date : 2023/1/9 10:36
     */
    @PostMapping({"select_mac_transfer_info_by_id/{id}"})
    public ResponseResultVO<Map<String, Object>> selectMacTransferInfoById(@PathVariable String id) {
        return macTransferService.selectMacTransferInfoById(id);
    }

    /**
     * @desc   : 通过ID查询
     * @author : 付斌
     * @date   : 2024/3/1 16:01
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return macTransferService.selectById(id);
    }

    /**
     * @desc : 新建
     * @author : 付斌
     * @date : 2023/1/9 10:48
     */
    @ApiOperation(value = "新建客户收款", notes = "新建客户收款")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody MacTransferVO macTransferVO) {
        return macTransferService.insert(macTransferVO);
    }

    /**
     * @desc : 编辑
     * @author : 付斌
     * @date : 2023/1/9 10:49
     */
    @ApiOperation(value = "编辑客户收款/退款", notes = "编辑客户收款/退款")
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody MacTransferVO macTransferVO) {
        return macTransferService.update(macTransferVO);
    }

    /**
     * @desc :查询转账明细（编辑用）
     * @author : 付斌
     * @date : 2024-02-28 13:24
     */
    @PostMapping({"get_mac_transfer_for_update/{id}"})
    public ResponseResultVO<?> getMacTransferForUpdate(@PathVariable String id) {
        return macTransferService.getMacTransferForUpdate(id);
    }


    /**
     * @desc : 作废
     * @author : 付斌
     * @date : 2024-03-08 16:36
     */
    @ApiOperation(value = "作废", notes = "作废")
    @PostMapping({"invalid/{id}"})
    public ResponseResultVO<?> invalid(@PathVariable String id) {
        return macTransferService.invalid(id);
    }
}
