添加方法查询所有表
parent
5f0be34298
commit
aa9fd1e5f0
|
@ -9,6 +9,7 @@ import com.muyu.common.log.enums.BusinessType;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
import com.muyu.gen.service.IGenTableColumnService;
|
||||
import com.muyu.gen.service.IGenTableService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -216,6 +217,13 @@ public class GenController extends BaseController
|
|||
return Result.success(genTableService.selDbNameAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有表,不分数据库
|
||||
*/
|
||||
@GetMapping("/db/listAll")
|
||||
public Result<List<GenTableResp>> genListAll() {
|
||||
return success(genTableService.selectDbTableListAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据库名称与表名称查询表字段
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.muyu.gen.domain;
|
||||
|
||||
import com.muyu.common.core.constant.GenConstants;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 业务表 gen_table
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GenTableResp extends BaseEntity {
|
||||
|
||||
private String dbName;
|
||||
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 表描述
|
||||
*/
|
||||
private String tableComment;
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.gen.mapper;
|
||||
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -85,4 +86,6 @@ public interface GenTableMapper
|
|||
public int deleteGenTableByIds(@Param("ids") Long[] ids);
|
||||
|
||||
List<String> selDbNameAll();
|
||||
|
||||
List<GenTableResp> selectDbTableListAll();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableColumn;
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
import com.muyu.gen.mapper.GenTableColumnMapper;
|
||||
import com.muyu.gen.mapper.GenTableMapper;
|
||||
import com.muyu.gen.util.GenUtils;
|
||||
|
@ -437,6 +438,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||
return genTableMapper.selDbNameAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GenTableResp> selectDbTableListAll() {
|
||||
return genTableMapper.selectDbTableListAll();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.gen.service;
|
||||
|
||||
import com.muyu.gen.domain.GenTable;
|
||||
import com.muyu.gen.domain.GenTableResp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -123,4 +124,6 @@ public interface IGenTableService
|
|||
public void validateEdit(GenTable genTable);
|
||||
|
||||
List<String> selDbNameAll();
|
||||
|
||||
List<GenTableResp> selectDbTableListAll();
|
||||
}
|
||||
|
|
|
@ -155,6 +155,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selFilterableByDbNameAndTableName" resultType="java.lang.String">
|
||||
|
||||
</select>
|
||||
<select id="selectDbTableListAll" resultType="com.muyu.gen.domain.GenTableResp">
|
||||
select table_name,table_comment,table_schema from information_schema.tables
|
||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%'
|
||||
and table_schema in (select table_schema from information_schema.tables
|
||||
WHERE table_schema NOT IN ('information_schema', 'mysql', 'performance_schema', 'sys')
|
||||
GROUP BY table_schema)
|
||||
</select>
|
||||
|
||||
<insert id="insertGenTable" parameterType="com.muyu.gen.domain.GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||
insert into gen_table (
|
||||
|
|
Loading…
Reference in New Issue