mirror of
https://github.com/zfile-dev/zfile.git
synced 2025-04-19 05:34:52 +00:00
切换 ORM 框架为 JPA, 数据库为 H2.
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
package im.zhaojun.common.enums;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class StorageTypeEnumTypeHandler extends BaseTypeHandler<StorageTypeEnum>{
|
||||
|
||||
public StorageTypeEnumTypeHandler(Class<StorageTypeEnum> type) {
|
||||
if (type == null)
|
||||
throw new IllegalArgumentException("Type argument cannot be null");
|
||||
StorageTypeEnum[] enums = type.getEnumConstants();
|
||||
if (enums == null)
|
||||
throw new IllegalArgumentException(type.getSimpleName()
|
||||
+ " does not represent an enum type.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTypeEnum getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String i = rs.getString(columnName);
|
||||
if (rs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return StorageTypeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTypeEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String i = rs.getString(columnIndex);
|
||||
if (rs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return StorageTypeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTypeEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String i = cs.getString(columnIndex);
|
||||
if (cs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return StorageTypeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, StorageTypeEnum parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setString(i, parameter.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package im.zhaojun.common.enums;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ViewModeEnumTypeHandler extends BaseTypeHandler<ViewModeEnum>{
|
||||
|
||||
public ViewModeEnumTypeHandler(Class<ViewModeEnum> type) {
|
||||
if (type == null)
|
||||
throw new IllegalArgumentException("Type argument cannot be null");
|
||||
ViewModeEnum[] enums = type.getEnumConstants();
|
||||
if (enums == null)
|
||||
throw new IllegalArgumentException(type.getSimpleName()
|
||||
+ " does not represent an enum type.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewModeEnum getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String i = rs.getString(columnName);
|
||||
if (rs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return ViewModeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewModeEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String i = rs.getString(columnIndex);
|
||||
if (rs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return ViewModeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewModeEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String i = cs.getString(columnIndex);
|
||||
if (cs.wasNull()) {
|
||||
return null;
|
||||
} else {
|
||||
return ViewModeEnum.getEnum(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, ViewModeEnum parameter, JdbcType jdbcType)
|
||||
throws SQLException {
|
||||
ps.setString(i, parameter.getValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package im.zhaojun.common.mapper;
|
||||
|
||||
import im.zhaojun.common.enums.StorageTypeEnum;
|
||||
import im.zhaojun.common.model.StorageConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StorageConfigMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(StorageConfig record);
|
||||
|
||||
int insertSelective(StorageConfig record);
|
||||
|
||||
StorageConfig selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(StorageConfig record);
|
||||
|
||||
int updateByPrimaryKey(StorageConfig record);
|
||||
|
||||
List<StorageConfig> selectStorageConfigByType(StorageTypeEnum type);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package im.zhaojun.common.mapper;
|
||||
|
||||
import im.zhaojun.common.model.SystemConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SystemConfigMapper {
|
||||
|
||||
int insert(SystemConfig record);
|
||||
|
||||
int updateByPrimaryKeySelective(SystemConfig record);
|
||||
|
||||
int updateByPrimaryKey(SystemConfig record);
|
||||
|
||||
SystemConfig selectFirstConfig();
|
||||
}
|
||||
Reference in New Issue
Block a user