package com.dk.mdm.controller.mac;

import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mac.Account;
import com.dk.common.controller.BaseController;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.mac.AccountItemQuery;
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.AccountService;


@Api(tags = "账款对象API接口")
@RestController
@RequestMapping("/mac/account")
public class AccountController extends BaseController<Account> {

    public BaseService<Account> getService() {
        return accountService;
    }

    @Autowired
    private AccountService accountService;


    /**
     * @desc : 查看来源单据,总单加明细
     * @author : 姜永辉
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return accountService.selectById(id);
    }



    /**
     * @desc : 只查询总单, 不包含总单加明细
     * @author : 姜永辉
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/get_account/{id}"})
    public ResponseResultVO selectAccountById(@PathVariable String id) {
        return accountService.selectAccountById(id);
    }

    /**
     * @desc :  总单加明细总数量
     * @author : 姜永辉
     * @date : 2024/3/6 10:36
     */
    @PostMapping({"/get_account_item_count"})
    public ResponseResultVO countByCond(@RequestBody AccountItemQuery accountItemQuery) {
        return accountService.countByCond(accountItemQuery);
    }



    /**
     * @desc : 查询应收账款明细
     * @author : 付斌
     * @date : 2023/1/9 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"get_receivable_account_item"})
    public ResponseResultVO<?> getReceivableAccountItem(@RequestBody AccountItemQuery accountItemQuery) {
        return accountService.getReceivableAccountItem(accountItemQuery);
    }

    /**
     * @desc : 查询应付账款明细
     * @author : 付斌
     * @date : 2023/1/9 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"get_payable_account_item"})
    public ResponseResultVO<?> getPayableAccountItem(@RequestBody AccountItemQuery accountItemQuery) {
        return accountService.getPayableAccountItem(accountItemQuery);
    }

    /**
     * @desc : 查询应收收款总额（制单员权限）
     * @author : 周兴
     * @date : 2024/4/3 10:36
     */
    @ApiOperation(value = "查询应收收款总额（制单员权限）", notes = "查询应收收款总额（制单员权限）")
    @PostMapping({"get_receivable_account_sum"})
    public ResponseResultVO<?> getReceivableAccountSum(@RequestBody AccountItemQuery accountItemQuery) {
        return accountService.getReceivableAccountSum(accountItemQuery);
    }
}
