package com.consum.model.po;
|
|
import com.walker.jdbc.BaseMapper;
|
import com.walker.jdbc.ResultSetUtils;
|
import com.walker.jdbc.SqlAndParameters;
|
import com.walker.jdbc.sqlgen.DeleteBuilder;
|
import com.walker.jdbc.sqlgen.InsertBuilder;
|
import com.walker.jdbc.sqlgen.SelectBuilder;
|
import com.walker.jdbc.sqlgen.UpdateBuilder;
|
import org.springframework.jdbc.core.RowMapper;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.Map;
|
|
/**
|
* 表名:FIN_FILE *
|
* @author genrator
|
*/
|
public class FinFile_mapper extends FinFile implements BaseMapper<FinFile> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<FinFile> ROW_MAPPER = new FinFileRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String CreateTime = "create_time";
|
public static final String UserName = "user_name";
|
public static final String ContentType = "content_type";
|
public static final String FileName = "file_name";
|
public static final String FileExt = "file_ext";
|
public static final String FilePath = "file_path";
|
public static final String FileSize = "file_size";
|
public static final String FileType = "file_type";
|
public static final String Summary = "summary";
|
|
/**
|
* 默认构造函数
|
*/
|
public FinFile_mapper(FinFile finFile) {
|
if (finFile == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (finFile.isset_id) {
|
this.setId(finFile.getId());
|
}
|
//普通属性
|
if (finFile.isset_createTime) {
|
this.setCreateTime(finFile.getCreateTime());
|
}
|
if (finFile.isset_userName) {
|
this.setUserName(finFile.getUserName());
|
}
|
if (finFile.isset_contentType) {
|
this.setContentType(finFile.getContentType());
|
}
|
if (finFile.isset_fileName) {
|
this.setFileName(finFile.getFileName());
|
}
|
if (finFile.isset_fileExt) {
|
this.setFileExt(finFile.getFileExt());
|
}
|
if (finFile.isset_filePath) {
|
this.setFilePath(finFile.getFilePath());
|
}
|
if (finFile.isset_fileSize) {
|
this.setFileSize(finFile.getFileSize());
|
}
|
if (finFile.isset_fileType) {
|
this.setFileType(finFile.getFileType());
|
}
|
if (finFile.isset_summary) {
|
this.setSummary(finFile.getSummary());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(fin_file.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "fin_file";
|
/**
|
if (StringUtils.isNotEmpty(this.getDatabaseName_())) {
|
return this.getDatabaseName_() + "." + tableName;
|
} else {
|
return tableName;
|
}
|
*/
|
return tableName;
|
}
|
|
/**
|
* 获取主键名称
|
*/
|
@Override
|
public String getPkName_() {
|
return Id;
|
}
|
|
/**
|
* 获取主键值
|
*/
|
@Override
|
public Object getPkValue_() {
|
return this.getId();
|
}
|
|
/**
|
* 获取插入语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getInsertSql_() {
|
InsertBuilder ib = new InsertBuilder(this.getTableName_());
|
ib.set(Id, this.getId());
|
ib.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ib.set(UserName, this.getUserName(), this.isset_userName);
|
ib.set(ContentType, this.getContentType(), this.isset_contentType);
|
ib.set(FileName, this.getFileName(), this.isset_fileName);
|
ib.set(FileExt, this.getFileExt(), this.isset_fileExt);
|
ib.set(FilePath, this.getFilePath(), this.isset_filePath);
|
ib.set(FileSize, this.getFileSize(), this.isset_fileSize);
|
ib.set(FileType, this.getFileType(), this.isset_fileType);
|
ib.set(Summary, this.getSummary(), this.isset_summary);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(UserName, this.getUserName(), this.isset_userName);
|
ub.set(ContentType, this.getContentType(), this.isset_contentType);
|
ub.set(FileName, this.getFileName(), this.isset_fileName);
|
ub.set(FileExt, this.getFileExt(), this.isset_fileExt);
|
ub.set(FilePath, this.getFilePath(), this.isset_filePath);
|
ub.set(FileSize, this.getFileSize(), this.isset_fileSize);
|
ub.set(FileType, this.getFileType(), this.isset_fileType);
|
ub.set(Summary, this.getSummary(), this.isset_summary);
|
ub.where(this.getPkName_(), this.getPkValue_());
|
return ub.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(UserName, this.getUserName(), this.isset_userName);
|
ub.set(ContentType, this.getContentType(), this.isset_contentType);
|
ub.set(FileName, this.getFileName(), this.isset_fileName);
|
ub.set(FileExt, this.getFileExt(), this.isset_fileExt);
|
ub.set(FilePath, this.getFilePath(), this.isset_filePath);
|
ub.set(FileSize, this.getFileSize(), this.isset_fileSize);
|
ub.set(FileType, this.getFileType(), this.isset_fileType);
|
ub.set(Summary, this.getSummary(), this.isset_summary);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(UserName, this.getUserName(), this.isset_userName);
|
ub.set(ContentType, this.getContentType(), this.isset_contentType);
|
ub.set(FileName, this.getFileName(), this.isset_fileName);
|
ub.set(FileExt, this.getFileExt(), this.isset_fileExt);
|
ub.set(FilePath, this.getFilePath(), this.isset_filePath);
|
ub.set(FileSize, this.getFileSize(), this.isset_fileSize);
|
ub.set(FileType, this.getFileType(), this.isset_fileType);
|
ub.set(Summary, this.getSummary(), this.isset_summary);
|
return ub.genArraySql(where, parameters);
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getDeleteSql_() {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
db.where(this.getPkName_(), this.getPkValue_());
|
return db.genMapSql();
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
return db.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
return db.genArraySql(where, parameters);
|
}
|
|
/**
|
* 获取单行查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getSingleSql_() {
|
SelectBuilder sb = new SelectBuilder(this.getTableName_());
|
sb.where(this.getPkName_(), this.getPkValue_());
|
return sb.genMapSql();
|
}
|
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) {
|
return new SqlAndParameters<>("select id, create_time, user_name, content_type, file_name, file_ext, file_path, file_size, file_type, summary from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, create_time, user_name, content_type, file_name, file_ext, file_path, file_size, file_type, summary from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public FinFile mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public FinFile toFinFile() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* fin_file RowMapper
|
*
|
* @author genrator
|
*/
|
class FinFileRowMapper implements RowMapper<FinFile> {
|
|
@Override
|
public FinFile mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
FinFile fin_file = new FinFile();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.Id);
|
if (columnIndex > 0) {
|
fin_file.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.CreateTime);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
fin_file.setCreateTime(null);
|
} else {
|
fin_file.setCreateTime(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.UserName);
|
if (columnIndex > 0) {
|
fin_file.setUserName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.ContentType);
|
if (columnIndex > 0) {
|
fin_file.setContentType(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.FileName);
|
if (columnIndex > 0) {
|
fin_file.setFileName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.FileExt);
|
if (columnIndex > 0) {
|
fin_file.setFileExt(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.FilePath);
|
if (columnIndex > 0) {
|
fin_file.setFilePath(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.FileSize);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
fin_file.setFileSize(null);
|
} else {
|
fin_file.setFileSize(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.FileType);
|
if (columnIndex > 0) {
|
fin_file.setFileType(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, FinFile_mapper.Summary);
|
if (columnIndex > 0) {
|
fin_file.setSummary(rs.getString(columnIndex));
|
}
|
return fin_file;
|
}
|
}
|