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_CODE_INDEXING *
|
* @author genrator
|
*/
|
public class BaseCodeIndexing_mapper extends BaseCodeIndexing implements BaseMapper<BaseCodeIndexing> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<BaseCodeIndexing> ROW_MAPPER = new BaseCodeIndexingRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String YearIndex = "year_index";
|
public static final String MonthIndex = "month_index";
|
public static final String DayIndex = "day_index";
|
public static final String CodeIndex = "code_index";
|
public static final String CodePrefix = "code_prefix";
|
|
/**
|
* 默认构造函数
|
*/
|
public BaseCodeIndexing_mapper(BaseCodeIndexing baseCodeIndexing) {
|
if (baseCodeIndexing == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (baseCodeIndexing.isset_id) {
|
this.setId(baseCodeIndexing.getId());
|
}
|
//普通属性
|
if (baseCodeIndexing.isset_yearIndex) {
|
this.setYearIndex(baseCodeIndexing.getYearIndex());
|
}
|
if (baseCodeIndexing.isset_monthIndex) {
|
this.setMonthIndex(baseCodeIndexing.getMonthIndex());
|
}
|
if (baseCodeIndexing.isset_dayIndex) {
|
this.setDayIndex(baseCodeIndexing.getDayIndex());
|
}
|
if (baseCodeIndexing.isset_codeIndex) {
|
this.setCodeIndex(baseCodeIndexing.getCodeIndex());
|
}
|
if (baseCodeIndexing.isset_codePrefix) {
|
this.setCodePrefix(baseCodeIndexing.getCodePrefix());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(base_code_indexing.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "base_code_indexing";
|
/**
|
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(YearIndex, this.getYearIndex(), this.isset_yearIndex);
|
ib.set(MonthIndex, this.getMonthIndex(), this.isset_monthIndex);
|
ib.set(DayIndex, this.getDayIndex(), this.isset_dayIndex);
|
ib.set(CodeIndex, this.getCodeIndex(), this.isset_codeIndex);
|
ib.set(CodePrefix, this.getCodePrefix(), this.isset_codePrefix);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(YearIndex, this.getYearIndex(), this.isset_yearIndex);
|
ub.set(MonthIndex, this.getMonthIndex(), this.isset_monthIndex);
|
ub.set(DayIndex, this.getDayIndex(), this.isset_dayIndex);
|
ub.set(CodeIndex, this.getCodeIndex(), this.isset_codeIndex);
|
ub.set(CodePrefix, this.getCodePrefix(), this.isset_codePrefix);
|
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(YearIndex, this.getYearIndex(), this.isset_yearIndex);
|
ub.set(MonthIndex, this.getMonthIndex(), this.isset_monthIndex);
|
ub.set(DayIndex, this.getDayIndex(), this.isset_dayIndex);
|
ub.set(CodeIndex, this.getCodeIndex(), this.isset_codeIndex);
|
ub.set(CodePrefix, this.getCodePrefix(), this.isset_codePrefix);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(YearIndex, this.getYearIndex(), this.isset_yearIndex);
|
ub.set(MonthIndex, this.getMonthIndex(), this.isset_monthIndex);
|
ub.set(DayIndex, this.getDayIndex(), this.isset_dayIndex);
|
ub.set(CodeIndex, this.getCodeIndex(), this.isset_codeIndex);
|
ub.set(CodePrefix, this.getCodePrefix(), this.isset_codePrefix);
|
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, year_index, month_index, day_index, code_index, code_prefix from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, year_index, month_index, day_index, code_index, code_prefix from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public BaseCodeIndexing mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public BaseCodeIndexing toBaseCodeIndexing() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* base_code_indexing RowMapper
|
*
|
* @author genrator
|
*/
|
class BaseCodeIndexingRowMapper implements RowMapper<BaseCodeIndexing> {
|
|
@Override
|
public BaseCodeIndexing mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
BaseCodeIndexing base_code_indexing = new BaseCodeIndexing();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.Id);
|
if (columnIndex > 0) {
|
base_code_indexing.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.YearIndex);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_code_indexing.setYearIndex(null);
|
} else {
|
base_code_indexing.setYearIndex(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.MonthIndex);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_code_indexing.setMonthIndex(null);
|
} else {
|
base_code_indexing.setMonthIndex(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.DayIndex);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_code_indexing.setDayIndex(null);
|
} else {
|
base_code_indexing.setDayIndex(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.CodeIndex);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
base_code_indexing.setCodeIndex(null);
|
} else {
|
base_code_indexing.setCodeIndex(rs.getInt(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, BaseCodeIndexing_mapper.CodePrefix);
|
if (columnIndex > 0) {
|
base_code_indexing.setCodePrefix(rs.getString(columnIndex));
|
}
|
return base_code_indexing;
|
}
|
}
|