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.OtherPayable;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.mac.OtherPayableQuery;
import com.dk.mdm.model.response.mac.OtherPayableResponse;
import com.dk.mdm.model.vo.mac.OtherPayableVO;
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.OtherPayableService;

import java.util.Map;

@Api(tags = "其他支出单API接口")
@RestController
@RequestMapping("/mac/otherPayable")
public class OtherPayableController{

    public BaseService<OtherPayable> getService() {
        return otherPayableService;
    }

    @Autowired
    private OtherPayableService otherPayableService;

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

    /**
     * @desc :查询其它收入明细（明细附件）
     * @author : 付斌
     * @date : 2024-02-28 13:24
     */
    @PostMapping({"select_other_payable_info_by_id/{id}"})
    public ResponseResultVO<Map<String, Object>> selectOtherPayableInfoById(@PathVariable String id) {
        return otherPayableService.selectOtherPayableInfoById(id);
    }

    /**
     * @desc : 新建方法
     * @author : 付斌
     * @date : 2023/1/9 10:48
     */
    @ApiOperation(value = "新建", notes = "新建")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody OtherPayableVO otherPayableVO) {
        return otherPayableService.insert(otherPayableVO);
    }

    /**
     * @desc : 编辑方法
     * @author : 付斌
     * @date : 2023/1/9 10:49
     */
    @ApiOperation(value = "编辑", notes = "编辑")
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody OtherPayableVO otherPayableVO) {
        return otherPayableService.update(otherPayableVO);
    }

    /**
     * @desc :查询其它收入明细（明细附件）
     * @author : 付斌
     * @date : 2024-02-28 13:24
     */
    @PostMapping({"get_other_payable_for_update/{id}"})
    public ResponseResultVO<?> getOtherPayableForUpdate(@PathVariable String id) {
        return otherPayableService.getOtherPayableForUpdate(id);
    }
    /**
     * @desc : 通过ID查询
     * @author : 王英杰
     * @date : 2023/1/9 10:41
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return otherPayableService.getOtherPayableForUpdate(id);
    }
    /**
     * @desc : 作废
     * @author : 付斌
     * @date : 2024-03-08 16:36
     */
    @ApiOperation(value = "作废", notes = "作废")
    @PostMapping({"invalid/{id}"})
    public ResponseResultVO<?> invalid(@PathVariable String id) {
        return otherPayableService.invalid(id);
    }

}
