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_STORE * * @author genrator */ public class Sdc_store_mapper extends Sdc_store implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new Sdc_storeRowMapper(); // 主键 public static final String ID = "id"; // 普通属性 public static final String CREATE_TIME = "create_time"; public static final String CREATE_USER = "create_user"; public static final String DESCRIPTION = "description"; public static final String INNER_USE = "inner_use"; public static final String TYPE = "type"; public static final String DATABASE_TYPE = "database_type"; public static final String STRATEGY = "strategy"; public static final String DELETED = "deleted"; public static final String UPDATE_TIME = "update_time"; public static final String UPDATE_USER = "update_user"; public static final String DEFINE_NAME = "define_name"; public static final String SELECT_HOSTS = "select_hosts"; /** * 默认构造函数 */ public Sdc_store_mapper(Sdc_store sdc_store) { if (sdc_store == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (sdc_store.isset_id) { this.setId(sdc_store.getId()); } //普通属性 if (sdc_store.isset_create_time) { this.setCreate_time(sdc_store.getCreate_time()); } if (sdc_store.isset_create_user) { this.setCreate_user(sdc_store.getCreate_user()); } if (sdc_store.isset_description) { this.setDescription(sdc_store.getDescription()); } if (sdc_store.isset_inner_use) { this.setInner_use(sdc_store.getInner_use()); } if (sdc_store.isset_type) { this.setType(sdc_store.getType()); } if (sdc_store.isset_database_type) { this.setDatabase_type(sdc_store.getDatabase_type()); } if (sdc_store.isset_strategy) { this.setStrategy(sdc_store.getStrategy()); } if (sdc_store.isset_deleted) { this.setDeleted(sdc_store.getDeleted()); } if (sdc_store.isset_update_time) { this.setUpdate_time(sdc_store.getUpdate_time()); } if (sdc_store.isset_update_user) { this.setUpdate_user(sdc_store.getUpdate_user()); } if (sdc_store.isset_define_name) { this.setDefine_name(sdc_store.getDefine_name()); } if (sdc_store.isset_select_hosts) { this.setSelect_hosts(sdc_store.getSelect_hosts()); } // 去掉,2022-09-07 // this.setDatabaseName_(sdc_store.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "sdc_store"; /** 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(CREATE_USER, this.getCreate_user(), this.isset_create_user); ib.set(DESCRIPTION, this.getDescription(), this.isset_description); ib.set(INNER_USE, this.getInner_use(), this.isset_inner_use); ib.set(TYPE, this.getType(), this.isset_type); ib.set(DATABASE_TYPE, this.getDatabase_type(), this.isset_database_type); ib.set(STRATEGY, this.getStrategy(), this.isset_strategy); ib.set(DELETED, this.getDeleted(), this.isset_deleted); ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); ib.set(UPDATE_USER, this.getUpdate_user(), this.isset_update_user); ib.set(DEFINE_NAME, this.getDefine_name(), this.isset_define_name); ib.set(SELECT_HOSTS, this.getSelect_hosts(), this.isset_select_hosts); 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(CREATE_USER, this.getCreate_user(), this.isset_create_user); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(INNER_USE, this.getInner_use(), this.isset_inner_use); ub.set(TYPE, this.getType(), this.isset_type); ub.set(DATABASE_TYPE, this.getDatabase_type(), this.isset_database_type); ub.set(STRATEGY, this.getStrategy(), this.isset_strategy); ub.set(DELETED, this.getDeleted(), this.isset_deleted); ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); ub.set(UPDATE_USER, this.getUpdate_user(), this.isset_update_user); ub.set(DEFINE_NAME, this.getDefine_name(), this.isset_define_name); ub.set(SELECT_HOSTS, this.getSelect_hosts(), this.isset_select_hosts); 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(CREATE_USER, this.getCreate_user(), this.isset_create_user); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(INNER_USE, this.getInner_use(), this.isset_inner_use); ub.set(TYPE, this.getType(), this.isset_type); ub.set(DATABASE_TYPE, this.getDatabase_type(), this.isset_database_type); ub.set(STRATEGY, this.getStrategy(), this.isset_strategy); ub.set(DELETED, this.getDeleted(), this.isset_deleted); ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); ub.set(UPDATE_USER, this.getUpdate_user(), this.isset_update_user); ub.set(DEFINE_NAME, this.getDefine_name(), this.isset_define_name); ub.set(SELECT_HOSTS, this.getSelect_hosts(), this.isset_select_hosts); 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(CREATE_USER, this.getCreate_user(), this.isset_create_user); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(INNER_USE, this.getInner_use(), this.isset_inner_use); ub.set(TYPE, this.getType(), this.isset_type); ub.set(DATABASE_TYPE, this.getDatabase_type(), this.isset_database_type); ub.set(STRATEGY, this.getStrategy(), this.isset_strategy); ub.set(DELETED, this.getDeleted(), this.isset_deleted); ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); ub.set(UPDATE_USER, this.getUpdate_user(), this.isset_update_user); ub.set(DEFINE_NAME, this.getDefine_name(), this.isset_define_name); ub.set(SELECT_HOSTS, this.getSelect_hosts(), this.isset_select_hosts); 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, create_user, description, inner_use, type, database_type, strategy, deleted, update_time, update_user, define_name, select_hosts from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, create_time, create_user, description, inner_use, type, database_type, strategy, deleted, update_time, update_user, define_name, select_hosts from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public Sdc_store mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public Sdc_store toSdc_store() { return super.$clone(); } } /** * sdc_store RowMapper * * @author genrator */ class Sdc_storeRowMapper implements RowMapper { @Override public Sdc_store mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); Sdc_store sdc_store = new Sdc_store(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.ID); if (columnIndex > 0) { sdc_store.setId(rs.getString(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.CREATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_store.setCreate_time(null); } else { sdc_store.setCreate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.CREATE_USER); if (columnIndex > 0) { sdc_store.setCreate_user(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.DESCRIPTION); if (columnIndex > 0) { sdc_store.setDescription(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.INNER_USE); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_store.setInner_use(null); } else { sdc_store.setInner_use(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.TYPE); if (columnIndex > 0) { sdc_store.setType(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.DATABASE_TYPE); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_store.setDatabase_type(null); } else { sdc_store.setDatabase_type(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.STRATEGY); if (columnIndex > 0) { sdc_store.setStrategy(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.DELETED); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_store.setDeleted(null); } else { sdc_store.setDeleted(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.UPDATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_store.setUpdate_time(null); } else { sdc_store.setUpdate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.UPDATE_USER); if (columnIndex > 0) { sdc_store.setUpdate_user(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.DEFINE_NAME); if (columnIndex > 0) { sdc_store.setDefine_name(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_store_mapper.SELECT_HOSTS); if (columnIndex > 0) { sdc_store.setSelect_hosts(rs.getString(columnIndex)); } return sdc_store; } }