package com.iplatform.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 com.walker.jdbc.util.StringUtils; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; /** * 表名:SDC_META_DB * * @author genrator */ public class Sdc_meta_db_mapper extends Sdc_meta_db implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new Sdc_meta_dbRowMapper(); // 主键 public static final String ID = "id"; // 普通属性 public static final String CREATE_TIME = "create_time"; public static final String STORE_ID = "store_id"; public static final String DATABASE_NAME = "database_name"; public static final String USED = "used"; public static final String IS_USING = "is_using"; public static final String HOST_INFO = "host_info"; public static final String TABLE_COUNT = "table_count"; public static final String SUMMARY = "summary"; public static final String PASSWORD = "password"; public static final String USERNAME = "username"; /** * 默认构造函数 */ public Sdc_meta_db_mapper(Sdc_meta_db sdc_meta_db) { if (sdc_meta_db == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (sdc_meta_db.isset_id) { this.setId(sdc_meta_db.getId()); } //普通属性 if (sdc_meta_db.isset_create_time) { this.setCreate_time(sdc_meta_db.getCreate_time()); } if (sdc_meta_db.isset_store_id) { this.setStore_id(sdc_meta_db.getStore_id()); } if (sdc_meta_db.isset_database_name) { this.setDatabase_name(sdc_meta_db.getDatabase_name()); } if (sdc_meta_db.isset_used) { this.setUsed(sdc_meta_db.getUsed()); } if (sdc_meta_db.isset_is_using) { this.setIs_using(sdc_meta_db.getIs_using()); } if (sdc_meta_db.isset_host_info) { this.setHost_info(sdc_meta_db.getHost_info()); } if (sdc_meta_db.isset_table_count) { this.setTable_count(sdc_meta_db.getTable_count()); } if (sdc_meta_db.isset_summary) { this.setSummary(sdc_meta_db.getSummary()); } if (sdc_meta_db.isset_password) { this.setPassword(sdc_meta_db.getPassword()); } if (sdc_meta_db.isset_username) { this.setUsername(sdc_meta_db.getUsername()); } // 去掉,2022-09-07 // this.setDatabaseName_(sdc_meta_db.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "sdc_meta_db"; /** 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> getInsertSql_() { InsertBuilder ib = new InsertBuilder(this.getTableName_()); ib.set(ID, this.getId()); ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); ib.set(STORE_ID, this.getStore_id(), this.isset_store_id); ib.set(DATABASE_NAME, this.getDatabase_name(), this.isset_database_name); ib.set(USED, this.getUsed(), this.isset_used); ib.set(IS_USING, this.getIs_using(), this.isset_is_using); ib.set(HOST_INFO, this.getHost_info(), this.isset_host_info); ib.set(TABLE_COUNT, this.getTable_count(), this.isset_table_count); ib.set(SUMMARY, this.getSummary(), this.isset_summary); ib.set(PASSWORD, this.getPassword(), this.isset_password); ib.set(USERNAME, this.getUsername(), this.isset_username); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(DATABASE_NAME, this.getDatabase_name(), this.isset_database_name); ub.set(USED, this.getUsed(), this.isset_used); ub.set(IS_USING, this.getIs_using(), this.isset_is_using); ub.set(HOST_INFO, this.getHost_info(), this.isset_host_info); ub.set(TABLE_COUNT, this.getTable_count(), this.isset_table_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(PASSWORD, this.getPassword(), this.isset_password); ub.set(USERNAME, this.getUsername(), this.isset_username); ub.where(this.getPkName_(), this.getPkValue_()); return ub.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_(String where, Map parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(DATABASE_NAME, this.getDatabase_name(), this.isset_database_name); ub.set(USED, this.getUsed(), this.isset_used); ub.set(IS_USING, this.getIs_using(), this.isset_is_using); ub.set(HOST_INFO, this.getHost_info(), this.isset_host_info); ub.set(TABLE_COUNT, this.getTable_count(), this.isset_table_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(PASSWORD, this.getPassword(), this.isset_password); ub.set(USERNAME, this.getUsername(), this.isset_username); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(DATABASE_NAME, this.getDatabase_name(), this.isset_database_name); ub.set(USED, this.getUsed(), this.isset_used); ub.set(IS_USING, this.getIs_using(), this.isset_is_using); ub.set(HOST_INFO, this.getHost_info(), this.isset_host_info); ub.set(TABLE_COUNT, this.getTable_count(), this.isset_table_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(PASSWORD, this.getPassword(), this.isset_password); ub.set(USERNAME, this.getUsername(), this.isset_username); return ub.genArraySql(where, parameters); } /** * 获取删除语句和参数 */ @Override public SqlAndParameters> getDeleteSql_() { DeleteBuilder db = new DeleteBuilder(this.getTableName_()); db.where(this.getPkName_(), this.getPkValue_()); return db.genMapSql(); } /** * 获取删除语句和参数 */ @Override public SqlAndParameters> getDeleteSql_(String where, Map parameters) { DeleteBuilder db = new DeleteBuilder(this.getTableName_()); return db.genMapSql(where, parameters); } /** * 获取删除语句和参数 */ @Override public SqlAndParameters getDeleteSql_(String where, Object[] parameters) { DeleteBuilder db = new DeleteBuilder(this.getTableName_()); return db.genArraySql(where, parameters); } /** * 获取单行查询语句和参数 */ @Override public SqlAndParameters> getSingleSql_() { SelectBuilder sb = new SelectBuilder(this.getTableName_()); sb.where(this.getPkName_(), this.getPkValue_()); return sb.genMapSql(); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters> getSelectSql_(String where, Map parameters) { return new SqlAndParameters<>("select id, create_time, store_id, database_name, used, is_using, host_info, table_count, summary, password, username from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, create_time, store_id, database_name, used, is_using, host_info, table_count, summary, password, username from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public Sdc_meta_db mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public Sdc_meta_db toSdc_meta_db() { return super.$clone(); } } /** * sdc_meta_db RowMapper * * @author genrator */ class Sdc_meta_dbRowMapper implements RowMapper { @Override public Sdc_meta_db mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); Sdc_meta_db sdc_meta_db = new Sdc_meta_db(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.ID); if (columnIndex > 0) { sdc_meta_db.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.CREATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_db.setCreate_time(null); } else { sdc_meta_db.setCreate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.STORE_ID); if (columnIndex > 0) { sdc_meta_db.setStore_id(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.DATABASE_NAME); if (columnIndex > 0) { sdc_meta_db.setDatabase_name(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.USED); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_db.setUsed(null); } else { sdc_meta_db.setUsed(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.IS_USING); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_db.setIs_using(null); } else { sdc_meta_db.setIs_using(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.HOST_INFO); if (columnIndex > 0) { sdc_meta_db.setHost_info(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.TABLE_COUNT); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_db.setTable_count(null); } else { sdc_meta_db.setTable_count(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.SUMMARY); if (columnIndex > 0) { sdc_meta_db.setSummary(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.PASSWORD); if (columnIndex > 0) { sdc_meta_db.setPassword(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_db_mapper.USERNAME); if (columnIndex > 0) { sdc_meta_db.setUsername(rs.getString(columnIndex)); } return sdc_meta_db; } }