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; /** * 表名:FIN_SYS_SERVER * * @author genrator */ public class FinSysServer_mapper extends FinSysServer implements BaseMapper { // 序列化版本号 private static final long serialVersionUID = 1L; public static final RowMapper ROW_MAPPER = new FinSysServerRowMapper(); // 主键 public static final String Id = "id"; // 普通属性 public static final String ParentId = "parent_id"; public static final String Name = "name"; public static final String Code = "code"; public static final String LvType = "lv_type"; public static final String Lv = "lv"; public static final String Status = "status"; public static final String DelFlag = "del_flag"; public static final String CreatedBy = "created_by"; public static final String CreatedTime = "created_time"; public static final String Description = "description"; /** * 默认构造函数 */ public FinSysServer_mapper(FinSysServer finSysServer) { if (finSysServer == null) { throw new IllegalArgumentException("po参数不允许为空!"); } //主键 if (finSysServer.isset_id) { this.setId(finSysServer.getId()); } //普通属性 if (finSysServer.isset_parentId) { this.setParentId(finSysServer.getParentId()); } if (finSysServer.isset_name) { this.setName(finSysServer.getName()); } if (finSysServer.isset_code) { this.setCode(finSysServer.getCode()); } if (finSysServer.isset_lvType) { this.setLvType(finSysServer.getLvType()); } if (finSysServer.isset_lv) { this.setLv(finSysServer.getLv()); } if (finSysServer.isset_status) { this.setStatus(finSysServer.getStatus()); } if (finSysServer.isset_delFlag) { this.setDelFlag(finSysServer.getDelFlag()); } if (finSysServer.isset_createdBy) { this.setCreatedBy(finSysServer.getCreatedBy()); } if (finSysServer.isset_createdTime) { this.setCreatedTime(finSysServer.getCreatedTime()); } if (finSysServer.isset_description) { this.setDescription(finSysServer.getDescription()); } // 去掉,2022-09-07 // this.setDatabaseName_(fin_sys_server.getDatabaseName_()); } /** * 获取表名 */ @Override public String getTableName_() { String tableName = "fin_sys_server"; /** 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(ParentId, this.getParentId(), this.isset_parentId); ib.set(Name, this.getName(), this.isset_name); ib.set(Code, this.getCode(), this.isset_code); ib.set(LvType, this.getLvType(), this.isset_lvType); ib.set(Lv, this.getLv(), this.isset_lv); ib.set(Status, this.getStatus(), this.isset_status); ib.set(DelFlag, this.getDelFlag(), this.isset_delFlag); ib.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy); ib.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime); ib.set(Description, this.getDescription(), this.isset_description); return ib.genMapSql(); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters> getUpdateSql_() { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(ParentId, this.getParentId(), this.isset_parentId); ub.set(Name, this.getName(), this.isset_name); ub.set(Code, this.getCode(), this.isset_code); ub.set(LvType, this.getLvType(), this.isset_lvType); ub.set(Lv, this.getLv(), this.isset_lv); ub.set(Status, this.getStatus(), this.isset_status); ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag); ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy); ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime); ub.set(Description, this.getDescription(), this.isset_description); 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(ParentId, this.getParentId(), this.isset_parentId); ub.set(Name, this.getName(), this.isset_name); ub.set(Code, this.getCode(), this.isset_code); ub.set(LvType, this.getLvType(), this.isset_lvType); ub.set(Lv, this.getLv(), this.isset_lv); ub.set(Status, this.getStatus(), this.isset_status); ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag); ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy); ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime); ub.set(Description, this.getDescription(), this.isset_description); return ub.genMapSql(where, parameters); } /** * 获取更新语句和参数 */ @Override public SqlAndParameters getUpdateSql_(String where, Object[] parameters) { UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); ub.set(ParentId, this.getParentId(), this.isset_parentId); ub.set(Name, this.getName(), this.isset_name); ub.set(Code, this.getCode(), this.isset_code); ub.set(LvType, this.getLvType(), this.isset_lvType); ub.set(Lv, this.getLv(), this.isset_lv); ub.set(Status, this.getStatus(), this.isset_status); ub.set(DelFlag, this.getDelFlag(), this.isset_delFlag); ub.set(CreatedBy, this.getCreatedBy(), this.isset_createdBy); ub.set(CreatedTime, this.getCreatedTime(), this.isset_createdTime); ub.set(Description, this.getDescription(), this.isset_description); 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, parent_id, name, code, lv_type, lv, status, del_flag, created_by, created_time, description from " + this.getTableName_() + " " + where, parameters); } /** * 获取查询语句和参数 */ @Override public SqlAndParameters getSelectSql_(String where, Object[] parameters) { return new SqlAndParameters<>("select id, parent_id, name, code, lv_type, lv, status, del_flag, created_by, created_time, description from " + this.getTableName_() + " " + where, parameters); } /** * 将resultset的一行转化为po */ @Override public FinSysServer mapRow(ResultSet rs, int i) throws SQLException { return ROW_MAPPER.mapRow(rs, i); } /** * 克隆 */ public FinSysServer toFinSysServer() { return super.$clone(); } } /** * fin_sys_server RowMapper * * @author genrator */ class FinSysServerRowMapper implements RowMapper { @Override public FinSysServer mapRow(ResultSet rs, int i) throws SQLException { ResultSetUtils resultSetUtils = new ResultSetUtils(); FinSysServer fin_sys_server = new FinSysServer(); Integer columnIndex; //主键 columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Id); if (columnIndex > 0) { fin_sys_server.setId(rs.getLong(columnIndex)); } //普通属性 columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.ParentId); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setParentId(null); } else { fin_sys_server.setParentId(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Name); if (columnIndex > 0) { fin_sys_server.setName(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Code); if (columnIndex > 0) { fin_sys_server.setCode(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.LvType); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setLvType(null); } else { fin_sys_server.setLvType(rs.getInt(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Lv); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setLv(null); } else { fin_sys_server.setLv(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Status); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setStatus(null); } else { fin_sys_server.setStatus(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.DelFlag); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setDelFlag(null); } else { fin_sys_server.setDelFlag(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.CreatedBy); if (columnIndex > 0) { fin_sys_server.setCreatedBy(rs.getString(columnIndex)); } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.CreatedTime); if (columnIndex > 0) { if (rs.getBigDecimal(columnIndex) == null) { fin_sys_server.setCreatedTime(null); } else { fin_sys_server.setCreatedTime(rs.getLong(columnIndex)); } } columnIndex = resultSetUtils.findColumn(rs, FinSysServer_mapper.Description); if (columnIndex > 0) { fin_sys_server.setDescription(rs.getString(columnIndex)); } return fin_sys_server; } }