package com.tofly.feesapi.dzfp.controller;

import com.tofly.feesapi.common.core.ResultRespone;
import com.tofly.feesapi.common.exception.FeesErrorCode;
import com.tofly.feesapi.common.exception.FeesException;
import com.tofly.feesapi.dzfp.entity.dto.EiFpkjMx_select;
import com.tofly.feesapi.dzfp.service.EiFpkjMxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/eifpkjmx")
@Api(tags = "电子发票-(根据lsbh查看开票明细)")
public class EiFpkjMxController {

    @Autowired
    private EiFpkjMxService eiFpkjMxService;

    /**
     * 发票明细查询 list
     */
    @GetMapping("/List/{lsbh}")
    @ApiOperation(value = "List查询", response = EiFpkjMx_select.class, responseContainer = "List")
    public ResultRespone<List<EiFpkjMx_select>> getEiFpkjMxPage(@PathVariable("lsbh") String lsbh) {
        if (lsbh.isEmpty()) {
            throw new FeesException("提示：查看发票明细流水编号不能为空！", FeesErrorCode.BUSINESS_ERROR);
        }

        return ResultRespone.success(eiFpkjMxService.getList(lsbh));
    }
}
