package com.infoepoch.pms.dispatchassistant.infractructure.basic.permission;


import com.infoepoch.pms.dispatchassistant.domain.basic.menu.Menu;
import org.springframework.jdbc.core.RowMapper;

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

public class RoleAndMenuMapper implements RowMapper<Menu> {
    @Override
    public Menu mapRow(ResultSet resultSet, int i) throws SQLException {
        Menu menu = new Menu(resultSet.getString("ME_ID"),
                resultSet.getString("ME_NAME"),
                resultSet.getString("ME_URL"),
                resultSet.getString("ME_ICON"),
                resultSet.getBoolean("ME_COLLAPSE"),
                resultSet.getBoolean("ME_DISABLED"),
                resultSet.getString("ME_DESCRIPTION"),
                resultSet.getString("ME_PARENT_ID"),
                resultSet.getInt("ME_ELEMENT"),
                resultSet.getInt("ME_SORTING"),
                resultSet.getDate("ME_CREATE_TIME"),
                resultSet.getDate("ME_MODIFY_TIME"),
                resultSet.getInt("ME_TYPE"),
                resultSet.getBoolean("ME_CONTROLDATA")
        );
        menu.setInvoice(resultSet.getString("RM_INVOICE"));
        return menu;
    }
}
