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; /** * 表名:BASE_WAREHOUSE * * * @author genrator */ public class BaseWarehouse_mapper extends BaseWarehouse implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new BaseWarehouseRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String WarehouseType = "warehouse_type"; public static final String WarehouseCode = "warehouse_code"; public static final String WarehouseName = "warehouse_name"; public static final String Adress = "adress"; public static final String ParentAgencyId = "parent_agency_id"; public static final String AgencyId = "agency_id"; public static final String AgencyName = "agency_name"; public static final String ClassificationCode = "classification_code"; public static final String ClassificationName = "classification_name"; public static final String IsDefault = "is_default"; public static final String States = "states"; /** * 默认构造函数 */ public BaseWarehouse_mapper(BaseWarehouse baseWarehouse) { if (baseWarehouse == null) { throw new IllegalArgumentException("po参数不允许为空!"); } // 主键 if (baseWarehouse.isset_id) { this.setId(baseWarehouse.getId()); } // 普通属性 if (baseWarehouse.isset_warehouseType) { this.setWarehouseType(baseWarehouse.getWarehouseType()); } if (baseWarehouse.isset_warehouseCode) { this.setWarehouseCode(baseWarehouse.getWarehouseCode()); } if (baseWarehouse.isset_warehouseName) { this.setWarehouseName(baseWarehouse.getWarehouseName()); } if (baseWarehouse.isset_adress) { this.setAdress(baseWarehouse.getAdress()); } if (baseWarehouse.isset_parentAgencyId) { this.setParentAgencyId(baseWarehouse.getParentAgencyId()); } if (baseWarehouse.isset_agencyId) { this.setAgencyId(baseWarehouse.getAgencyId()); } if (baseWarehouse.isset_agencyName) { this.setAgencyName(baseWarehouse.getAgencyName()); } if (baseWarehouse.isset_classificationCode) { this.setClassificationCode(baseWarehouse.getClassificationCode()); } if (baseWarehouse.isset_classificationName) { this.setClassificationName(baseWarehouse.getClassificationName()); } if (baseWarehouse.isset_isDefault) { this.setIsDefault(baseWarehouse.getIsDefault()); } if (baseWarehouse.isset_states) { this.setStates(baseWarehouse.getStates()); } // 去掉,2022-09-07 // this.setDatabaseName_(base_warehouse.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "base_warehouse"; /** * 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(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ib.set(WarehouseCode, this.getWarehouseCode(), this.isset_warehouseCode); ib.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ib.set(Adress, this.getAdress(), this.isset_adress); ib.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId); ib.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ib.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ib.set(ClassificationCode, this.getClassificationCode(), this.isset_classificationCode); ib.set(ClassificationName, this.getClassificationName(), this.isset_classificationName); ib.set(IsDefault, this.getIsDefault(), this.isset_isDefault); ib.set(States, this.getStates(), this.isset_states); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseCode, this.getWarehouseCode(), this.isset_warehouseCode); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Adress, this.getAdress(), this.isset_adress); ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(ClassificationCode, this.getClassificationCode(), this.isset_classificationCode); ub.set(ClassificationName, this.getClassificationName(), this.isset_classificationName); ub.set(IsDefault, this.getIsDefault(), this.isset_isDefault); ub.set(States, this.getStates(), this.isset_states); 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(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseCode, this.getWarehouseCode(), this.isset_warehouseCode); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Adress, this.getAdress(), this.isset_adress); ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(ClassificationCode, this.getClassificationCode(), this.isset_classificationCode); ub.set(ClassificationName, this.getClassificationName(), this.isset_classificationName); ub.set(IsDefault, this.getIsDefault(), this.isset_isDefault); ub.set(States, this.getStates(), this.isset_states); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(WarehouseType, this.getWarehouseType(), this.isset_warehouseType); ub.set(WarehouseCode, this.getWarehouseCode(), this.isset_warehouseCode); ub.set(WarehouseName, this.getWarehouseName(), this.isset_warehouseName); ub.set(Adress, this.getAdress(), this.isset_adress); ub.set(ParentAgencyId, this.getParentAgencyId(), this.isset_parentAgencyId); ub.set(AgencyId, this.getAgencyId(), this.isset_agencyId); ub.set(AgencyName, this.getAgencyName(), this.isset_agencyName); ub.set(ClassificationCode, this.getClassificationCode(), this.isset_classificationCode); ub.set(ClassificationName, this.getClassificationName(), this.isset_classificationName); ub.set(IsDefault, this.getIsDefault(), this.isset_isDefault); ub.set(States, this.getStates(), this.isset_states); 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_type, warehouse_code, warehouse_name, adress, parent_agency_id, agency_id, agency_name, classification_code, classification_name, is_default, states from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>( "select id, warehouse_type, warehouse_code, warehouse_name, adress, parent_agency_id, agency_id, agency_name, classification_code, classification_name, is_default, states from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public BaseWarehouse mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public BaseWarehouse toBaseWarehouse() { return super.$clone(); } } /** * base_warehouse RowMapper * * @author genrator */ class BaseWarehouseRowMapper implements RowMapper { @Override public BaseWarehouse mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); BaseWarehouse base_warehouse = new BaseWarehouse(); Integer columnIndex; // 主键 columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.Id); if (columnIndex > 0) { base_warehouse.setId(rs.getLong(columnIndex)); } // 普通属性 columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.WarehouseType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { base_warehouse.setWarehouseType(null); } else { base_warehouse.setWarehouseType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.WarehouseCode); if (columnIndex > 0) { base_warehouse.setWarehouseCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.WarehouseName); if (columnIndex > 0) { base_warehouse.setWarehouseName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.Adress); if (columnIndex > 0) { base_warehouse.setAdress(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.ParentAgencyId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { base_warehouse.setParentAgencyId(null); } else { base_warehouse.setParentAgencyId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.AgencyId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { base_warehouse.setAgencyId(null); } else { base_warehouse.setAgencyId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.AgencyName); if (columnIndex > 0) { base_warehouse.setAgencyName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.ClassificationCode); if (columnIndex > 0) { base_warehouse.setClassificationCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.ClassificationName); if (columnIndex > 0) { base_warehouse.setClassificationName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.IsDefault); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { base_warehouse.setIsDefault(null); } else { base_warehouse.setIsDefault(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, BaseWarehouse_mapper.States); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { base_warehouse.setStates(null); } else { base_warehouse.setStates(rs.getInt(columnIndex)); } } return base_warehouse; } }