package com.crm.manager.controller;

import com.crm.manager.service.FinanceTransferFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.model.dto.finance.transfer.FinanceTransferSearchDto;
import com.crm.rely.backend.model.entity.finance.transfer.FinanceTransferDeleteEntity;
import com.crm.rely.backend.model.entity.finance.transfer.FinanceTransferSearchEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @description: 内转
 * @author: houn
 * @create: 2020-07-07 18:01
 **/
@RestController
@RequestMapping("/finance/transfer")
public class FinanceTransferController {

    @Autowired
    private FinanceTransferFeignService financeTransferFeignService;


    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated FinanceTransferDeleteEntity entity) throws Exception {

        return financeTransferFeignService.delete(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<FinanceTransferSearchDto> searchList(@RequestBody @Validated FinanceTransferSearchEntity entity) throws Exception {

        ResultWithPagerDto<FinanceTransferSearchDto> resultWithPagerDto = financeTransferFeignService.searcherList(entity);
        return resultWithPagerDto;
    }

    @PostMapping("/search/single")
    public BaseResultDto searchSingle(@RequestBody @Validated SingleLongEntity entity) throws Exception {
        BaseResultDto<FinanceTransferSearchDto> resultDto = financeTransferFeignService.searcherSingle(entity);
        return resultDto;
    }

}
