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; /** * 表名:S_PAY_DEFINITION * * @author genrator */ public class S_pay_definition_mapper extends S_pay_definition implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new S_pay_definitionRowMapper(); // 主键 public static final String ID = "id"; // 普通属性 public static final String CREATE_TIME = "create_time"; public static final String NAME = "name"; public static final String SERVICE_PROVIDER = "service_provider"; public static final String VERSION = "version"; public static final String PAY_CHANNEL = "pay_channel"; public static final String PROVIDER_CLASS = "provider_class"; public static final String ENABLED = "enabled"; public static final String SUMMARY = "summary"; public static final String ORDER_CONVERTOR_CLASS = "order_convertor_class"; /** * 默认构造函数 */ public S_pay_definition_mapper(S_pay_definition s_pay_definition) { if (s_pay_definition == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (s_pay_definition.isset_id) { this.setId(s_pay_definition.getId()); } //普通属性 if (s_pay_definition.isset_create_time) { this.setCreate_time(s_pay_definition.getCreate_time()); } if (s_pay_definition.isset_name) { this.setName(s_pay_definition.getName()); } if (s_pay_definition.isset_service_provider) { this.setService_provider(s_pay_definition.getService_provider()); } if (s_pay_definition.isset_version) { this.setVersion(s_pay_definition.getVersion()); } if (s_pay_definition.isset_pay_channel) { this.setPay_channel(s_pay_definition.getPay_channel()); } if (s_pay_definition.isset_provider_class) { this.setProvider_class(s_pay_definition.getProvider_class()); } if (s_pay_definition.isset_enabled) { this.setEnabled(s_pay_definition.getEnabled()); } if (s_pay_definition.isset_summary) { this.setSummary(s_pay_definition.getSummary()); } if (s_pay_definition.isset_order_convertor_class) { this.setOrder_convertor_class(s_pay_definition.getOrder_convertor_class()); } // 去掉,2022-09-07 // this.setDatabaseName_(s_pay_definition.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "s_pay_definition"; /** 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(NAME, this.getName(), this.isset_name); ib.set(SERVICE_PROVIDER, this.getService_provider(), this.isset_service_provider); ib.set(VERSION, this.getVersion(), this.isset_version); ib.set(PAY_CHANNEL, this.getPay_channel(), this.isset_pay_channel); ib.set(PROVIDER_CLASS, this.getProvider_class(), this.isset_provider_class); ib.set(ENABLED, this.getEnabled(), this.isset_enabled); ib.set(SUMMARY, this.getSummary(), this.isset_summary); ib.set(ORDER_CONVERTOR_CLASS, this.getOrder_convertor_class(), this.isset_order_convertor_class); 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(NAME, this.getName(), this.isset_name); ub.set(SERVICE_PROVIDER, this.getService_provider(), this.isset_service_provider); ub.set(VERSION, this.getVersion(), this.isset_version); ub.set(PAY_CHANNEL, this.getPay_channel(), this.isset_pay_channel); ub.set(PROVIDER_CLASS, this.getProvider_class(), this.isset_provider_class); ub.set(ENABLED, this.getEnabled(), this.isset_enabled); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(ORDER_CONVERTOR_CLASS, this.getOrder_convertor_class(), this.isset_order_convertor_class); 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(NAME, this.getName(), this.isset_name); ub.set(SERVICE_PROVIDER, this.getService_provider(), this.isset_service_provider); ub.set(VERSION, this.getVersion(), this.isset_version); ub.set(PAY_CHANNEL, this.getPay_channel(), this.isset_pay_channel); ub.set(PROVIDER_CLASS, this.getProvider_class(), this.isset_provider_class); ub.set(ENABLED, this.getEnabled(), this.isset_enabled); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(ORDER_CONVERTOR_CLASS, this.getOrder_convertor_class(), this.isset_order_convertor_class); 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(NAME, this.getName(), this.isset_name); ub.set(SERVICE_PROVIDER, this.getService_provider(), this.isset_service_provider); ub.set(VERSION, this.getVersion(), this.isset_version); ub.set(PAY_CHANNEL, this.getPay_channel(), this.isset_pay_channel); ub.set(PROVIDER_CLASS, this.getProvider_class(), this.isset_provider_class); ub.set(ENABLED, this.getEnabled(), this.isset_enabled); ub.set(SUMMARY, this.getSummary(), this.isset_summary); ub.set(ORDER_CONVERTOR_CLASS, this.getOrder_convertor_class(), this.isset_order_convertor_class); 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, name, service_provider, version, pay_channel, provider_class, enabled, summary, order_convertor_class from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, create_time, name, service_provider, version, pay_channel, provider_class, enabled, summary, order_convertor_class from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public S_pay_definition mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public S_pay_definition toS_pay_definition() { return super.$clone(); } } /** * s_pay_definition RowMapper * * @author genrator */ class S_pay_definitionRowMapper implements RowMapper { @Override public S_pay_definition mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); S_pay_definition s_pay_definition = new S_pay_definition(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.ID); if (columnIndex > 0) { s_pay_definition.setId(rs.getString(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.CREATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { s_pay_definition.setCreate_time(null); } else { s_pay_definition.setCreate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.NAME); if (columnIndex > 0) { s_pay_definition.setName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.SERVICE_PROVIDER); if (columnIndex > 0) { s_pay_definition.setService_provider(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.VERSION); if (columnIndex > 0) { s_pay_definition.setVersion(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.PAY_CHANNEL); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { s_pay_definition.setPay_channel(null); } else { s_pay_definition.setPay_channel(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.PROVIDER_CLASS); if (columnIndex > 0) { s_pay_definition.setProvider_class(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.ENABLED); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { s_pay_definition.setEnabled(null); } else { s_pay_definition.setEnabled(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.SUMMARY); if (columnIndex > 0) { s_pay_definition.setSummary(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, S_pay_definition_mapper.ORDER_CONVERTOR_CLASS); if (columnIndex > 0) { s_pay_definition.setOrder_convertor_class(rs.getString(columnIndex)); } return s_pay_definition; } }