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 org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; public class SLoginInfo_mapper extends SLoginInfo implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new SLoginInfoRowMapper(); // 主键 public static final String INFO_ID = "info_id"; // 普通属性 public static final String USER_NAME = "user_name"; public static final String IPADDR = "ipaddr"; public static final String LOGIN_LOCATION = "login_location"; public static final String BROWSER = "browser"; public static final String OS = "os"; public static final String STATUS = "status"; public static final String MSG = "msg"; public static final String LOGIN_TIME = "login_time"; /** * 单位 */ public static final String SYS_USER_UNIT = "sys_user_unit"; /** * 用户名 */ public static final String SYS_USER_NAME = "sys_user_name"; /** * 默认构造函数 */ public SLoginInfo_mapper(SLoginInfo sLoginInfo) { if (sLoginInfo == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (sLoginInfo.isset_info_id) { this.setInfoId(sLoginInfo.getInfoId()); } //普通属性 if (sLoginInfo.isset_user_name) { this.setUserName(sLoginInfo.getUserName()); } if (sLoginInfo.isset_ipaddr) { this.setIpaddr(sLoginInfo.getIpaddr()); } if (sLoginInfo.isset_login_location) { this.setLoginLocation(sLoginInfo.getLoginLocation()); } if (sLoginInfo.isset_browser) { this.setBrowser(sLoginInfo.getBrowser()); } if (sLoginInfo.isset_os) { this.setOs(sLoginInfo.getOs()); } if (sLoginInfo.isset_status) { this.setStatus(sLoginInfo.getStatus()); } if (sLoginInfo.isset_msg) { this.setMsg(sLoginInfo.getMsg()); } if (sLoginInfo.isset_login_time) { this.setLoginTime(sLoginInfo.getLoginTime()); } } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "s_login_info"; return tableName; } /** * 获取主键名称 */ @Override public String getPkName_() { return INFO_ID; } /** * 获取主键值 */ @Override public Object getPkValue_() { return this.getInfoId(); } /** * 获取插入语句和参数 */ @Override public SqlAndParameters> getInsertSql_() { InsertBuilder ib = new InsertBuilder(this.getTableName_()); ib.set(INFO_ID, this.getInfoId()); ib.set(USER_NAME, this.getUserName(), this.isset_user_name); ib.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); ib.set(LOGIN_LOCATION, this.getLoginLocation(), this.isset_login_location); ib.set(BROWSER, this.getBrowser(), this.isset_browser); ib.set(OS, this.getOs(), this.isset_os); ib.set(STATUS, this.getStatus(), this.isset_status); ib.set(MSG, this.getMsg(), this.isset_msg); ib.set(LOGIN_TIME, this.getLoginTime(), this.isset_login_time); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(USER_NAME, this.getUserName(), this.isset_user_name); ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); ub.set(LOGIN_LOCATION, this.getLoginLocation(), this.isset_login_location); ub.set(BROWSER, this.getBrowser(), this.isset_browser); ub.set(OS, this.getOs(), this.isset_os); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(MSG, this.getMsg(), this.isset_msg); ub.set(LOGIN_TIME, this.getLoginTime(), this.isset_login_time); 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(USER_NAME, this.getUserName(), this.isset_user_name); ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); ub.set(LOGIN_LOCATION, this.getLoginLocation(), this.isset_login_location); ub.set(BROWSER, this.getBrowser(), this.isset_browser); ub.set(OS, this.getOs(), this.isset_os); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(MSG, this.getMsg(), this.isset_msg); ub.set(LOGIN_TIME, this.getLoginTime(), this.isset_login_time); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(USER_NAME, this.getUserName(), this.isset_user_name); ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); ub.set(LOGIN_LOCATION, this.getLoginLocation(), this.isset_login_location); ub.set(BROWSER, this.getBrowser(), this.isset_browser); ub.set(OS, this.getOs(), this.isset_os); ub.set(STATUS, this.getStatus(), this.isset_status); ub.set(MSG, this.getMsg(), this.isset_msg); ub.set(LOGIN_TIME, this.getLoginTime(), this.isset_login_time); 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 info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>( "select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public SLoginInfo mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public SLoginInfo toSLoginInfo() { return super.$clone(); } } /** * s_login_info RowMapper * * @author genrator */ class SLoginInfoRowMapper implements RowMapper { @Override public SLoginInfo mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); SLoginInfo s_login_info = new SLoginInfo(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.INFO_ID); if (columnIndex > 0) { s_login_info.setInfoId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.USER_NAME); if (columnIndex > 0) { s_login_info.setUserName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.IPADDR); if (columnIndex > 0) { s_login_info.setIpaddr(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.LOGIN_LOCATION); if (columnIndex > 0) { s_login_info.setLoginLocation(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.BROWSER); if (columnIndex > 0) { s_login_info.setBrowser(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.OS); if (columnIndex > 0) { s_login_info.setOs(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.STATUS); if (columnIndex > 0) { s_login_info.setStatus(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.MSG); if (columnIndex > 0) { s_login_info.setMsg(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.SYS_USER_UNIT); if (columnIndex > 0) { s_login_info.setSysUserUnit(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.SYS_USER_NAME); if (columnIndex > 0) { s_login_info.setSysUserName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, SLoginInfo_mapper.LOGIN_TIME); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { s_login_info.setLoginTime(null); } else { s_login_info.setLoginTime(rs.getLong(columnIndex)); } } return s_login_info; } }