package com.boman.web.core.controller;

import com.boman.domain.dto.AjaxResult;
import com.boman.domain.GenTable;
import com.boman.web.core.service.TableServiceCmdService;
import io.swagger.annotations.ApiOperation;
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;


/**
 * @author shiqian
 * @description
 * @date 2021年03月22日 09:19
 **/
@RestController
@RequestMapping("/p/cs/table")
public class TableController {

    @Autowired
    private TableServiceCmdService tableServiceCmdService;

    /**
     * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
     *                {
     *                    "table": "sys_config",
     *                }
     *
     *
     * @param condition condition
     * @return com.boman.domain.dto.AjaxResult
     */
//    @ApiOperation(value = "根据表名获取表单所有信息")
//    @PostMapping("/getByTableName")
//    public AjaxResult getByTableName(@RequestBody BaseTableSaveDTO condition) {
//        return tableServiceCmdService.getByTableName(condition);
//    }

    /**
     * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
     *                          {
     *                              "tableId": 1
     *                          }
     *
     * @param table table
     * @return com.boman.domain.dto.AjaxResult
     */
    @ApiOperation(value = "根据表名获取表单所有信息, 没有过滤")
    @PostMapping("/listAllColumnsByTableId")
    public AjaxResult listAllColumnsByTableId(@RequestBody GenTable table) {
        return tableServiceCmdService.listAllColumnsByTableId(table);
    }


}
