# ResistRowMapper.java

    package com.mycim.server.resist.dao.mapper;

    import com.mycim.framework.jdbc.mapper.RowMapper;
    import com.mycim.framework.utils.lang.time.DateUtils;
    import com.mycim.valueobject.ems.Resist;

    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Date;

    public class ResistRowMapper implements RowMapper<Resist> {

        @Override
        public Resist mapRow(ResultSet rs, int rowNum) throws SQLException {
            Resist resist = new Resist();

            resist.setInstanceId(rs.getString("INSTANCE_ID"));
            resist.setInstanceRrn(rs.getLong("INSTANCE_RRN"));

            resist.setNamedSpace(rs.getString("OBJ_SPACE"));
            resist.setObjectType(rs.getString("OBJ_TYPE"));
            String expireDate = rs.getString("EXPIRE_DATE");
            if (expireDate != null) {
                Date date = DateUtils.parse(expireDate, DateUtils.DATE_FORMAT4DATE);
                String expireTime = DateUtils.formatDate(date, DateUtils.DATE_FORMAT4DATE);
                resist.setExpireDate(expireTime);
                String[] dates = expireTime.split(" ");

                if (dates != null && dates.length == 2) {
                    resist.setExpireDates(dates[0]);
                    resist.setExpireTime(dates[1]);
                }
            }
            resist.setEqptId(rs.getString("EQPTID"));
            resist.setUnit(rs.getString("UNIT"));
            resist.setPrPipe(rs.getString("PRPIPE"));
            resist.setCurrentEntityStatus(rs.getString("CURRENT_STATUS"));

            resist.setResistNo(rs.getString("RESIST_NO"));
            resist.setResistName(rs.getString("RESIST_NAME"));
            resist.setMaterialNo(rs.getString("MATERIAL_NO"));
            resist.setLifeTimeType(rs.getString("LIFETIME_TYPE"));
            resist.setDefrostTime(rs.getString("DEFROST_TIME"));
            resist.setBufferDays(rs.getInt("BUFFER_DAYS"));
            resist.setCreateBy(rs.getString("CREATE_BY"));
            resist.setCreateTime(DateUtils.parse(rs.getString("CREATE_TIME"), DateUtils.DATE_FORMAT4DATE));
            resist.setModifyBy(rs.getString("MODIFY_BY"));
            resist.setModifyTime(DateUtils.parse(rs.getString("MODIFY_TIME"), DateUtils.DATE_FORMAT4DATE));
            resist.buildExpireInfo();
            resist.setVendorBarcode(rs.getString("VENDOR_BARCODE"));
            resist.setInstanceStatus(rs.getString("OBJ_STATUS"));
            return resist;
        }

    }