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; /** * 表名:DEP_FORM_LENDING_GOODS * * @author genrator */ public class DepFormLendingGoods_mapper extends DepFormLendingGoods implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new DepFormLendingGoodsRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String Classification = "classification"; public static final String BaseGoodsTemplateId = "base_goods_template_id"; public static final String BaseGoodsTemplateName = "base_goods_template_name"; public static final String DepFormLendingId = "dep_form_lending_id"; public static final String Unit = "unit"; public static final String BaseGoodsModelsId = "base_goods_models_id"; public static final String BaseGoodsModelsName = "base_goods_models_name"; public static final String Counts = "counts"; public static final String GoodsUserPhone = "goods_user_phone"; public static final String GoodsUserName = "goods_user_name"; public static final String UsingCount = "using_count"; public static final String WarehouseId = "warehouse_id"; public static final String WarehouseName = "warehouse_name"; /** * 默认构造函数 */ public DepFormLendingGoods_mapper(DepFormLendingGoods depFormLendingGoods) { if (depFormLendingGoods == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (depFormLendingGoods.isset_id) { this.setId(depFormLendingGoods.getId()); } //普通属性 if (depFormLendingGoods.isset_classification) { this.setClassification(depFormLendingGoods.getClassification()); } if (depFormLendingGoods.isset_baseGoodsTemplateId) { this.setBaseGoodsTemplateId(depFormLendingGoods.getBaseGoodsTemplateId()); } if (depFormLendingGoods.isset_baseGoodsTemplateName) { this.setBaseGoodsTemplateName(depFormLendingGoods.getBaseGoodsTemplateName()); } if (depFormLendingGoods.isset_depFormLendingId) { this.setDepFormLendingId(depFormLendingGoods.getDepFormLendingId()); } if (depFormLendingGoods.isset_unit) { this.setUnit(depFormLendingGoods.getUnit()); } if (depFormLendingGoods.isset_baseGoodsModelsId) { this.setBaseGoodsModelsId(depFormLendingGoods.getBaseGoodsModelsId()); } if (depFormLendingGoods.isset_baseGoodsModelsName) { this.setBaseGoodsModelsName(depFormLendingGoods.getBaseGoodsModelsName()); } if (depFormLendingGoods.isset_counts) { this.setCounts(depFormLendingGoods.getCounts()); } if (depFormLendingGoods.isset_goodsUserPhone) { this.setGoodsUserPhone(depFormLendingGoods.getGoodsUserPhone()); } if (depFormLendingGoods.isset_goodsUserName) { this.setGoodsUserName(depFormLendingGoods.getGoodsUserName()); } if (depFormLendingGoods.isset_usingCount) { this.setUsingCount(depFormLendingGoods.getUsingCount()); } if (depFormLendingGoods.isset_warehouseId) { this.setWarehouseId(depFormLendingGoods.getWarehouseId()); } if (depFormLendingGoods.isset_warehouseName) { this.setWarehouseName(depFormLendingGoods.getWarehouseName()); } // 去掉,2022-09-07 // this.setDatabaseName_(dep_form_lending_goods.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "dep_form_lending_goods"; /** 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(Classification, this.getClassification(), this.isset_classification); ib.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ib.set(BaseGoodsTemplateName, this.getBaseGoodsTemplateName(), this.isset_baseGoodsTemplateName); ib.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ib.set(Unit, this.getUnit(), this.isset_unit); ib.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ib.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ib.set(Counts, this.getCounts(), this.isset_counts); ib.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ib.set(GoodsUserName, this.getGoodsUserName(), this.isset_goodsUserName); ib.set(UsingCount, this.getUsingCount(), this.isset_usingCount); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(Classification, this.getClassification(), this.isset_classification); ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(BaseGoodsTemplateName, this.getBaseGoodsTemplateName(), this.isset_baseGoodsTemplateName); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(GoodsUserName, this.getGoodsUserName(), this.isset_goodsUserName); ub.set(UsingCount, this.getUsingCount(), this.isset_usingCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); 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(Classification, this.getClassification(), this.isset_classification); ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(BaseGoodsTemplateName, this.getBaseGoodsTemplateName(), this.isset_baseGoodsTemplateName); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(GoodsUserName, this.getGoodsUserName(), this.isset_goodsUserName); ub.set(UsingCount, this.getUsingCount(), this.isset_usingCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(Classification, this.getClassification(), this.isset_classification); ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(BaseGoodsTemplateName, this.getBaseGoodsTemplateName(), this.isset_baseGoodsTemplateName); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(GoodsUserName, this.getGoodsUserName(), this.isset_goodsUserName); ub.set(UsingCount, this.getUsingCount(), this.isset_usingCount); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); 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, classification, base_goods_template_id, base_goods_template_name, dep_form_lending_id, unit, base_goods_models_id, base_goods_models_name, counts, goods_user_phone, goods_user_name, using_count, warehouse_id, warehouse_name from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, classification, base_goods_template_id, base_goods_template_name, dep_form_lending_id, unit, base_goods_models_id, base_goods_models_name, counts, goods_user_phone, goods_user_name, using_count, warehouse_id, warehouse_name from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public DepFormLendingGoods mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public DepFormLendingGoods toDepFormLendingGoods() { return super.$clone(); } } /** * dep_form_lending_goods RowMapper * * @author genrator */ class DepFormLendingGoodsRowMapper implements RowMapper { @Override public DepFormLendingGoods mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); DepFormLendingGoods dep_form_lending_goods = new DepFormLendingGoods(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.Id); if (columnIndex > 0) { dep_form_lending_goods.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.Classification); if (columnIndex > 0) { dep_form_lending_goods.setClassification(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.BaseGoodsTemplateId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setBaseGoodsTemplateId(null); } else { dep_form_lending_goods.setBaseGoodsTemplateId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.BaseGoodsTemplateName); if (columnIndex > 0) { dep_form_lending_goods.setBaseGoodsTemplateName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.DepFormLendingId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setDepFormLendingId(null); } else { dep_form_lending_goods.setDepFormLendingId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.Unit); if (columnIndex > 0) { dep_form_lending_goods.setUnit(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.BaseGoodsModelsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setBaseGoodsModelsId(null); } else { dep_form_lending_goods.setBaseGoodsModelsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.BaseGoodsModelsName); if (columnIndex > 0) { dep_form_lending_goods.setBaseGoodsModelsName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.Counts); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setCounts(null); } else { dep_form_lending_goods.setCounts(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.GoodsUserPhone); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setGoodsUserPhone(null); } else { dep_form_lending_goods.setGoodsUserPhone(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.GoodsUserName); if (columnIndex > 0) { dep_form_lending_goods.setGoodsUserName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.UsingCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setUsingCount(null); } else { dep_form_lending_goods.setUsingCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_lending_goods.setWarehouseId(null); } else { dep_form_lending_goods.setWarehouseId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormLendingGoods_mapper.WarehouseName); if (columnIndex > 0) { dep_form_lending_goods.setWarehouseName(rs.getString(columnIndex)); } return dep_form_lending_goods; } }