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_FORM_SCRAPPED_MODEL * * @author genrator */ public class WhFormScrappedModel_mapper extends WhFormScrappedModel implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new WhFormScrappedModelRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String Counts = "counts"; public static final String ScrappedCode = "scrapped_code"; public static final String ScrappedName = "scrapped_name"; public static final String Beiz = "beiz"; public static final String DepGoodsDetailsId = "dep_goods_details_id"; public static final String DepFormScrappedId = "dep_form_scrapped_id"; public static final String WhGoodsId = "wh_goods_id"; public static final String WhFormScrappedGoodsId = "wh_form_scrapped_goods_id"; /** * 默认构造函数 */ public WhFormScrappedModel_mapper(WhFormScrappedModel whFormScrappedModel) { if (whFormScrappedModel == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (whFormScrappedModel.isset_id) { this.setId(whFormScrappedModel.getId()); } //普通属性 if (whFormScrappedModel.isset_counts) { this.setCounts(whFormScrappedModel.getCounts()); } if (whFormScrappedModel.isset_scrappedCode) { this.setScrappedCode(whFormScrappedModel.getScrappedCode()); } if (whFormScrappedModel.isset_scrappedName) { this.setScrappedName(whFormScrappedModel.getScrappedName()); } if (whFormScrappedModel.isset_beiz) { this.setBeiz(whFormScrappedModel.getBeiz()); } if (whFormScrappedModel.isset_depGoodsDetailsId) { this.setDepGoodsDetailsId(whFormScrappedModel.getDepGoodsDetailsId()); } if (whFormScrappedModel.isset_depFormScrappedId) { this.setDepFormScrappedId(whFormScrappedModel.getDepFormScrappedId()); } if (whFormScrappedModel.isset_whGoodsId) { this.setWhGoodsId(whFormScrappedModel.getWhGoodsId()); } if (whFormScrappedModel.isset_whFormScrappedGoodsId) { this.setWhFormScrappedGoodsId(whFormScrappedModel.getWhFormScrappedGoodsId()); } // 去掉,2022-09-07 // this.setDatabaseName_(wh_form_scrapped_model.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "wh_form_scrapped_model"; /** 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(Counts, this.getCounts(), this.isset_counts); ib.set(ScrappedCode, this.getScrappedCode(), this.isset_scrappedCode); ib.set(ScrappedName, this.getScrappedName(), this.isset_scrappedName); ib.set(Beiz, this.getBeiz(), this.isset_beiz); ib.set(DepGoodsDetailsId, this.getDepGoodsDetailsId(), this.isset_depGoodsDetailsId); ib.set(DepFormScrappedId, this.getDepFormScrappedId(), this.isset_depFormScrappedId); ib.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ib.set(WhFormScrappedGoodsId, this.getWhFormScrappedGoodsId(), this.isset_whFormScrappedGoodsId); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(ScrappedCode, this.getScrappedCode(), this.isset_scrappedCode); ub.set(ScrappedName, this.getScrappedName(), this.isset_scrappedName); ub.set(Beiz, this.getBeiz(), this.isset_beiz); ub.set(DepGoodsDetailsId, this.getDepGoodsDetailsId(), this.isset_depGoodsDetailsId); ub.set(DepFormScrappedId, this.getDepFormScrappedId(), this.isset_depFormScrappedId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WhFormScrappedGoodsId, this.getWhFormScrappedGoodsId(), this.isset_whFormScrappedGoodsId); 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(Counts, this.getCounts(), this.isset_counts); ub.set(ScrappedCode, this.getScrappedCode(), this.isset_scrappedCode); ub.set(ScrappedName, this.getScrappedName(), this.isset_scrappedName); ub.set(Beiz, this.getBeiz(), this.isset_beiz); ub.set(DepGoodsDetailsId, this.getDepGoodsDetailsId(), this.isset_depGoodsDetailsId); ub.set(DepFormScrappedId, this.getDepFormScrappedId(), this.isset_depFormScrappedId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WhFormScrappedGoodsId, this.getWhFormScrappedGoodsId(), this.isset_whFormScrappedGoodsId); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(Counts, this.getCounts(), this.isset_counts); ub.set(ScrappedCode, this.getScrappedCode(), this.isset_scrappedCode); ub.set(ScrappedName, this.getScrappedName(), this.isset_scrappedName); ub.set(Beiz, this.getBeiz(), this.isset_beiz); ub.set(DepGoodsDetailsId, this.getDepGoodsDetailsId(), this.isset_depGoodsDetailsId); ub.set(DepFormScrappedId, this.getDepFormScrappedId(), this.isset_depFormScrappedId); ub.set(WhGoodsId, this.getWhGoodsId(), this.isset_whGoodsId); ub.set(WhFormScrappedGoodsId, this.getWhFormScrappedGoodsId(), this.isset_whFormScrappedGoodsId); 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, counts, scrapped_code, scrapped_name, beiz, dep_goods_details_id, dep_form_scrapped_id, wh_goods_id, wh_form_scrapped_goods_id from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, counts, scrapped_code, scrapped_name, beiz, dep_goods_details_id, dep_form_scrapped_id, wh_goods_id, wh_form_scrapped_goods_id from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public WhFormScrappedModel mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public WhFormScrappedModel toWhFormScrappedModel() { return super.$clone(); } } /** * wh_form_scrapped_model RowMapper * * @author genrator */ class WhFormScrappedModelRowMapper implements RowMapper { @Override public WhFormScrappedModel mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); WhFormScrappedModel wh_form_scrapped_model = new WhFormScrappedModel(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.Id); if (columnIndex > 0) { wh_form_scrapped_model.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.Counts); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_scrapped_model.setCounts(null); } else { wh_form_scrapped_model.setCounts(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.ScrappedCode); if (columnIndex > 0) { wh_form_scrapped_model.setScrappedCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.ScrappedName); if (columnIndex > 0) { wh_form_scrapped_model.setScrappedName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.Beiz); if (columnIndex > 0) { wh_form_scrapped_model.setBeiz(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.DepGoodsDetailsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_scrapped_model.setDepGoodsDetailsId(null); } else { wh_form_scrapped_model.setDepGoodsDetailsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.DepFormScrappedId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_scrapped_model.setDepFormScrappedId(null); } else { wh_form_scrapped_model.setDepFormScrappedId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.WhGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_scrapped_model.setWhGoodsId(null); } else { wh_form_scrapped_model.setWhGoodsId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, WhFormScrappedModel_mapper.WhFormScrappedGoodsId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { wh_form_scrapped_model.setWhFormScrappedGoodsId(null); } else { wh_form_scrapped_model.setWhFormScrappedGoodsId(rs.getLong(columnIndex)); } } return wh_form_scrapped_model; } }