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_GATHER * * @author genrator */ public class Sdc_gather_mapper extends Sdc_gather implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new Sdc_gatherRowMapper(); // 主键 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 NAME = "name"; public static final String DESCRIPTION = "description"; public static final String SRC_TYPE = "src_type"; public static final String SRC_URL = "src_url"; public static final String SRC_PORT = "src_port"; public static final String SRC_SERVICE = "src_service"; public static final String SRC_USER = "src_user"; public static final String SRC_PASS = "src_pass"; public static final String STORE_ID = "store_id"; public static final String STATUS = "status"; public static final String SCHEDULE_ID = "schedule_id"; /** * 默认构造函数 */ public Sdc_gather_mapper(Sdc_gather sdc_gather) { if (sdc_gather == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (sdc_gather.isset_id) { this.setId(sdc_gather.getId()); } //普通属性 if (sdc_gather.isset_create_time) { this.setCreate_time(sdc_gather.getCreate_time()); } if (sdc_gather.isset_create_user) { this.setCreate_user(sdc_gather.getCreate_user()); } if (sdc_gather.isset_name) { this.setName(sdc_gather.getName()); } if (sdc_gather.isset_description) { this.setDescription(sdc_gather.getDescription()); } if (sdc_gather.isset_src_type) { this.setSrc_type(sdc_gather.getSrc_type()); } if (sdc_gather.isset_src_url) { this.setSrc_url(sdc_gather.getSrc_url()); } if (sdc_gather.isset_src_port) { this.setSrc_port(sdc_gather.getSrc_port()); } if (sdc_gather.isset_src_service) { this.setSrc_service(sdc_gather.getSrc_service()); } if (sdc_gather.isset_src_user) { this.setSrc_user(sdc_gather.getSrc_user()); } if (sdc_gather.isset_src_pass) { this.setSrc_pass(sdc_gather.getSrc_pass()); } if (sdc_gather.isset_store_id) { this.setStore_id(sdc_gather.getStore_id()); } if (sdc_gather.isset_status) { this.setStatus(sdc_gather.getStatus()); } if (sdc_gather.isset_schedule_id) { this.setSchedule_id(sdc_gather.getSchedule_id()); } // 去掉,2022-09-07 // this.setDatabaseName_(sdc_gather.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "sdc_gather"; /** 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(NAME, this.getName(), this.isset_name); ib.set(DESCRIPTION, this.getDescription(), this.isset_description); ib.set(SRC_TYPE, this.getSrc_type(), this.isset_src_type); ib.set(SRC_URL, this.getSrc_url(), this.isset_src_url); ib.set(SRC_PORT, this.getSrc_port(), this.isset_src_port); ib.set(SRC_SERVICE, this.getSrc_service(), this.isset_src_service); ib.set(SRC_USER, this.getSrc_user(), this.isset_src_user); ib.set(SRC_PASS, this.getSrc_pass(), this.isset_src_pass); ib.set(STORE_ID, this.getStore_id(), this.isset_store_id); ib.set(STATUS, this.getStatus(), this.isset_status); ib.set(SCHEDULE_ID, this.getSchedule_id(), this.isset_schedule_id); 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(NAME, this.getName(), this.isset_name); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(SRC_TYPE, this.getSrc_type(), this.isset_src_type); ub.set(SRC_URL, this.getSrc_url(), this.isset_src_url); ub.set(SRC_PORT, this.getSrc_port(), this.isset_src_port); ub.set(SRC_SERVICE, this.getSrc_service(), this.isset_src_service); ub.set(SRC_USER, this.getSrc_user(), this.isset_src_user); ub.set(SRC_PASS, this.getSrc_pass(), this.isset_src_pass); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(SCHEDULE_ID, this.getSchedule_id(), this.isset_schedule_id); 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(NAME, this.getName(), this.isset_name); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(SRC_TYPE, this.getSrc_type(), this.isset_src_type); ub.set(SRC_URL, this.getSrc_url(), this.isset_src_url); ub.set(SRC_PORT, this.getSrc_port(), this.isset_src_port); ub.set(SRC_SERVICE, this.getSrc_service(), this.isset_src_service); ub.set(SRC_USER, this.getSrc_user(), this.isset_src_user); ub.set(SRC_PASS, this.getSrc_pass(), this.isset_src_pass); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(SCHEDULE_ID, this.getSchedule_id(), this.isset_schedule_id); 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(NAME, this.getName(), this.isset_name); ub.set(DESCRIPTION, this.getDescription(), this.isset_description); ub.set(SRC_TYPE, this.getSrc_type(), this.isset_src_type); ub.set(SRC_URL, this.getSrc_url(), this.isset_src_url); ub.set(SRC_PORT, this.getSrc_port(), this.isset_src_port); ub.set(SRC_SERVICE, this.getSrc_service(), this.isset_src_service); ub.set(SRC_USER, this.getSrc_user(), this.isset_src_user); ub.set(SRC_PASS, this.getSrc_pass(), this.isset_src_pass); ub.set(STORE_ID, this.getStore_id(), this.isset_store_id); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(SCHEDULE_ID, this.getSchedule_id(), this.isset_schedule_id); 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, name, description, src_type, src_url, src_port, src_service, src_user, src_pass, store_id, status, schedule_id from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, create_time, create_user, name, description, src_type, src_url, src_port, src_service, src_user, src_pass, store_id, status, schedule_id from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public Sdc_gather mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public Sdc_gather toSdc_gather() { return super.$clone(); } } /** * sdc_gather RowMapper * * @author genrator */ class Sdc_gatherRowMapper implements RowMapper { @Override public Sdc_gather mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); Sdc_gather sdc_gather = new Sdc_gather(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.ID); if (columnIndex > 0) { sdc_gather.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.CREATE_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_gather.setCreate_time(null); } else { sdc_gather.setCreate_time(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.CREATE_USER); if (columnIndex > 0) { sdc_gather.setCreate_user(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.NAME); if (columnIndex > 0) { sdc_gather.setName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.DESCRIPTION); if (columnIndex > 0) { sdc_gather.setDescription(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_TYPE); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_gather.setSrc_type(null); } else { sdc_gather.setSrc_type(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_URL); if (columnIndex > 0) { sdc_gather.setSrc_url(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_PORT); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_gather.setSrc_port(null); } else { sdc_gather.setSrc_port(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_SERVICE); if (columnIndex > 0) { sdc_gather.setSrc_service(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_USER); if (columnIndex > 0) { sdc_gather.setSrc_user(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SRC_PASS); if (columnIndex > 0) { sdc_gather.setSrc_pass(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.STORE_ID); if (columnIndex > 0) { sdc_gather.setStore_id(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.STATUS); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_gather.setStatus(null); } else { sdc_gather.setStatus(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, Sdc_gather_mapper.SCHEDULE_ID); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { sdc_gather.setSchedule_id(null); } else { sdc_gather.setSchedule_id(rs.getInt(columnIndex)); } } return sdc_gather; } }