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_TABLE * * @author genrator */ public class Sdc_meta_table_mapper extends Sdc_meta_table implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new Sdc_meta_tableRowMapper(); // 主键 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 DB_ID = "db_id"; public static final String TABLE_NAME = "table_name"; public static final String ROW_COUNT = "row_count"; public static final String SUMMARY = "summary"; /** * 默认构造函数 */ public Sdc_meta_table_mapper(Sdc_meta_table sdc_meta_table) { if (sdc_meta_table == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (sdc_meta_table.isset_id) { this.setId(sdc_meta_table.getId()); } //普通属性 if (sdc_meta_table.isset_create_time) { this.setCreate_time(sdc_meta_table.getCreate_time()); } if (sdc_meta_table.isset_store_id) { this.setStore_id(sdc_meta_table.getStore_id()); } if (sdc_meta_table.isset_db_id) { this.setDb_id(sdc_meta_table.getDb_id()); } if (sdc_meta_table.isset_table_name) { this.setTable_name(sdc_meta_table.getTable_name()); } if (sdc_meta_table.isset_row_count) { this.setRow_count(sdc_meta_table.getRow_count()); } if (sdc_meta_table.isset_summary) { this.setSummary(sdc_meta_table.getSummary()); } // 去掉,2022-09-07 // this.setDatabaseName_(sdc_meta_table.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "sdc_meta_table"; /** 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(DB_ID, this.getDb_id(), this.isset_db_id); ib.set(TABLE_NAME, this.getTable_name(), this.isset_table_name); ib.set(ROW_COUNT, this.getRow_count(), this.isset_row_count); ib.set(SUMMARY, this.getSummary(), this.isset_summary); 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(DB_ID, this.getDb_id(), this.isset_db_id); ub.set(TABLE_NAME, this.getTable_name(), this.isset_table_name); ub.set(ROW_COUNT, this.getRow_count(), this.isset_row_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); 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(DB_ID, this.getDb_id(), this.isset_db_id); ub.set(TABLE_NAME, this.getTable_name(), this.isset_table_name); ub.set(ROW_COUNT, this.getRow_count(), this.isset_row_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); 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(DB_ID, this.getDb_id(), this.isset_db_id); ub.set(TABLE_NAME, this.getTable_name(), this.isset_table_name); ub.set(ROW_COUNT, this.getRow_count(), this.isset_row_count); ub.set(SUMMARY, this.getSummary(), this.isset_summary); 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, db_id, table_name, row_count, summary from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, create_time, store_id, db_id, table_name, row_count, summary from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public Sdc_meta_table mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public Sdc_meta_table toSdc_meta_table() { return super.$clone(); } } /** * sdc_meta_table RowMapper * * @author genrator */ class Sdc_meta_tableRowMapper implements RowMapper { @Override public Sdc_meta_table mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); Sdc_meta_table sdc_meta_table = new Sdc_meta_table(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.ID); if (columnIndex > 0) { sdc_meta_table.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.CREATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_table.setCreate_time(null); } else { sdc_meta_table.setCreate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.STORE_ID); if (columnIndex > 0) { sdc_meta_table.setStore_id(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.DB_ID); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_table.setDb_id(null); } else { sdc_meta_table.setDb_id(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.TABLE_NAME); if (columnIndex > 0) { sdc_meta_table.setTable_name(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.ROW_COUNT); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_meta_table.setRow_count(null); } else { sdc_meta_table.setRow_count(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_meta_table_mapper.SUMMARY); if (columnIndex > 0) { sdc_meta_table.setSummary(rs.getString(columnIndex)); } return sdc_meta_table; } }