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 * * @author genrator */ public class WhGoods_mapper extends WhGoods implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new WhGoodsRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String BaseGoodsTemplateId = "base_goods_template_id"; public static final String GoodsTemplateName = "goods_template_name"; public static final String BaseGoodsModelsId = "base_goods_models_id"; public static final String BaseGoodsModelsName = "base_goods_models_name"; public static final String WhCount = "wh_count"; public static final String FirstInputCode = "first_input_code"; public static final String FirstInputType = "first_input_type"; public static final String FirstInputHisId = "first_input_his_id"; public static final String WarehouseId = "warehouse_id"; public static final String WarehouseName = "warehouse_name"; public static final String Supplier = "supplier"; public static final String Unit = "unit"; public static final String Price = "price"; public static final String ProcureDate = "procure_date"; public static final String BackDate = "back_date"; public static final String States = "states"; /** * 默认构造函数 */ public WhGoods_mapper(WhGoods whGoods) { if (whGoods == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (whGoods.isset_id) { this.setId(whGoods.getId()); } //普通属性 if (whGoods.isset_baseGoodsTemplateId) { this.setBaseGoodsTemplateId(whGoods.getBaseGoodsTemplateId()); } if (whGoods.isset_goodsTemplateName) { this.setGoodsTemplateName(whGoods.getGoodsTemplateName()); } if (whGoods.isset_baseGoodsModelsId) { this.setBaseGoodsModelsId(whGoods.getBaseGoodsModelsId()); } if (whGoods.isset_baseGoodsModelsName) { this.setBaseGoodsModelsName(whGoods.getBaseGoodsModelsName()); } if (whGoods.isset_whCount) { this.setWhCount(whGoods.getWhCount()); } if (whGoods.isset_firstInputCode) { this.setFirstInputCode(whGoods.getFirstInputCode()); } if (whGoods.isset_firstInputType) { this.setFirstInputType(whGoods.getFirstInputType()); } if (whGoods.isset_firstInputHisId) { this.setFirstInputHisId(whGoods.getFirstInputHisId()); } if (whGoods.isset_warehouseId) { this.setWarehouseId(whGoods.getWarehouseId()); } if (whGoods.isset_warehouseName) { this.setWarehouseName(whGoods.getWarehouseName()); } if (whGoods.isset_supplier) { this.setSupplier(whGoods.getSupplier()); } if (whGoods.isset_unit) { this.setUnit(whGoods.getUnit()); } if (whGoods.isset_price) { this.setPrice(whGoods.getPrice()); } if (whGoods.isset_procureDate) { this.setProcureDate(whGoods.getProcureDate()); } if (whGoods.isset_backDate) { this.setBackDate(whGoods.getBackDate()); } if (whGoods.isset_states) { this.setStates(whGoods.getStates()); } // 去掉,2022-09-07 // this.setDatabaseName_(wh_goods.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "wh_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(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ib.set(GoodsTemplateName, this.getGoodsTemplateName(), this.isset_goodsTemplateName); ib.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ib.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ib.set(WhCount, this.getWhCount(), this.isset_whCount); ib.set(FirstInputCode, this.getFirstInputCode(), this.isset_firstInputCode); ib.set(FirstInputType, this.getFirstInputType(), this.isset_firstInputType); ib.set(FirstInputHisId, this.getFirstInputHisId(), this.isset_firstInputHisId); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ib.set(Supplier, this.getSupplier(), this.isset_supplier); ib.set(Unit, this.getUnit(), this.isset_unit); ib.set(Price, this.getPrice(), this.isset_price); ib.set(ProcureDate, this.getProcureDate(), this.isset_procureDate); ib.set(BackDate, this.getBackDate(), this.isset_backDate); ib.set(States, this.getStates(), this.isset_states); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(GoodsTemplateName, this.getGoodsTemplateName(), this.isset_goodsTemplateName); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(WhCount, this.getWhCount(), this.isset_whCount); ub.set(FirstInputCode, this.getFirstInputCode(), this.isset_firstInputCode); ub.set(FirstInputType, this.getFirstInputType(), this.isset_firstInputType); ub.set(FirstInputHisId, this.getFirstInputHisId(), this.isset_firstInputHisId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Supplier, this.getSupplier(), this.isset_supplier); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(ProcureDate, this.getProcureDate(), this.isset_procureDate); ub.set(BackDate, this.getBackDate(), this.isset_backDate); ub.set(States, this.getStates(), this.isset_states); 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(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(GoodsTemplateName, this.getGoodsTemplateName(), this.isset_goodsTemplateName); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(WhCount, this.getWhCount(), this.isset_whCount); ub.set(FirstInputCode, this.getFirstInputCode(), this.isset_firstInputCode); ub.set(FirstInputType, this.getFirstInputType(), this.isset_firstInputType); ub.set(FirstInputHisId, this.getFirstInputHisId(), this.isset_firstInputHisId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Supplier, this.getSupplier(), this.isset_supplier); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(ProcureDate, this.getProcureDate(), this.isset_procureDate); ub.set(BackDate, this.getBackDate(), this.isset_backDate); ub.set(States, this.getStates(), this.isset_states); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId); ub.set(GoodsTemplateName, this.getGoodsTemplateName(), this.isset_goodsTemplateName); ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId); ub.set(BaseGoodsModelsName, this.getBaseGoodsModelsName(), this.isset_baseGoodsModelsName); ub.set(WhCount, this.getWhCount(), this.isset_whCount); ub.set(FirstInputCode, this.getFirstInputCode(), this.isset_firstInputCode); ub.set(FirstInputType, this.getFirstInputType(), this.isset_firstInputType); ub.set(FirstInputHisId, this.getFirstInputHisId(), this.isset_firstInputHisId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Supplier, this.getSupplier(), this.isset_supplier); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(Price, this.getPrice(), this.isset_price); ub.set(ProcureDate, this.getProcureDate(), this.isset_procureDate); ub.set(BackDate, this.getBackDate(), this.isset_backDate); ub.set(States, this.getStates(), this.isset_states); 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, base_goods_template_id, goods_template_name, base_goods_models_id, base_goods_models_name, wh_count, first_input_code, first_input_type, first_input_his_id, warehouse_id, warehouse_name, supplier, unit, price, procure_date, back_date, states from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, base_goods_template_id, goods_template_name, base_goods_models_id, base_goods_models_name, wh_count, first_input_code, first_input_type, first_input_his_id, warehouse_id, warehouse_name, supplier, unit, price, procure_date, back_date, states from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public WhGoods mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public WhGoods toWhGoods() { return super.$clone(); } } /** * wh_goods RowMapper * * @author genrator */ class WhGoodsRowMapper implements RowMapper { @Override public WhGoods mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); WhGoods wh_goods = new WhGoods(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.Id); if (columnIndex > 0) { wh_goods.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.BaseGoodsTemplateId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setBaseGoodsTemplateId(null); } else { wh_goods.setBaseGoodsTemplateId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.GoodsTemplateName); if (columnIndex > 0) { wh_goods.setGoodsTemplateName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.BaseGoodsModelsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setBaseGoodsModelsId(null); } else { wh_goods.setBaseGoodsModelsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.BaseGoodsModelsName); if (columnIndex > 0) { wh_goods.setBaseGoodsModelsName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.WhCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setWhCount(null); } else { wh_goods.setWhCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.FirstInputCode); if (columnIndex > 0) { wh_goods.setFirstInputCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.FirstInputType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setFirstInputType(null); } else { wh_goods.setFirstInputType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.FirstInputHisId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setFirstInputHisId(null); } else { wh_goods.setFirstInputHisId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setWarehouseId(null); } else { wh_goods.setWarehouseId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.WarehouseName); if (columnIndex > 0) { wh_goods.setWarehouseName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.Supplier); if (columnIndex > 0) { wh_goods.setSupplier(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.Unit); if (columnIndex > 0) { wh_goods.setUnit(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.Price); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setPrice(null); } else { wh_goods.setPrice(rs.getDouble(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.ProcureDate); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setProcureDate(null); } else { wh_goods.setProcureDate(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.BackDate); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setBackDate(null); } else { wh_goods.setBackDate(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhGoods_mapper.States); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_goods.setStates(null); } else { wh_goods.setStates(rs.getInt(columnIndex)); } } return wh_goods; } }