# EquipmentChartInfoHistoryRowMapper.java

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

    import com.mycim.framework.jdbc.mapper.RowMapper;
    import com.mycim.framework.utils.lang.StringUtils;
    import com.mycim.framework.utils.lang.time.DateUtils;

    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Map;

    /**
     * @author yanbing.chen
     * @version 6.0.0
     * @date 2019/12/13
     **/
    public class EquipmentChartInfoHistoryRowMapper implements RowMapper<Map<String, Object>> {

        private Map<String, Object> map;

        @Override
        public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
            map = new HashMap<>();

            map.put("transRrn", rs.getLong("TRANS_RRN"));
            map.put("transSequence", rs.getInt("TRANS_SEQUENCE"));
            map.put("transId", StringUtils.defaultString(rs.getString("TRANS_ID")));
            if (rs.getTimestamp("TRANS_START_TIMESTAMP") != null) {
                map.put("transStartTimestamp", DateUtils.formatDate(rs.getTimestamp("TRANS_START_TIMESTAMP")));
            } else {
                map.put("transStartTimestamp", "");
            }
            if (rs.getTimestamp("TRANS_END_TIMESTAMP") != null) {
                map.put("transEndTimestamp", DateUtils.formatDate(rs.getTimestamp("TRANS_END_TIMESTAMP")));
            } else {
                map.put("transEndTimestamp", "");
            }
            map.put("transPerformedBy", StringUtils.defaultString(rs.getString("TRANS_PERFORMED_BY")));
            map.put("comments", StringUtils.defaultString(rs.getString("COMMENTS")));

            map.put("equipmentRrn", rs.getLong("EQUIPMENT_RRN"));
            map.put("chartId", rs.getString("CHART_ID"));

            map.put("equipmentId", StringUtils.defaultString(rs.getString("EQUIPMENT_ID")));
            map.put("chartName", StringUtils.defaultString(rs.getString("CHART_NAME")));
            map.put("areaId", StringUtils.defaultString(rs.getString("AREA_ID")));
            map.put("deriveChartName", StringUtils.defaultString(rs.getString("DERIVE_CHART_NAME")));
            map.put("userName", StringUtils.defaultString(rs.getString("USER_NAME")));
            map.put("recipeList", StringUtils.defaultString(rs.getString("RECIPE_LIST")));
            map.put("prodList", StringUtils.defaultString(rs.getString("PROD_LIST")));
            map.put("timeInterval", rs.getFloat("TIME_INTERVAL"));
            map.put("warningTime", rs.getFloat("WARNING_TIME"));
            map.put("formula", StringUtils.defaultString(rs.getString("FORMULA")));
            if (rs.getTimestamp("LAST_UPLOAD_TIMESTAMP") != null) {
                map.put("lastUploadTimestamp", DateUtils.formatDate(rs.getTimestamp("LAST_UPLOAD_TIMESTAMP")));
            } else {
                map.put("lastUploadTimestamp", "");
            }
            if (rs.getTimestamp("EXPIRED_TIMESTAMP") != null) {
                map.put("expiredTimestamp", DateUtils.formatDate(rs.getTimestamp("EXPIRED_TIMESTAMP")));
            } else {
                map.put("expiredTimestamp", "");
            }
            if (rs.getTimestamp("MAIL_SEND_TIMESTAMP") != null) {
                map.put("mailSendTimestamp", DateUtils.formatDate(rs.getTimestamp("MAIL_SEND_TIMESTAMP")));
            } else {
                map.put("mailSendTimestamp", "");
            }
            return map;
        }

    }