package com.iplatform.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 org.springframework.jdbc.core.RowMapper;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.Map;
|
|
/**
|
* 表名:CHAT_DIALOG *
|
* @author genrator
|
*/
|
public class ChatDialog_mapper extends ChatDialog implements BaseMapper<ChatDialog> {
|
// 序列化版本号
|
private static final long serialVersionUID = 1L;
|
|
public static final RowMapper<ChatDialog> ROW_MAPPER = new ChatDialogRowMapper();
|
|
// 主键
|
public static final String Id = "id";
|
// 普通属性
|
public static final String CreateTime = "create_time";
|
public static final String CustomerService = "customer_service";
|
public static final String UserId = "user_id";
|
public static final String SessionId = "session_id";
|
public static final String BizId = "biz_id";
|
public static final String EndTime = "end_time";
|
|
/**
|
* 默认构造函数
|
*/
|
public ChatDialog_mapper(ChatDialog chatDialog) {
|
if (chatDialog == null) {
|
throw new IllegalArgumentException("po参数不允许为空!");
|
}
|
//主键
|
if (chatDialog.isset_id) {
|
this.setId(chatDialog.getId());
|
}
|
//普通属性
|
if (chatDialog.isset_createTime) {
|
this.setCreateTime(chatDialog.getCreateTime());
|
}
|
if (chatDialog.isset_customerService) {
|
this.setCustomerService(chatDialog.getCustomerService());
|
}
|
if (chatDialog.isset_userId) {
|
this.setUserId(chatDialog.getUserId());
|
}
|
if (chatDialog.isset_sessionId) {
|
this.setSessionId(chatDialog.getSessionId());
|
}
|
if (chatDialog.isset_bizId) {
|
this.setBizId(chatDialog.getBizId());
|
}
|
if (chatDialog.isset_endTime) {
|
this.setEndTime(chatDialog.getEndTime());
|
}
|
// 去掉,2022-09-07
|
// this.setDatabaseName_(chat_dialog.getDatabaseName_());
|
}
|
|
/**
|
* 获取表名
|
*/
|
@Override
|
public String getTableName_() {
|
String tableName = "chat_dialog";
|
/**
|
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(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ib.set(CustomerService, this.getCustomerService(), this.isset_customerService);
|
ib.set(UserId, this.getUserId(), this.isset_userId);
|
ib.set(SessionId, this.getSessionId(), this.isset_sessionId);
|
ib.set(BizId, this.getBizId(), this.isset_bizId);
|
ib.set(EndTime, this.getEndTime(), this.isset_endTime);
|
return ib.genMapSql();
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Map<String, Object>> getUpdateSql_() {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(CustomerService, this.getCustomerService(), this.isset_customerService);
|
ub.set(UserId, this.getUserId(), this.isset_userId);
|
ub.set(SessionId, this.getSessionId(), this.isset_sessionId);
|
ub.set(BizId, this.getBizId(), this.isset_bizId);
|
ub.set(EndTime, this.getEndTime(), this.isset_endTime);
|
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(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(CustomerService, this.getCustomerService(), this.isset_customerService);
|
ub.set(UserId, this.getUserId(), this.isset_userId);
|
ub.set(SessionId, this.getSessionId(), this.isset_sessionId);
|
ub.set(BizId, this.getBizId(), this.isset_bizId);
|
ub.set(EndTime, this.getEndTime(), this.isset_endTime);
|
return ub.genMapSql(where, parameters);
|
}
|
|
/**
|
* 获取更新语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) {
|
UpdateBuilder ub = new UpdateBuilder(this.getTableName_());
|
ub.set(CreateTime, this.getCreateTime(), this.isset_createTime);
|
ub.set(CustomerService, this.getCustomerService(), this.isset_customerService);
|
ub.set(UserId, this.getUserId(), this.isset_userId);
|
ub.set(SessionId, this.getSessionId(), this.isset_sessionId);
|
ub.set(BizId, this.getBizId(), this.isset_bizId);
|
ub.set(EndTime, this.getEndTime(), this.isset_endTime);
|
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, create_time, customer_service, user_id, session_id, biz_id, end_time from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 获取查询语句和参数
|
*/
|
@Override
|
public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) {
|
return new SqlAndParameters<>("select id, create_time, customer_service, user_id, session_id, biz_id, end_time from " + this.getTableName_() + " " + where, parameters);
|
}
|
|
/**
|
* 将resultset的一行转化为po
|
*/
|
@Override
|
public ChatDialog mapRow(ResultSet rs, int i) throws SQLException {
|
return ROW_MAPPER.mapRow(rs, i);
|
}
|
|
/**
|
* 克隆
|
*/
|
public ChatDialog toChatDialog() {
|
return super.$clone();
|
}
|
}
|
|
/**
|
* chat_dialog RowMapper
|
*
|
* @author genrator
|
*/
|
class ChatDialogRowMapper implements RowMapper<ChatDialog> {
|
|
@Override
|
public ChatDialog mapRow(ResultSet rs, int i) throws SQLException {
|
ResultSetUtils resultSetUtils = new ResultSetUtils();
|
ChatDialog chat_dialog = new ChatDialog();
|
Integer columnIndex;
|
//主键
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.Id);
|
if (columnIndex > 0) {
|
chat_dialog.setId(rs.getLong(columnIndex));
|
}
|
//普通属性
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.CreateTime);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
chat_dialog.setCreateTime(null);
|
} else {
|
chat_dialog.setCreateTime(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.CustomerService);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
chat_dialog.setCustomerService(null);
|
} else {
|
chat_dialog.setCustomerService(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.UserId);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
chat_dialog.setUserId(null);
|
} else {
|
chat_dialog.setUserId(rs.getLong(columnIndex));
|
}
|
}
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.SessionId);
|
if (columnIndex > 0) {
|
chat_dialog.setSessionId(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.BizId);
|
if (columnIndex > 0) {
|
chat_dialog.setBizId(rs.getString(columnIndex));
|
}
|
columnIndex = resultSetUtils.findColumn(rs, ChatDialog_mapper.EndTime);
|
if (columnIndex > 0) {
|
if (rs.getBigDecimal(columnIndex) == null) {
|
chat_dialog.setEndTime(null);
|
} else {
|
chat_dialog.setEndTime(rs.getLong(columnIndex));
|
}
|
}
|
return chat_dialog;
|
}
|
}
|