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 org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; /** * 表名:L_WH_PROCURE_MODEL * * @author genrator */ public class LWhProcureModel_mapper extends LWhProcureModel implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new LWhProcureModelRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String FromProcureGoodsId = "from_procure_goods_id"; public static final String BusinessType = "business_type"; public static final String BusinessId = "business_id"; public static final String BaseGoodsModelsId = "base_goods_models_id"; public static final String BaseGoodsModelsName = "base_goods_models_name"; public static final String Unit = "unit"; public static final String Price = "price"; public static final String Counts = "counts"; public static final String WorehouseCount = "worehouse_count"; public static final String Supplier = "supplier"; /** * 默认构造函数 */ public LWhProcureModel_mapper(LWhProcureModel lWhProcureModel) { if (lWhProcureModel == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (lWhProcureModel.isset_id) { this.setId(lWhProcureModel.getId()); } //普通属性 if (lWhProcureModel.isset_fromProcureGoodsId) { this.setFromProcureGoodsId(lWhProcureModel.getFromProcureGoodsId()); } if (lWhProcureModel.isset_businessType) { this.setBusinessType(lWhProcureModel.getBusinessType()); } if (lWhProcureModel.isset_businessId) { this.setBusinessId(lWhProcureModel.getBusinessId()); } if (lWhProcureModel.isset_baseGoodsModelsId) { this.setBaseGoodsModelsId(lWhProcureModel.getBaseGoodsModelsId()); } if (lWhProcureModel.isset_baseGoodsModelsName) { this.setBaseGoodsModelsName(lWhProcureModel.getBaseGoodsModelsName()); } if (lWhProcureModel.isset_unit) { this.setUnit(lWhProcureModel.getUnit()); } if (lWhProcureModel.isset_price) { this.setPrice(lWhProcureModel.getPrice()); } if (lWhProcureModel.isset_counts) { this.setCounts(lWhProcureModel.getCounts()); } if (lWhProcureModel.isset_worehouseCount) { this.setWorehouseCount(lWhProcureModel.getWorehouseCount()); } if (lWhProcureModel.isset_supplier) { this.setSupplier(lWhProcureModel.getSupplier()); } // 去掉,2022-09-07 // this.setDatabaseName_(l_wh_procure_model.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "l_wh_procure_model"; /** 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(FromProcureGoodsId, this.getFromProcureGoodsId(), this.isset_fromProcureGoodsId); ib.set(BusinessType, this.getBusinessType(), this.isset_businessType); ib.set(BusinessId, this.getBusinessId(), this.isset_businessId); ib.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ib.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ib.set(Unit, this.getUnit(), this.isset_unit); ib.set(Price, this.getPrice(), this.isset_price); ib.set(Counts, this.getCounts(), this.isset_counts); ib.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); ib.set(Supplier, this.getSupplier(), this.isset_supplier); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(FromProcureGoodsId, this.getFromProcureGoodsId(), this.isset_fromProcureGoodsId); ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); ub.set(Supplier, this.getSupplier(), this.isset_supplier); 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(FromProcureGoodsId, this.getFromProcureGoodsId(), this.isset_fromProcureGoodsId); ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); ub.set(Supplier, this.getSupplier(), this.isset_supplier); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(FromProcureGoodsId, this.getFromProcureGoodsId(), this.isset_fromProcureGoodsId); ub.set(BusinessType, this.getBusinessType(), this.isset_businessType); ub.set(BusinessId, this.getBusinessId(), this.isset_businessId); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(WorehouseCount, this.getWorehouseCount(), this.isset_worehouseCount); ub.set(Supplier, this.getSupplier(), this.isset_supplier); 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, from_procure_goods_id, business_type, business_id, base_goods_models_id, base_goods_models_name, unit, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, from_procure_goods_id, business_type, business_id, base_goods_models_id, base_goods_models_name, unit, price, counts, worehouse_count, supplier from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public LWhProcureModel mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public LWhProcureModel toLWhProcureModel() { return super.$clone(); } } /** * l_wh_procure_model RowMapper * * @author genrator */ class LWhProcureModelRowMapper implements RowMapper { @Override public LWhProcureModel mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); LWhProcureModel l_wh_procure_model = new LWhProcureModel(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Id); if (columnIndex > 0) { l_wh_procure_model.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.FromProcureGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setFromProcureGoodsId(null); } else { l_wh_procure_model.setFromProcureGoodsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.BusinessType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setBusinessType(null); } else { l_wh_procure_model.setBusinessType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.BusinessId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setBusinessId(null); } else { l_wh_procure_model.setBusinessId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.BaseGoodsModelsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setBaseGoodsModelsId(null); } else { l_wh_procure_model.setBaseGoodsModelsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.BaseGoodsModelsName); if (columnIndex > 0) { l_wh_procure_model.setBaseGoodsModelsName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Unit); if (columnIndex > 0) { l_wh_procure_model.setUnit(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Price); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setPrice(null); } else { l_wh_procure_model.setPrice(rs.getDouble(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Counts); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setCounts(null); } else { l_wh_procure_model.setCounts(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.WorehouseCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_wh_procure_model.setWorehouseCount(null); } else { l_wh_procure_model.setWorehouseCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LWhProcureModel_mapper.Supplier); if (columnIndex > 0) { l_wh_procure_model.setSupplier(rs.getString(columnIndex)); } return l_wh_procure_model; } }