LotInfoMapper.java

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

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

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

/**
 * @author Johnson W
 */
public class LotInfoMapper implements RowMapper<Map<String, Object>> {

    @Override
    public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("lot_rrn", rs.getLong("LOT_RRN"));
        map.put("lot_id", rs.getString("LOT_ID"));
        map.put("lot_status", rs.getString("LOT_STATUS"));
        map.put("qty1", rs.getDouble("QTY1"));
        map.put("lot_type", rs.getString("LOT_TYPE"));
        long time = (System.currentTimeMillis() - rs.getTimestamp("QUEUE_TIMESTAMP").getTime()) / (60 * 1000);
        map.put("queue_time", time);
        map.put("work_area", rs.getString("WORK_AREA"));
        map.put("work_area_label",
                StringUtils.isNotEmpty(rs.getString("WORK_AREA_LABEL")) ? rs.getString("WORK_AREA_LABEL") : "");
        map.put("oper_name", rs.getString("OPER_NAME"));
        map.put("oper_desc", rs.getString("OPER_DESC"));
        map.put("product_name", rs.getString("PRODUCT_NAME"));
        map.put("equipment_name", rs.getString("EQUIPMENT_NAME"));
        map.put("row_num", rs.getLong("ROW_NUM"));

        return map;
    }

}