# EcnMapper.java

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

    import com.mycim.framework.jdbc.mapper.RowMapper;
    import com.mycim.framework.utils.lang.time.DateUtils;
    import com.mycim.valueobject.prp.Ecn;

    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;

    /**
     * @author Johnson.Wang
     * @version 6.0.0
     * @date 2019/8/31
     **/
    public class EcnMapper implements RowMapper<Ecn> {

        @Override
        public Ecn mapRow(ResultSet rs, int rowNum) throws SQLException {
            Ecn ecn = new Ecn();
            ecn.setInstanceRrn(rs.getLong("INSTANCE_RRN"));
            ecn.setInstanceId(rs.getString("INSTANCE_ID"));
            ecn.setInstanceDesc(rs.getString("INSTANCE_DESC"));
            ecn.setObjectType(rs.getString("OBJECT_TYPE"));
            ecn.setObjectSubtype(rs.getString("OBJECT_SUBTYPE"));
            ecn.setCreatedTimestamp(rs.getTimestamp("CREATED_TIMESTAMP"));
            ecn.setApprovedWorkflowRrn(rs.getLong("APPROVAL_WFL_RRN"));
            ecn.setComments(rs.getString("COMMENTS"));
            ecn.setEcnStatus(rs.getString("ECN_STATUS"));
            ecn.setRequestBy(rs.getLong("REQUEST_BY"));

            Timestamp dateFrom = rs.getTimestamp("EFFECTIVE_DATE_FROM");
            if (dateFrom != null) {
                ecn.setEffectiveDateFrom(DateUtils.formatDate(dateFrom));
            }

            Timestamp dateTo = rs.getTimestamp("EFFECTIVE_DATE_TO");
            if (dateTo != null) {
                ecn.setEffectiveDateTo(DateUtils.formatDate(dateTo));
            }
            return ecn;
        }

    }