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_GOODS_USER_RECORD * * @author genrator */ public class LGoodsUserRecord_mapper extends LGoodsUserRecord implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new LGoodsUserRecordRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String GoodsUserPhone = "goods_user_phone"; public static final String RecordType = "record_type"; public static final String LastRecordId = "last_record_id"; public static final String NowUserPhone = "now_user_phone"; public static final String NowUserName = "now_user_name"; public static final String OperatorId = "operator_id"; public static final String OperatorName = "operator_name"; public static final String DealTime = "deal_time"; /** * 默认构造函数 */ public LGoodsUserRecord_mapper(LGoodsUserRecord lGoodsUserRecord) { if (lGoodsUserRecord == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (lGoodsUserRecord.isset_id) { this.setId(lGoodsUserRecord.getId()); } //普通属性 if (lGoodsUserRecord.isset_goodsUserPhone) { this.setGoodsUserPhone(lGoodsUserRecord.getGoodsUserPhone()); } if (lGoodsUserRecord.isset_recordType) { this.setRecordType(lGoodsUserRecord.getRecordType()); } if (lGoodsUserRecord.isset_lastRecordId) { this.setLastRecordId(lGoodsUserRecord.getLastRecordId()); } if (lGoodsUserRecord.isset_nowUserPhone) { this.setNowUserPhone(lGoodsUserRecord.getNowUserPhone()); } if (lGoodsUserRecord.isset_nowUserName) { this.setNowUserName(lGoodsUserRecord.getNowUserName()); } if (lGoodsUserRecord.isset_operatorId) { this.setOperatorId(lGoodsUserRecord.getOperatorId()); } if (lGoodsUserRecord.isset_operatorName) { this.setOperatorName(lGoodsUserRecord.getOperatorName()); } if (lGoodsUserRecord.isset_dealTime) { this.setDealTime(lGoodsUserRecord.getDealTime()); } // 去掉,2022-09-07 // this.setDatabaseName_(l_goods_user_record.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "l_goods_user_record"; /** 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(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ib.set(RecordType, this.getRecordType(), this.isset_recordType); ib.set(LastRecordId, this.getLastRecordId(), this.isset_lastRecordId); ib.set(NowUserPhone, this.getNowUserPhone(), this.isset_nowUserPhone); ib.set(NowUserName, this.getNowUserName(), this.isset_nowUserName); ib.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ib.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ib.set(DealTime, this.getDealTime(), this.isset_dealTime); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(RecordType, this.getRecordType(), this.isset_recordType); ub.set(LastRecordId, this.getLastRecordId(), this.isset_lastRecordId); ub.set(NowUserPhone, this.getNowUserPhone(), this.isset_nowUserPhone); ub.set(NowUserName, this.getNowUserName(), this.isset_nowUserName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); 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(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(RecordType, this.getRecordType(), this.isset_recordType); ub.set(LastRecordId, this.getLastRecordId(), this.isset_lastRecordId); ub.set(NowUserPhone, this.getNowUserPhone(), this.isset_nowUserPhone); ub.set(NowUserName, this.getNowUserName(), this.isset_nowUserName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(GoodsUserPhone, this.getGoodsUserPhone(), this.isset_goodsUserPhone); ub.set(RecordType, this.getRecordType(), this.isset_recordType); ub.set(LastRecordId, this.getLastRecordId(), this.isset_lastRecordId); ub.set(NowUserPhone, this.getNowUserPhone(), this.isset_nowUserPhone); ub.set(NowUserName, this.getNowUserName(), this.isset_nowUserName); ub.set(OperatorId, this.getOperatorId(), this.isset_operatorId); ub.set(OperatorName, this.getOperatorName(), this.isset_operatorName); ub.set(DealTime, this.getDealTime(), this.isset_dealTime); 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, goods_user_phone, record_type, last_record_id, now_user_phone, now_user_name, operator_id, operator_name, deal_time from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, goods_user_phone, record_type, last_record_id, now_user_phone, now_user_name, operator_id, operator_name, deal_time from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public LGoodsUserRecord mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public LGoodsUserRecord toLGoodsUserRecord() { return super.$clone(); } } /** * l_goods_user_record RowMapper * * @author genrator */ class LGoodsUserRecordRowMapper implements RowMapper { @Override public LGoodsUserRecord mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); LGoodsUserRecord l_goods_user_record = new LGoodsUserRecord(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.Id); if (columnIndex > 0) { l_goods_user_record.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.GoodsUserPhone); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setGoodsUserPhone(null); } else { l_goods_user_record.setGoodsUserPhone(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.RecordType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setRecordType(null); } else { l_goods_user_record.setRecordType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.LastRecordId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setLastRecordId(null); } else { l_goods_user_record.setLastRecordId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.NowUserPhone); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setNowUserPhone(null); } else { l_goods_user_record.setNowUserPhone(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.NowUserName); if (columnIndex > 0) { l_goods_user_record.setNowUserName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.OperatorId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setOperatorId(null); } else { l_goods_user_record.setOperatorId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.OperatorName); if (columnIndex > 0) { l_goods_user_record.setOperatorName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, LGoodsUserRecord_mapper.DealTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { l_goods_user_record.setDealTime(null); } else { l_goods_user_record.setDealTime(rs.getLong(columnIndex)); } } return l_goods_user_record; } }