package com.fjhx.account.controller.account;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.account.entity.account.dto.AccountManagementDto;
import com.fjhx.account.entity.account.dto.AccountManagementSelectDto;
import com.fjhx.account.entity.account.po.AccountManagement;
import com.fjhx.account.entity.account.po.AccountRemainder;
import com.fjhx.account.entity.account.vo.AccountManagementVo;
import com.fjhx.account.service.account.AccountManagementService;
import com.fjhx.common.constant.SourceConstant;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * <p>
 * 账户-管理表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-06
 */
@DS(SourceConstant.ACCOUNT)
@RestController
@RequestMapping("/accountManagement")
public class AccountManagementController {

    @Autowired
    private AccountManagementService accountManagementService;

    /**
     * 账户-管理表分页
     */
    @PostMapping("/page")
    public Page<AccountManagementVo> page(@RequestBody AccountManagementSelectDto dto) {
        return accountManagementService.getPage(dto);
    }

    /**
     * 账户-管理表明细
     */
    @PostMapping("/detail")
    public AccountManagementDto detail(@RequestBody BaseSelectDto dto) {
        return accountManagementService.detail(dto.getId());
    }

    /**
     * 账户-管理表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody AccountManagementDto accountManagementDto) {
        accountManagementService.add(accountManagementDto);
    }

    /**
     * 账户-管理表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AccountManagementDto accountManagementDto) {
        accountManagementService.edit(accountManagementDto);
    }

    /**
     * 账户-管理表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        accountManagementService.delete(dto.getId());
    }

//    /**
//     * 导入账户表的数据
//     */
//    @PostMapping("/importsAmount")
//    public void importsAmount(@RequestBody AccountManagementDto dto) {
//        accountManagementService.importsAmount(dto);
//    }

    /**
     * 账户统计(账户列表)
     */
    @PostMapping("/managementStatistics")
    public List<Map<String, Object>> managementStatistics(@RequestBody AccountManagementSelectDto dto) {
        return accountManagementService.managementStatistics(dto);
    }
}
