package com.consum.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; /** * 表名:WH_FORM_PROCURE * * @author genrator */ public class WhFormProcure_mapper extends WhFormProcure implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new WhFormProcureRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String BusinessFormCode = "business_form_code"; public static final String WarehouseId = "warehouse_id"; public static final String WarehouseName = "warehouse_name"; public static final String OperatorId = "operator_id"; public static final String OperatorName = "operator_name"; public static final String ProcureTime = "procure_time"; public static final String ProcureDoc = "procure_doc"; public static final String States = "states"; public static final String AgencyId = "agency_id"; public static final String AgencyName = "agency_name"; public static final String OperatorId2 = "operator_id2"; public static final String OperatorName2 = "operator_name2"; public static final String IncomeTime = "income_time"; public static final String Beiz = "beiz"; /** * 默认构造函数 */ public WhFormProcure_mapper(WhFormProcure whFormProcure) { if (whFormProcure == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (whFormProcure.isset_id) { this.setId(whFormProcure.getId()); } //普通属性 if (whFormProcure.isset_businessFormCode) { this.setBusinessFormCode(whFormProcure.getBusinessFormCode()); } if (whFormProcure.isset_warehouseId) { this.setWarehouseId(whFormProcure.getWarehouseId()); } if (whFormProcure.isset_warehouseName) { this.setWarehouseName(whFormProcure.getWarehouseName()); } if (whFormProcure.isset_operatorId) { this.setOperatorId(whFormProcure.getOperatorId()); } if (whFormProcure.isset_operatorName) { this.setOperatorName(whFormProcure.getOperatorName()); } if (whFormProcure.isset_procureTime) { this.setProcureTime(whFormProcure.getProcureTime()); } if (whFormProcure.isset_procureDoc) { this.setProcureDoc(whFormProcure.getProcureDoc()); } if (whFormProcure.isset_states) { this.setStates(whFormProcure.getStates()); } if (whFormProcure.isset_agencyId) { this.setAgencyId(whFormProcure.getAgencyId()); } if (whFormProcure.isset_agencyName) { this.setAgencyName(whFormProcure.getAgencyName()); } if (whFormProcure.isset_operatorId2) { this.setOperatorId2(whFormProcure.getOperatorId2()); } if (whFormProcure.isset_operatorName2) { this.setOperatorName2(whFormProcure.getOperatorName2()); } if (whFormProcure.isset_incomeTime) { this.setIncomeTime(whFormProcure.getIncomeTime()); } if (whFormProcure.isset_beiz) { this.setBeiz(whFormProcure.getBeiz()); } // 去掉,2022-09-07 // this.setDatabaseName_(wh_form_procure.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "wh_form_procure"; /** 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(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ib.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ib.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ib.set(ProcureTime, this.getProcureTime(), this.isset_procureTime); ib.set(ProcureDoc, this.getProcureDoc(), this.isset_procureDoc); ib.set(States, this.getStates(), this.isset_states); ib.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ib.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ib.set(OperatorId2, this.getOperatorId2(), this.isset_operatorId2); ib.set(OperatorName2, this.getOperatorName2(), this.isset_operatorName2); ib.set(IncomeTime, this.getIncomeTime(), this.isset_incomeTime); ib.set(Beiz, this.getBeiz(), this.isset_beiz); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(ProcureTime, this.getProcureTime(), this.isset_procureTime); ub.set(ProcureDoc, this.getProcureDoc(), this.isset_procureDoc); ub.set(States, this.getStates(), this.isset_states); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(OperatorId2, this.getOperatorId2(), this.isset_operatorId2); ub.set(OperatorName2, this.getOperatorName2(), this.isset_operatorName2); ub.set(IncomeTime, this.getIncomeTime(), this.isset_incomeTime); ub.set(Beiz, this.getBeiz(), this.isset_beiz); 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(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(ProcureTime, this.getProcureTime(), this.isset_procureTime); ub.set(ProcureDoc, this.getProcureDoc(), this.isset_procureDoc); ub.set(States, this.getStates(), this.isset_states); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(OperatorId2, this.getOperatorId2(), this.isset_operatorId2); ub.set(OperatorName2, this.getOperatorName2(), this.isset_operatorName2); ub.set(IncomeTime, this.getIncomeTime(), this.isset_incomeTime); ub.set(Beiz, this.getBeiz(), this.isset_beiz); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(ProcureTime, this.getProcureTime(), this.isset_procureTime); ub.set(ProcureDoc, this.getProcureDoc(), this.isset_procureDoc); ub.set(States, this.getStates(), this.isset_states); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(OperatorId2, this.getOperatorId2(), this.isset_operatorId2); ub.set(OperatorName2, this.getOperatorName2(), this.isset_operatorName2); ub.set(IncomeTime, this.getIncomeTime(), this.isset_incomeTime); ub.set(Beiz, this.getBeiz(), this.isset_beiz); 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, business_form_code, warehouse_id, warehouse_name, operator_id, operator_name, procure_time, procure_doc, states, agency_id, agency_name, operator_id2, operator_name2, income_time, beiz from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, business_form_code, warehouse_id, warehouse_name, operator_id, operator_name, procure_time, procure_doc, states, agency_id, agency_name, operator_id2, operator_name2, income_time, beiz from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public WhFormProcure mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public WhFormProcure toWhFormProcure() { return super.$clone(); } } /** * wh_form_procure RowMapper * * @author genrator */ class WhFormProcureRowMapper implements RowMapper { @Override public WhFormProcure mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); WhFormProcure wh_form_procure = new WhFormProcure(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.Id); if (columnIndex > 0) { wh_form_procure.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.BusinessFormCode); if (columnIndex > 0) { wh_form_procure.setBusinessFormCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setWarehouseId(null); } else { wh_form_procure.setWarehouseId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.WarehouseName); if (columnIndex > 0) { wh_form_procure.setWarehouseName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.OperatorId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setOperatorId(null); } else { wh_form_procure.setOperatorId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.OperatorName); if (columnIndex > 0) { wh_form_procure.setOperatorName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.ProcureTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setProcureTime(null); } else { wh_form_procure.setProcureTime(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.ProcureDoc); if (columnIndex > 0) { wh_form_procure.setProcureDoc(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.States); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setStates(null); } else { wh_form_procure.setStates(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.AgencyId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setAgencyId(null); } else { wh_form_procure.setAgencyId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.AgencyName); if (columnIndex > 0) { wh_form_procure.setAgencyName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.OperatorId2); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setOperatorId2(null); } else { wh_form_procure.setOperatorId2(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.OperatorName2); if (columnIndex > 0) { wh_form_procure.setOperatorName2(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.IncomeTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_procure.setIncomeTime(null); } else { wh_form_procure.setIncomeTime(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormProcure_mapper.Beiz); if (columnIndex > 0) { wh_form_procure.setBeiz(rs.getString(columnIndex)); } return wh_form_procure; } }