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_WH_GOODS *
|
* @author genrator
|
*/
|
public class LWhGoods_mapper extends LWhGoods implements BaseMapper<LWhGoods> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<LWhGoods> ROW_MAPPER = new LWhGoodsRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String WarehouseType = "warehouse_type";
|
public static final String WarehouseId = "warehouse_id";
|
public static final String WarehouseName = "warehouse_name";
|
public static final String CostType = "cost_type";
|
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 Supplier = "supplier";
|
public static final String BuyType = "buy_type";
|
public static final String Unit = "unit";
|
public static final String Price = "price";
|
public static final String ProcureDate = "procure_date";
|
public static final String States = "states";
|
|
/**
|
* 默认构造函数
|
*/
|
public LWhGoods_mapper(LWhGoods lWhGoods) {
|
if (lWhGoods == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (lWhGoods.isset_id) {
|
this.setId(lWhGoods.getId());
|
}
|
//普通属性
|
if (lWhGoods.isset_warehouseType) {
|
this.setWarehouseType(lWhGoods.getWarehouseType());
|
}
|
if (lWhGoods.isset_warehouseId) {
|
this.setWarehouseId(lWhGoods.getWarehouseId());
|
}
|
if (lWhGoods.isset_warehouseName) {
|
this.setWarehouseName(lWhGoods.getWarehouseName());
|
}
|
if (lWhGoods.isset_costType) {
|
this.setCostType(lWhGoods.getCostType());
|
}
|
if (lWhGoods.isset_baseGoodsTemplateId) {
|
this.setBaseGoodsTemplateId(lWhGoods.getBaseGoodsTemplateId());
|
}
|
if (lWhGoods.isset_goodsTemplateName) {
|
this.setGoodsTemplateName(lWhGoods.getGoodsTemplateName());
|
}
|
if (lWhGoods.isset_baseGoodsModelsId) {
|
this.setBaseGoodsModelsId(lWhGoods.getBaseGoodsModelsId());
|
}
|
if (lWhGoods.isset_baseGoodsModelsName) {
|
this.setBaseGoodsModelsName(lWhGoods.getBaseGoodsModelsName());
|
}
|
if (lWhGoods.isset_supplier) {
|
this.setSupplier(lWhGoods.getSupplier());
|
}
|
if (lWhGoods.isset_buyType) {
|
this.setBuyType(lWhGoods.getBuyType());
|
}
|
if (lWhGoods.isset_unit) {
|
this.setUnit(lWhGoods.getUnit());
|
}
|
if (lWhGoods.isset_price) {
|
this.setPrice(lWhGoods.getPrice());
|
}
|
if (lWhGoods.isset_procureDate) {
|
this.setProcureDate(lWhGoods.getProcureDate());
|
}
|
if (lWhGoods.isset_states) {
|
this.setStates(lWhGoods.getStates());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(l_wh_goods.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "l_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<Map<String, Object>> getInsertSql_() {
|
InsertBuilder ib = new InsertBuilder(this.getTableName_());
|
ib.set(Id, this.getId());
|
ib.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType);
|
ib.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId);
|
ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName);
|
ib.set(CostType, this.getCostType(), this.isset_costType);
|
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(Supplier, this.getSupplier(), this.isset_supplier);
|
ib.set(BuyType, this.getBuyType(), this.isset_buyType);
|
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(States, this.getStates(), this.isset_states);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType);
|
ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId);
|
ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName);
|
ub.set(CostType, this.getCostType(), this.isset_costType);
|
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(Supplier, this.getSupplier(), this.isset_supplier);
|
ub.set(BuyType, this.getBuyType(), this.isset_buyType);
|
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(States, this.getStates(), this.isset_states);
|
ub.where(this.getPkName_(), this.getPkValue_());
|
return ub.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType);
|
ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId);
|
ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName);
|
ub.set(CostType, this.getCostType(), this.isset_costType);
|
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(Supplier, this.getSupplier(), this.isset_supplier);
|
ub.set(BuyType, this.getBuyType(), this.isset_buyType);
|
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(States, this.getStates(), this.isset_states);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType);
|
ub.set(WarehouseId, this.getWarehouseId(), this.isset_warehouseId);
|
ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName);
|
ub.set(CostType, this.getCostType(), this.isset_costType);
|
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(Supplier, this.getSupplier(), this.isset_supplier);
|
ub.set(BuyType, this.getBuyType(), this.isset_buyType);
|
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(States, this.getStates(), this.isset_states);
|
return ub.genArraySql(where, parameters);
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getDeleteSql_() {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
db.where(this.getPkName_(), this.getPkValue_());
|
return db.genMapSql();
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
return db.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取删除语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) {
|
DeleteBuilder db = new DeleteBuilder(this.getTableName_());
|
return db.genArraySql(where, parameters);
|
}
|
|
/**
|
* 获取单行查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getSingleSql_() {
|
SelectBuilder sb = new SelectBuilder(this.getTableName_());
|
sb.where(this.getPkName_(), this.getPkValue_());
|
return sb.genMapSql();
|
}
|
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) {
|
return new SqlAndParameters<>("select id, warehouse_type, warehouse_id, warehouse_name, cost_type, base_goods_template_id, goods_template_name, base_goods_models_id, base_goods_models_name, supplier, buy_type, unit, price, procure_date, states from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, warehouse_type, warehouse_id, warehouse_name, cost_type, base_goods_template_id, goods_template_name, base_goods_models_id, base_goods_models_name, supplier, buy_type, unit, price, procure_date, states from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public LWhGoods mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public LWhGoods toLWhGoods() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* l_wh_goods RowMapper
|
*
|
* @author genrator
|
*/
|
class LWhGoodsRowMapper implements RowMapper<LWhGoods> {
|
|
@Override
|
public LWhGoods mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
LWhGoods l_wh_goods = new LWhGoods();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.Id);
|
if (columnIndex > 0) {
|
l_wh_goods.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.WarehouseType);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setWarehouseType(null);
|
} else {
|
l_wh_goods.setWarehouseType(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.WarehouseId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setWarehouseId(null);
|
} else {
|
l_wh_goods.setWarehouseId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.WarehouseName);
|
if (columnIndex > 0) {
|
l_wh_goods.setWarehouseName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.CostType);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setCostType(null);
|
} else {
|
l_wh_goods.setCostType(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.BaseGoodsTemplateId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setBaseGoodsTemplateId(null);
|
} else {
|
l_wh_goods.setBaseGoodsTemplateId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.GoodsTemplateName);
|
if (columnIndex > 0) {
|
l_wh_goods.setGoodsTemplateName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.BaseGoodsModelsId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setBaseGoodsModelsId(null);
|
} else {
|
l_wh_goods.setBaseGoodsModelsId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.BaseGoodsModelsName);
|
if (columnIndex > 0) {
|
l_wh_goods.setBaseGoodsModelsName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.Supplier);
|
if (columnIndex > 0) {
|
l_wh_goods.setSupplier(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.BuyType);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setBuyType(null);
|
} else {
|
l_wh_goods.setBuyType(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.Unit);
|
if (columnIndex > 0) {
|
l_wh_goods.setUnit(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.Price);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setPrice(null);
|
} else {
|
l_wh_goods.setPrice(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.ProcureDate);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setProcureDate(null);
|
} else {
|
l_wh_goods.setProcureDate(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, LWhGoods_mapper.States);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
l_wh_goods.setStates(null);
|
} else {
|
l_wh_goods.setStates(rs.getInt(columnIndex));
|
}
|
}
|
return l_wh_goods;
|
}
|
}
|