新增根据数据库名称与表名称查询表字段方法
parent
ddcc757b9c
commit
c7bd75be26
|
@ -215,4 +215,14 @@ public class GenController extends BaseController
|
||||||
public Result<List<String>> selDbNameAll(){
|
public Result<List<String>> selDbNameAll(){
|
||||||
return Result.success(genTableService.selDbNameAll());
|
return Result.success(genTableService.selDbNameAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据数据库名称与表名称查询表字段
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectDbTableColumnsByName/{dbName}/{table}")
|
||||||
|
public Result<List<GenTableColumn>> selTableAll(@PathVariable("dbName") String dbName,@PathVariable("table") String table){
|
||||||
|
List<GenTableColumn> genTableColumns = genTableColumnService.selectDbTableColumnsByName(table, dbName);
|
||||||
|
return Result.success(genTableColumns);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,4 +66,9 @@ public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||||
{
|
{
|
||||||
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GenTableColumn> selectDbTableColumnsByName(String table, String dbName) {
|
||||||
|
return genTableColumnMapper.selectDbTableColumnsByName(table,dbName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,6 +437,8 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
return genTableMapper.selDbNameAll();
|
return genTableMapper.selDbNameAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置主键列信息
|
* 设置主键列信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,4 +42,6 @@ public interface IGenTableColumnService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteGenTableColumnByIds(String ids);
|
public int deleteGenTableColumnByIds(String ids);
|
||||||
|
|
||||||
|
List<GenTableColumn> selectDbTableColumnsByName(String table, String dbName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="select_dbName">
|
<sql id="select_dbName">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="dbName!=null and dbName!=''">
|
<when test="dbName!=null and dbName!=''">
|
||||||
table_schema = #{dbName}
|
table_schema in (#{dbName})
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
table_schema = (select database())
|
table_schema = (select database())
|
||||||
|
@ -152,6 +152,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
|
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
|
||||||
GROUP BY table_schema
|
GROUP BY table_schema
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selFilterableByDbNameAndTableName" resultType="java.lang.String">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||||
insert into gen_table (
|
insert into gen_table (
|
||||||
|
|
Loading…
Reference in New Issue