<select id="selectByMemberKey" resultType="java.util.HashMap"> SELECT member_id ,expire FROM member_key_make_up WHERE member_key = #{memberKey,jdbcType=VARCHAR} </select>
public interface MemberKeyMakeUpMapper { HashMap<String,Object> selectByMemberKey(@Param("memberKey")String memberKey); }
private Long mackUpKeyGet(String memberKey) { HashMap<String, Object> map = memberKeyMakeUpMapper.selectByMemberKey(memberKey); if (map == null || map.get("MEMBER_ID") == null || map.get("EXPIRE").toString() == null) { return null; } Long memberId = Long.valueOf(map.get("MEMBER_ID").toString()); Long expire = Long.valueOf(map.get("EXPIRE").toString()); if (memberId == null || memberId == 0 || expire == null || expire == 0) { return null; } if (System.currentTimeMillis() < expire) { return -1L; } return memberId; }
来源:https://www.cnblogs.com/wangchuanfu/p/6884326.html