parent
9946cf16e9
commit
c8a4069885
@ -0,0 +1,41 @@
|
||||
package com.xcs.wx.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* SQLite 数据库中的一个系统表
|
||||
*
|
||||
* @author xcs
|
||||
* @date 2024年6月13日09:18:29
|
||||
*/
|
||||
@Data
|
||||
@TableName("sqlite_master")
|
||||
public class SqliteMaster {
|
||||
|
||||
/**
|
||||
* type
|
||||
*/
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* tblName
|
||||
*/
|
||||
@TableField("tbl_name")
|
||||
private String tblName;
|
||||
|
||||
/**
|
||||
* rootPage
|
||||
*/
|
||||
@TableField("rootpage")
|
||||
private String rootPage;
|
||||
|
||||
/**
|
||||
* sql
|
||||
*/
|
||||
@TableField("sql")
|
||||
private String sql;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xcs.wx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xcs.wx.domain.Session;
|
||||
import com.xcs.wx.domain.SqliteMaster;
|
||||
import com.xcs.wx.domain.vo.SessionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SQLite 数据库中的一个系统表 Mapper
|
||||
*
|
||||
* @author xcs
|
||||
* @date 2023年12月21日 17时08分
|
||||
**/
|
||||
public interface SqliteMasterMapper extends BaseMapper<SqliteMaster> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xcs.wx.repository;
|
||||
|
||||
/**
|
||||
* SQLite 数据库中的一个系统表 Repository
|
||||
*
|
||||
* @author xcs
|
||||
* @date 2024年6月13日09:19:24
|
||||
*/
|
||||
public interface SqliteMasterRepository {
|
||||
|
||||
/**
|
||||
* 查看表是否存在
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @return 是否存在
|
||||
*/
|
||||
boolean isTableExists(String tableName);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xcs.wx.repository.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xcs.wx.domain.SqliteMaster;
|
||||
import com.xcs.wx.mapper.SqliteMasterMapper;
|
||||
import com.xcs.wx.repository.SqliteMasterRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class SqliteMasterRepositoryImpl extends ServiceImpl<SqliteMasterMapper, SqliteMaster> implements SqliteMasterRepository {
|
||||
|
||||
@Override
|
||||
public boolean isTableExists(String tableName) {
|
||||
LambdaQueryWrapper<SqliteMaster> wrapper = Wrappers.<SqliteMaster>lambdaQuery()
|
||||
.eq(SqliteMaster::getType, "table")
|
||||
.eq(SqliteMaster::getTblName, tableName);
|
||||
return super.count(wrapper) > 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue