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_GOODS_DETAILS * * @author genrator */ public class WhGoodsDetails_mapper extends WhGoodsDetails implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new WhGoodsDetailsRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String BusinessFormId = "business_form_id"; public static final String BusinessFormCode = "business_form_code"; public static final String BusinessFormName = "business_form_name"; public static final String InitialCount = "initial_count"; public static final String ThisType = "this_type"; public static final String ThisCount = "this_count"; public static final String EndCount = "end_count"; public static final String WarehouseId = "warehouse_id"; public static final String WarehouseName = "warehouse_name"; public static final String Classification = "classification"; public static final String OperatorId = "operator_id"; public static final String OperatorName = "operator_name"; public static final String DealTime = "deal_time"; public static final String WhGoodsId = "wh_goods_id"; /** * 默认构造函数 */ public WhGoodsDetails_mapper(WhGoodsDetails whGoodsDetails) { if (whGoodsDetails == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (whGoodsDetails.isset_id) { this.setId(whGoodsDetails.getId()); } //普通属性 if (whGoodsDetails.isset_businessFormId) { this.setBusinessFormId(whGoodsDetails.getBusinessFormId()); } if (whGoodsDetails.isset_businessFormCode) { this.setBusinessFormCode(whGoodsDetails.getBusinessFormCode()); } if (whGoodsDetails.isset_businessFormName) { this.setBusinessFormName(whGoodsDetails.getBusinessFormName()); } if (whGoodsDetails.isset_initialCount) { this.setInitialCount(whGoodsDetails.getInitialCount()); } if (whGoodsDetails.isset_thisType) { this.setThisType(whGoodsDetails.getThisType()); } if (whGoodsDetails.isset_thisCount) { this.setThisCount(whGoodsDetails.getThisCount()); } if (whGoodsDetails.isset_endCount) { this.setEndCount(whGoodsDetails.getEndCount()); } if (whGoodsDetails.isset_warehouseId) { this.setWarehouseId(whGoodsDetails.getWarehouseId()); } if (whGoodsDetails.isset_warehouseName) { this.setWarehouseName(whGoodsDetails.getWarehouseName()); } if (whGoodsDetails.isset_classification) { this.setClassification(whGoodsDetails.getClassification()); } if (whGoodsDetails.isset_operatorId) { this.setOperatorId(whGoodsDetails.getOperatorId()); } if (whGoodsDetails.isset_operatorName) { this.setOperatorName(whGoodsDetails.getOperatorName()); } if (whGoodsDetails.isset_dealTime) { this.setDealTime(whGoodsDetails.getDealTime()); } if (whGoodsDetails.isset_whGoodsId) { this.setWhGoodsId(whGoodsDetails.getWhGoodsId()); } // 去掉,2022-09-07 // this.setDatabaseName_(wh_goods_details.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "wh_goods_details"; /** 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(BusinessFormId, this.getBusinessFormId(), this.isset_businessFormId); ib.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ib.set(BusinessFormName, this.getBusinessFormName(), this.isset_businessFormName); ib.set(InitialCount, this.getInitialCount(), this.isset_initialCount); ib.set(ThisType, this.getThisType(), this.isset_thisType); ib.set(ThisCount, this.getThisCount(), this.isset_thisCount); ib.set(EndCount, this.getEndCount(), this.isset_endCount); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ib.set(Classification, this.getClassification(), this.isset_classification); ib.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ib.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ib.set(DealTime, this.getDealTime(), this.isset_dealTime); ib.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BusinessFormId, this.getBusinessFormId(), this.isset_businessFormId); ub.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(BusinessFormName, this.getBusinessFormName(), this.isset_businessFormName); ub.set(InitialCount, this.getInitialCount(), this.isset_initialCount); ub.set(ThisType, this.getThisType(), this.isset_thisType); ub.set(ThisCount, this.getThisCount(), this.isset_thisCount); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Classification, this.getClassification(), this.isset_classification); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); 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(BusinessFormId, this.getBusinessFormId(), this.isset_businessFormId); ub.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(BusinessFormName, this.getBusinessFormName(), this.isset_businessFormName); ub.set(InitialCount, this.getInitialCount(), this.isset_initialCount); ub.set(ThisType, this.getThisType(), this.isset_thisType); ub.set(ThisCount, this.getThisCount(), this.isset_thisCount); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Classification, this.getClassification(), this.isset_classification); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BusinessFormId, this.getBusinessFormId(), this.isset_businessFormId); ub.set(BusinessFormCode, this.getBusinessFormCode(), this.isset_businessFormCode); ub.set(BusinessFormName, this.getBusinessFormName(), this.isset_businessFormName); ub.set(InitialCount, this.getInitialCount(), this.isset_initialCount); ub.set(ThisType, this.getThisType(), this.isset_thisType); ub.set(ThisCount, this.getThisCount(), this.isset_thisCount); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Classification, this.getClassification(), this.isset_classification); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); 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_id, business_form_code, business_form_name, initial_count, this_type, this_count, end_count, warehouse_id, warehouse_name, classification, operator_id, operator_name, deal_time, wh_goods_id from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, business_form_id, business_form_code, business_form_name, initial_count, this_type, this_count, end_count, warehouse_id, warehouse_name, classification, operator_id, operator_name, deal_time, wh_goods_id from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public WhGoodsDetails mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public WhGoodsDetails toWhGoodsDetails() { return super.$clone(); } } /** * wh_goods_details RowMapper * * @author genrator */ class WhGoodsDetailsRowMapper implements RowMapper { @Override public WhGoodsDetails mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); WhGoodsDetails wh_goods_details = new WhGoodsDetails(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.Id); if (columnIndex > 0) { wh_goods_details.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.BusinessFormId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setBusinessFormId(null); } else { wh_goods_details.setBusinessFormId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.BusinessFormCode); if (columnIndex > 0) { wh_goods_details.setBusinessFormCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.BusinessFormName); if (columnIndex > 0) { wh_goods_details.setBusinessFormName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.InitialCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setInitialCount(null); } else { wh_goods_details.setInitialCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.ThisType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setThisType(null); } else { wh_goods_details.setThisType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.ThisCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setThisCount(null); } else { wh_goods_details.setThisCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.EndCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setEndCount(null); } else { wh_goods_details.setEndCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setWarehouseId(null); } else { wh_goods_details.setWarehouseId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.WarehouseName); if (columnIndex > 0) { wh_goods_details.setWarehouseName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.Classification); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setClassification(null); } else { wh_goods_details.setClassification(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.OperatorId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setOperatorId(null); } else { wh_goods_details.setOperatorId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.OperatorName); if (columnIndex > 0) { wh_goods_details.setOperatorName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.DealTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setDealTime(null); } else { wh_goods_details.setDealTime(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoodsDetails_mapper.WhGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods_details.setWhGoodsId(null); } else { wh_goods_details.setWhGoodsId(rs.getLong(columnIndex)); } } return wh_goods_details; } }