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; /** * 表名:L_GOODS_WH_RECORD * * @author genrator */ public class LGoodsWhRecord_mapper extends LGoodsWhRecord implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new LGoodsWhRecordRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String WarehouseFlowId = "warehouse_flow_id"; public static final String WhGoodsId = "wh_goods_id"; public static final String WarehouseType = "warehouse_type"; public static final String WarehouseId = "warehouse_id"; public static final String DealTime = "deal_time"; /** * 默认构造函数 */ public LGoodsWhRecord_mapper(LGoodsWhRecord lGoodsWhRecord) { if (lGoodsWhRecord == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (lGoodsWhRecord.isset_id) { this.setId(lGoodsWhRecord.getId()); } //普通属性 if (lGoodsWhRecord.isset_warehouseFlowId) { this.setWarehouseFlowId(lGoodsWhRecord.getWarehouseFlowId()); } if (lGoodsWhRecord.isset_whGoodsId) { this.setWhGoodsId(lGoodsWhRecord.getWhGoodsId()); } if (lGoodsWhRecord.isset_warehouseType) { this.setWarehouseType(lGoodsWhRecord.getWarehouseType()); } if (lGoodsWhRecord.isset_warehouseId) { this.setWarehouseId(lGoodsWhRecord.getWarehouseId()); } if (lGoodsWhRecord.isset_dealTime) { this.setDealTime(lGoodsWhRecord.getDealTime()); } // 去掉,2022-09-07 // this.setDatabaseName_(l_goods_wh_record.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "l_goods_wh_record"; /** 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(WarehouseFlowId, this.getWarehouseFlowId(), this.isset_warehouseFlowId); ib.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ib.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ib.set(DealTime, this.getDealTime(), this.isset_dealTime); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(WarehouseFlowId, this.getWarehouseFlowId(), this.isset_warehouseFlowId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); 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(WarehouseFlowId, this.getWarehouseFlowId(), this.isset_warehouseFlowId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(WarehouseFlowId, this.getWarehouseFlowId(), this.isset_warehouseFlowId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); 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, warehouse_flow_id, wh_goods_id, warehouse_type, warehouse_id, deal_time from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, warehouse_flow_id, wh_goods_id, warehouse_type, warehouse_id, deal_time from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public LGoodsWhRecord mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public LGoodsWhRecord toLGoodsWhRecord() { return super.$clone(); } } /** * l_goods_wh_record RowMapper * * @author genrator */ class LGoodsWhRecordRowMapper implements RowMapper { @Override public LGoodsWhRecord mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); LGoodsWhRecord l_goods_wh_record = new LGoodsWhRecord(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.Id); if (columnIndex > 0) { l_goods_wh_record.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.WarehouseFlowId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_wh_record.setWarehouseFlowId(null); } else { l_goods_wh_record.setWarehouseFlowId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.WhGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_wh_record.setWhGoodsId(null); } else { l_goods_wh_record.setWhGoodsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.WarehouseType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_wh_record.setWarehouseType(null); } else { l_goods_wh_record.setWarehouseType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.WarehouseId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_wh_record.setWarehouseId(null); } else { l_goods_wh_record.setWarehouseId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsWhRecord_mapper.DealTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_wh_record.setDealTime(null); } else { l_goods_wh_record.setDealTime(rs.getLong(columnIndex)); } } return l_goods_wh_record; } }