| 12345678910111213141516171819202122232425262728 |
- package com.database2.server;
- import com.database2.dao.DataColumnMapper;
- import com.model.po.ColumnData;
- import com.model.pojo.RepCode;
- import com.model.pojo.RepEntity;
- import com.util.SqlMatch;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- @Service
- public class ImplementSqlService {
- @Autowired
- DataColumnMapper dataColumnMapper;
- /*
- 执行数据源
- */
- public RepEntity implementSql(String sqlStr){
- String tableName = SqlMatch.matchSql(sqlStr).toUpperCase();
- if ("".equals(tableName) || tableName == null){
- return new RepEntity(RepCode.Null);
- }
- List<ColumnData> columnData = dataColumnMapper.getColumn(tableName);
- return new RepEntity(RepCode.success, columnData);
- }
- }
|