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_WARNING_CONFIG *
|
* @author genrator
|
*/
|
public class WhWarningConfig_mapper extends WhWarningConfig implements BaseMapper<WhWarningConfig> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<WhWarningConfig> ROW_MAPPER = new WhWarningConfigRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String BaseWarehouseId = "base_warehouse_id";
|
public static final String BaseGoodsTemplateId = "base_goods_template_id";
|
public static final String BaseGoodsModelsId = "base_goods_models_id";
|
public static final String GoodsType = "goods_type";
|
public static final String UpperLimit = "upper_limit";
|
public static final String LowerLimit = "lower_limit";
|
|
/**
|
* 默认构造函数
|
*/
|
public WhWarningConfig_mapper(WhWarningConfig whWarningConfig) {
|
if (whWarningConfig == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (whWarningConfig.isset_id) {
|
this.setId(whWarningConfig.getId());
|
}
|
//普通属性
|
if (whWarningConfig.isset_baseWarehouseId) {
|
this.setBaseWarehouseId(whWarningConfig.getBaseWarehouseId());
|
}
|
if (whWarningConfig.isset_baseGoodsTemplateId) {
|
this.setBaseGoodsTemplateId(whWarningConfig.getBaseGoodsTemplateId());
|
}
|
if (whWarningConfig.isset_baseGoodsModelsId) {
|
this.setBaseGoodsModelsId(whWarningConfig.getBaseGoodsModelsId());
|
}
|
if (whWarningConfig.isset_goodsType) {
|
this.setGoodsType(whWarningConfig.getGoodsType());
|
}
|
if (whWarningConfig.isset_upperLimit) {
|
this.setUpperLimit(whWarningConfig.getUpperLimit());
|
}
|
if (whWarningConfig.isset_lowerLimit) {
|
this.setLowerLimit(whWarningConfig.getLowerLimit());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(wh_warning_config.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "wh_warning_config";
|
/**
|
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(BaseWarehouseId, this.getBaseWarehouseId(), this.isset_baseWarehouseId);
|
ib.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId);
|
ib.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId);
|
ib.set(GoodsType, this.getGoodsType(), this.isset_goodsType);
|
ib.set(UpperLimit, this.getUpperLimit(), this.isset_upperLimit);
|
ib.set(LowerLimit, this.getLowerLimit(), this.isset_lowerLimit);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(BaseWarehouseId, this.getBaseWarehouseId(), this.isset_baseWarehouseId);
|
ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId);
|
ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId);
|
ub.set(GoodsType, this.getGoodsType(), this.isset_goodsType);
|
ub.set(UpperLimit, this.getUpperLimit(), this.isset_upperLimit);
|
ub.set(LowerLimit, this.getLowerLimit(), this.isset_lowerLimit);
|
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(BaseWarehouseId, this.getBaseWarehouseId(), this.isset_baseWarehouseId);
|
ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId);
|
ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId);
|
ub.set(GoodsType, this.getGoodsType(), this.isset_goodsType);
|
ub.set(UpperLimit, this.getUpperLimit(), this.isset_upperLimit);
|
ub.set(LowerLimit, this.getLowerLimit(), this.isset_lowerLimit);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(BaseWarehouseId, this.getBaseWarehouseId(), this.isset_baseWarehouseId);
|
ub.set(BaseGoodsTemplateId, this.getBaseGoodsTemplateId(), this.isset_baseGoodsTemplateId);
|
ub.set(BaseGoodsModelsId, this.getBaseGoodsModelsId(), this.isset_baseGoodsModelsId);
|
ub.set(GoodsType, this.getGoodsType(), this.isset_goodsType);
|
ub.set(UpperLimit, this.getUpperLimit(), this.isset_upperLimit);
|
ub.set(LowerLimit, this.getLowerLimit(), this.isset_lowerLimit);
|
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, base_warehouse_id, base_goods_template_id, base_goods_models_id, goods_type, upper_limit, lower_limit from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, base_warehouse_id, base_goods_template_id, base_goods_models_id, goods_type, upper_limit, lower_limit from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public WhWarningConfig mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public WhWarningConfig toWhWarningConfig() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* wh_warning_config RowMapper
|
*
|
* @author genrator
|
*/
|
class WhWarningConfigRowMapper implements RowMapper<WhWarningConfig> {
|
|
@Override
|
public WhWarningConfig mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
WhWarningConfig wh_warning_config = new WhWarningConfig();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.Id);
|
if (columnIndex > 0) {
|
wh_warning_config.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.BaseWarehouseId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setBaseWarehouseId(null);
|
} else {
|
wh_warning_config.setBaseWarehouseId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.BaseGoodsTemplateId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setBaseGoodsTemplateId(null);
|
} else {
|
wh_warning_config.setBaseGoodsTemplateId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.BaseGoodsModelsId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setBaseGoodsModelsId(null);
|
} else {
|
wh_warning_config.setBaseGoodsModelsId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.GoodsType);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setGoodsType(null);
|
} else {
|
wh_warning_config.setGoodsType(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.UpperLimit);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setUpperLimit(null);
|
} else {
|
wh_warning_config.setUpperLimit(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, WhWarningConfig_mapper.LowerLimit);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
wh_warning_config.setLowerLimit(null);
|
} else {
|
wh_warning_config.setLowerLimit(rs.getInt(columnIndex));
|
}
|
}
|
return wh_warning_config;
|
}
|
}
|