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;
|
|
/**
|
* 表名:BASE_GOODS_TEMPLATE *
|
* @author genrator
|
*/
|
public class BaseGoodsTemplate_mapper extends BaseGoodsTemplate implements BaseMapper<BaseGoodsTemplate> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<BaseGoodsTemplate> ROW_MAPPER = new BaseGoodsTemplateRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String GoodsCode = "goods_code";
|
public static final String GoodsName = "goods_name";
|
public static final String Classification = "classification";
|
public static final String States = "states";
|
public static final String CategoryId = "category_id";
|
public static final String Unit = "unit";
|
public static final String FAgencyId = "f_agency_id";
|
public static final String SAgencyId = "s_agency_id";
|
public static final String TAgencyId = "t_agency_id";
|
public static final String ParentAgencyId = "parent_agency_id";
|
public static final String AgencyLevel = "agency_level";
|
public static final String AgencyId = "agency_id";
|
public static final String AgencyName = "agency_name";
|
public static final String CreateDate = "create_date";
|
|
/**
|
* 默认构造函数
|
*/
|
public BaseGoodsTemplate_mapper(BaseGoodsTemplate baseGoodsTemplate) {
|
if (baseGoodsTemplate == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (baseGoodsTemplate.isset_id) {
|
this.setId(baseGoodsTemplate.getId());
|
}
|
//普通属性
|
if (baseGoodsTemplate.isset_goodsCode) {
|
this.setGoodsCode(baseGoodsTemplate.getGoodsCode());
|
}
|
if (baseGoodsTemplate.isset_goodsName) {
|
this.setGoodsName(baseGoodsTemplate.getGoodsName());
|
}
|
if (baseGoodsTemplate.isset_classification) {
|
this.setClassification(baseGoodsTemplate.getClassification());
|
}
|
if (baseGoodsTemplate.isset_states) {
|
this.setStates(baseGoodsTemplate.getStates());
|
}
|
if (baseGoodsTemplate.isset_categoryId) {
|
this.setCategoryId(baseGoodsTemplate.getCategoryId());
|
}
|
if (baseGoodsTemplate.isset_unit) {
|
this.setUnit(baseGoodsTemplate.getUnit());
|
}
|
if (baseGoodsTemplate.isset_fAgencyId) {
|
this.setFAgencyId(baseGoodsTemplate.getFAgencyId());
|
}
|
if (baseGoodsTemplate.isset_sAgencyId) {
|
this.setSAgencyId(baseGoodsTemplate.getSAgencyId());
|
}
|
if (baseGoodsTemplate.isset_tAgencyId) {
|
this.setTAgencyId(baseGoodsTemplate.getTAgencyId());
|
}
|
if (baseGoodsTemplate.isset_parentAgencyId) {
|
this.setParentAgencyId(baseGoodsTemplate.getParentAgencyId());
|
}
|
if (baseGoodsTemplate.isset_agencyLevel) {
|
this.setAgencyLevel(baseGoodsTemplate.getAgencyLevel());
|
}
|
if (baseGoodsTemplate.isset_agencyId) {
|
this.setAgencyId(baseGoodsTemplate.getAgencyId());
|
}
|
if (baseGoodsTemplate.isset_agencyName) {
|
this.setAgencyName(baseGoodsTemplate.getAgencyName());
|
}
|
if (baseGoodsTemplate.isset_createDate) {
|
this.setCreateDate(baseGoodsTemplate.getCreateDate());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(base_goods_template.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "base_goods_template";
|
/**
|
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(GoodsCode, this.getGoodsCode(), this.isset_goodsCode);
|
ib.set(GoodsName, this.getGoodsName(), this.isset_goodsName);
|
ib.set(Classification, this.getClassification(), this.isset_classification);
|
ib.set(States, this.getStates(), this.isset_states);
|
ib.set(CategoryId, this.getCategoryId(), this.isset_categoryId);
|
ib.set(Unit, this.getUnit(), this.isset_unit);
|
ib.set(FAgencyId, this.getFAgencyId(), this.isset_fAgencyId);
|
ib.set(SAgencyId, this.getSAgencyId(), this.isset_sAgencyId);
|
ib.set(TAgencyId, this.getTAgencyId(), this.isset_tAgencyId);
|
ib.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId);
|
ib.set(AgencyLevel, this.getAgencyLevel(), this.isset_agencyLevel);
|
ib.set(AgencyId, this.getAgencyId(), this.isset_agencyId);
|
ib.set(AgencyName, this.getAgencyName(), this.isset_agencyName);
|
ib.set(CreateDate, this.getCreateDate(), this.isset_createDate);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(GoodsCode, this.getGoodsCode(), this.isset_goodsCode);
|
ub.set(GoodsName, this.getGoodsName(), this.isset_goodsName);
|
ub.set(Classification, this.getClassification(), this.isset_classification);
|
ub.set(States, this.getStates(), this.isset_states);
|
ub.set(CategoryId, this.getCategoryId(), this.isset_categoryId);
|
ub.set(Unit, this.getUnit(), this.isset_unit);
|
ub.set(FAgencyId, this.getFAgencyId(), this.isset_fAgencyId);
|
ub.set(SAgencyId, this.getSAgencyId(), this.isset_sAgencyId);
|
ub.set(TAgencyId, this.getTAgencyId(), this.isset_tAgencyId);
|
ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId);
|
ub.set(AgencyLevel, this.getAgencyLevel(), this.isset_agencyLevel);
|
ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId);
|
ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName);
|
ub.set(CreateDate, this.getCreateDate(), this.isset_createDate);
|
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(GoodsCode, this.getGoodsCode(), this.isset_goodsCode);
|
ub.set(GoodsName, this.getGoodsName(), this.isset_goodsName);
|
ub.set(Classification, this.getClassification(), this.isset_classification);
|
ub.set(States, this.getStates(), this.isset_states);
|
ub.set(CategoryId, this.getCategoryId(), this.isset_categoryId);
|
ub.set(Unit, this.getUnit(), this.isset_unit);
|
ub.set(FAgencyId, this.getFAgencyId(), this.isset_fAgencyId);
|
ub.set(SAgencyId, this.getSAgencyId(), this.isset_sAgencyId);
|
ub.set(TAgencyId, this.getTAgencyId(), this.isset_tAgencyId);
|
ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId);
|
ub.set(AgencyLevel, this.getAgencyLevel(), this.isset_agencyLevel);
|
ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId);
|
ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName);
|
ub.set(CreateDate, this.getCreateDate(), this.isset_createDate);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(GoodsCode, this.getGoodsCode(), this.isset_goodsCode);
|
ub.set(GoodsName, this.getGoodsName(), this.isset_goodsName);
|
ub.set(Classification, this.getClassification(), this.isset_classification);
|
ub.set(States, this.getStates(), this.isset_states);
|
ub.set(CategoryId, this.getCategoryId(), this.isset_categoryId);
|
ub.set(Unit, this.getUnit(), this.isset_unit);
|
ub.set(FAgencyId, this.getFAgencyId(), this.isset_fAgencyId);
|
ub.set(SAgencyId, this.getSAgencyId(), this.isset_sAgencyId);
|
ub.set(TAgencyId, this.getTAgencyId(), this.isset_tAgencyId);
|
ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId);
|
ub.set(AgencyLevel, this.getAgencyLevel(), this.isset_agencyLevel);
|
ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId);
|
ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName);
|
ub.set(CreateDate, this.getCreateDate(), this.isset_createDate);
|
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, goods_code, goods_name, classification, states, category_id, unit, f_agency_id, s_agency_id, t_agency_id, parent_agency_id, agency_level, agency_id, agency_name, create_date from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, goods_code, goods_name, classification, states, category_id, unit, f_agency_id, s_agency_id, t_agency_id, parent_agency_id, agency_level, agency_id, agency_name, create_date from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public BaseGoodsTemplate mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public BaseGoodsTemplate toBaseGoodsTemplate() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* base_goods_template RowMapper
|
*
|
* @author genrator
|
*/
|
class BaseGoodsTemplateRowMapper implements RowMapper<BaseGoodsTemplate> {
|
|
@Override
|
public BaseGoodsTemplate mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
BaseGoodsTemplate base_goods_template = new BaseGoodsTemplate();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.Id);
|
if (columnIndex > 0) {
|
base_goods_template.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.GoodsCode);
|
if (columnIndex > 0) {
|
base_goods_template.setGoodsCode(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.GoodsName);
|
if (columnIndex > 0) {
|
base_goods_template.setGoodsName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.Classification);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setClassification(null);
|
} else {
|
base_goods_template.setClassification(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.States);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setStates(null);
|
} else {
|
base_goods_template.setStates(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.CategoryId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setCategoryId(null);
|
} else {
|
base_goods_template.setCategoryId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.Unit);
|
if (columnIndex > 0) {
|
base_goods_template.setUnit(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.FAgencyId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setFAgencyId(null);
|
} else {
|
base_goods_template.setFAgencyId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.SAgencyId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setSAgencyId(null);
|
} else {
|
base_goods_template.setSAgencyId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.TAgencyId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setTAgencyId(null);
|
} else {
|
base_goods_template.setTAgencyId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.ParentAgencyId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setParentAgencyId(null);
|
} else {
|
base_goods_template.setParentAgencyId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.AgencyLevel);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setAgencyLevel(null);
|
} else {
|
base_goods_template.setAgencyLevel(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.AgencyId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setAgencyId(null);
|
} else {
|
base_goods_template.setAgencyId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.AgencyName);
|
if (columnIndex > 0) {
|
base_goods_template.setAgencyName(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseGoodsTemplate_mapper.CreateDate);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_goods_template.setCreateDate(null);
|
} else {
|
base_goods_template.setCreateDate(rs.getLong(columnIndex));
|
}
|
}
|
return base_goods_template;
|
}
|
}
|