mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-24 03:20:47 +08:00
代码生成器-数据表获取
This commit is contained in:
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -24,7 +23,7 @@ public class PageResult<T> {
|
||||
* @return PageList
|
||||
*/
|
||||
public static <T> PageResult<T> pageHelper(List<T> list) {
|
||||
PageResult<T> pageResult = new PageResult<T>();
|
||||
PageResult<T> pageResult = new PageResult<>();
|
||||
PageInfo<T> pageInfo = new PageInfo<>(list);
|
||||
pageResult.setCount(pageInfo.getTotal());
|
||||
pageResult.setPageNo(pageInfo.getPageNum());
|
||||
@@ -41,7 +40,7 @@ public class PageResult<T> {
|
||||
* @return PageList
|
||||
*/
|
||||
public static <T> PageResult<T> iPageHandle(IPage<T> iPage) {
|
||||
PageResult<T> pageResult = new PageResult<T>();
|
||||
PageResult<T> pageResult = new PageResult<>();
|
||||
pageResult.setCount(iPage.getTotal());
|
||||
pageResult.setPageNo((int) iPage.getCurrent());
|
||||
pageResult.setPageSize((int) iPage.getSize());
|
||||
@@ -57,7 +56,7 @@ public class PageResult<T> {
|
||||
* @return PageList
|
||||
*/
|
||||
public static <T> PageResult<T> iPageHandle(Long total, Long pageNo, Long size, List<T> lists) {
|
||||
PageResult<T> pageResult = new PageResult<T>();
|
||||
PageResult<T> pageResult = new PageResult<>();
|
||||
pageResult.setCount(total);
|
||||
pageResult.setPageNo(Math.toIntExact(pageNo));
|
||||
pageResult.setPageSize(Math.toIntExact(size));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.hxkj.common.entity.generate;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 代码生成业务实体
|
||||
*/
|
||||
@Data
|
||||
public class GenTable implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.hxkj.common.mapper.generate;
|
||||
|
||||
import com.hxkj.common.core.basics.IBaseMapper;
|
||||
import com.hxkj.common.entity.generate.GenTable;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GenTableMapper extends IBaseMapper<GenTable> {
|
||||
|
||||
@Select(
|
||||
"SELECT table_name, table_comment, create_time, update_time " +
|
||||
"FROM information_schema.tables " +
|
||||
"WHERE table_schema = (SELECT database()) " +
|
||||
"AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%' " +
|
||||
"AND table_name NOT IN (select table_name from ls_gen_table)"
|
||||
)
|
||||
List<Map<String, String>> selectDbTableList();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user