package com.consum.model.po; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; import org.springframework.jdbc.core.RowMapper; 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; /** * 表名:DEP_FORM_BACK_GOODS * * * @author genrator */ public class DepFormBackGoods_mapper extends DepFormBackGoods implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new DepFormBackGoodsRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String DepFormBackId = "dep_form_back_id"; public static final String Unit = "unit"; public static final String BackCounts = "back_counts"; public static final String InitCount = "init_count"; public static final String DepFormLendingGoodsId = "dep_form_lending_goods_id"; public static final String EndCount = "end_count"; public static final String DepFormLendingId = "dep_form_lending_id"; public static final String WarehouseId = "warehouse_id"; /** * 默认构造函数 */ public DepFormBackGoods_mapper(DepFormBackGoods depFormBackGoods) { if (depFormBackGoods == null) { throw new IllegalArgumentException("po参数不允许为空!"); } // 主键 if (depFormBackGoods.isset_id) { this.setId(depFormBackGoods.getId()); } // 普通属性 if (depFormBackGoods.isset_depFormBackId) { this.setDepFormBackId(depFormBackGoods.getDepFormBackId()); } if (depFormBackGoods.isset_unit) { this.setUnit(depFormBackGoods.getUnit()); } if (depFormBackGoods.isset_backCounts) { this.setBackCounts(depFormBackGoods.getBackCounts()); } if (depFormBackGoods.isset_initCount) { this.setInitCount(depFormBackGoods.getInitCount()); } if (depFormBackGoods.isset_depFormLendingGoodsId) { this.setDepFormLendingGoodsId(depFormBackGoods.getDepFormLendingGoodsId()); } if (depFormBackGoods.isset_endCount) { this.setEndCount(depFormBackGoods.getEndCount()); } if (depFormBackGoods.isset_depFormLendingId) { this.setDepFormLendingId(depFormBackGoods.getDepFormLendingId()); } if (depFormBackGoods.isset_warehouseId) { this.setWarehouseId(depFormBackGoods.getWarehouseId()); } // 去掉,2022-09-07 // this.setDatabaseName_(dep_form_back_goods.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "dep_form_back_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(DepFormBackId, this.getDepFormBackId(), this.isset_depFormBackId); ib.set(Unit, this.getUnit(), this.isset_unit); ib.set(BackCounts, this.getBackCounts(), this.isset_backCounts); ib.set(InitCount, this.getInitCount(), this.isset_initCount); ib.set(DepFormLendingGoodsId, this.getDepFormLendingGoodsId(), this.isset_depFormLendingGoodsId); ib.set(EndCount, this.getEndCount(), this.isset_endCount); ib.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(DepFormBackId, this.getDepFormBackId(), this.isset_depFormBackId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BackCounts, this.getBackCounts(), this.isset_backCounts); ub.set(InitCount, this.getInitCount(), this.isset_initCount); ub.set(DepFormLendingGoodsId, this.getDepFormLendingGoodsId(), this.isset_depFormLendingGoodsId); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); 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(DepFormBackId, this.getDepFormBackId(), this.isset_depFormBackId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BackCounts, this.getBackCounts(), this.isset_backCounts); ub.set(InitCount, this.getInitCount(), this.isset_initCount); ub.set(DepFormLendingGoodsId, this.getDepFormLendingGoodsId(), this.isset_depFormLendingGoodsId); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(DepFormBackId, this.getDepFormBackId(), this.isset_depFormBackId); ub.set(Unit, this.getUnit(), this.isset_unit); ub.set(BackCounts, this.getBackCounts(), this.isset_backCounts); ub.set(InitCount, this.getInitCount(), this.isset_initCount); ub.set(DepFormLendingGoodsId, this.getDepFormLendingGoodsId(), this.isset_depFormLendingGoodsId); ub.set(EndCount, this.getEndCount(), this.isset_endCount); ub.set(DepFormLendingId, this.getDepFormLendingId(), this.isset_depFormLendingId); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); 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, dep_form_back_id, unit, back_counts, init_count, dep_form_lending_goods_id, end_count, dep_form_lending_id, warehouse_id from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>( "select id, dep_form_back_id, unit, back_counts, init_count, dep_form_lending_goods_id, end_count, dep_form_lending_id, warehouse_id from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public DepFormBackGoods mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public DepFormBackGoods toDepFormBackGoods() { return super.$clone(); } } /** * dep_form_back_goods RowMapper * * @author genrator */ class DepFormBackGoodsRowMapper implements RowMapper { @Override public DepFormBackGoods mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); DepFormBackGoods dep_form_back_goods = new DepFormBackGoods(); Integer columnIndex; // 主键 columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.Id); if (columnIndex > 0) { dep_form_back_goods.setId(rs.getLong(columnIndex)); } // 普通属性 columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.DepFormBackId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setDepFormBackId(null); } else { dep_form_back_goods.setDepFormBackId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.Unit); if (columnIndex > 0) { dep_form_back_goods.setUnit(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.BackCounts); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setBackCounts(null); } else { dep_form_back_goods.setBackCounts(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.InitCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setInitCount(null); } else { dep_form_back_goods.setInitCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.DepFormLendingGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setDepFormLendingGoodsId(null); } else { dep_form_back_goods.setDepFormLendingGoodsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.EndCount); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setEndCount(null); } else { dep_form_back_goods.setEndCount(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.DepFormLendingId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setDepFormLendingId(null); } else { dep_form_back_goods.setDepFormLendingId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, DepFormBackGoods_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { dep_form_back_goods.setWarehouseId(null); } else { dep_form_back_goods.setWarehouseId(rs.getLong(columnIndex)); } } return dep_form_back_goods; } }