package com.boman.web.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.boman.domain.dto.AjaxResult;
import com.boman.domain.dto.ImportExcelDto;
import com.boman.web.core.service.excel.IImportExportExcelService;
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 javax.annotation.Resource;
import java.util.List;

/**
 * @author shiqian
 * @date 2021年06月08日 09:31
 **/
@RequestMapping("web-core/file/common")
@RestController
public class ImportExportExcelController {


    @Resource
    private IImportExportExcelService service;

    @PostMapping("/import")
    public AjaxResult importCommonData(@RequestBody ImportExcelDto dto) {
        List<JSONObject> dataList = dto.getDataList();
        String tableName = dto.getTableName();
        return service.importCommonData(tableName, dataList);
    }


}
