@Test public void testSelectAllByUserAccountId() throws Exception { List<Map<String, Object>> list = ird.selectAllByUserAccountId(10000l); System.out.println(list.size()); }
@Override public List<Map<String, Object>> selectAllByUserAccountId(Long accountId) { List<Map<String, Object>> mapList = new ArrayList<>(); List<RedPackets> list = mapper.selectByAccount(accountId); for (RedPackets r : list) { Map<String, Object> map = new HashMap<>(); map.put("id", r.getId()); map.put("name", r.getName()); map.put("userAccountId", r.getUserAccountId()); map.put("validDate", r.getValidDate()); map.put("overdueDate", r.getOverdueDate()); map.put("usePrice", r.getUsePrice()); map.put("worth", r.getWorth()); Integer useState = r.getUseState(); map.put("useState", useState); if (overdue(r)) { map.put("overdue", Settings.RED_PACKET_overdue); } else { map.put("overdue", Settings.RED_PACKET_overdue_not); } if (useState == Settings.RED_PACKET_USE_STATE_USED || overdue(r)) { map.put("usable", Settings.STATE_DISABLE); } else { map.put("usable", Settings.STATE_AVAILABLE); } mapList.add(map); } return mapList; }
RedPacketsServiceImpl implements IRedPacketsService { @Override public List<Map<String, Object>> selectAllByUserAccountId(Long accountId) { List<Map<String, Object>> mapList = new ArrayList<>(); List<RedPackets> list = mapper.selectByAccount(accountId); for (RedPackets r : list) { Map<String, Object> map = new HashMap<>(); map.put("id", r.getId()); map.put("name", r.getName()); map.put("userAccountId", r.getUserAccountId()); map.put("validDate", r.getValidDate()); map.put("overdueDate", r.getOverdueDate()); map.put("usePrice", r.getUsePrice()); map.put("worth", r.getWorth()); Integer useState = r.getUseState(); map.put("useState", useState); if (overdue(r)) { map.put("overdue", Settings.RED_PACKET_overdue); } else { map.put("overdue", Settings.RED_PACKET_overdue_not); } if (useState == Settings.RED_PACKET_USE_STATE_USED || overdue(r)) { map.put("usable", Settings.STATE_DISABLE); } else { map.put("usable", Settings.STATE_AVAILABLE); } mapList.add(map); } return mapList; } }
RedPacketsServiceImpl implements IRedPacketsService { @Override public List<Map<String, Object>> selectAllByUserAccountId(Long accountId) { List<Map<String, Object>> mapList = new ArrayList<>(); List<RedPackets> list = mapper.selectByAccount(accountId); for (RedPackets r : list) { Map<String, Object> map = new HashMap<>(); map.put("id", r.getId()); map.put("name", r.getName()); map.put("userAccountId", r.getUserAccountId()); map.put("validDate", r.getValidDate()); map.put("overdueDate", r.getOverdueDate()); map.put("usePrice", r.getUsePrice()); map.put("worth", r.getWorth()); Integer useState = r.getUseState(); map.put("useState", useState); if (overdue(r)) { map.put("overdue", Settings.RED_PACKET_overdue); } else { map.put("overdue", Settings.RED_PACKET_overdue_not); } if (useState == Settings.RED_PACKET_USE_STATE_USED || overdue(r)) { map.put("usable", Settings.STATE_DISABLE); } else { map.put("usable", Settings.STATE_AVAILABLE); } mapList.add(map); } return mapList; }  }
RedPacketsServiceImpl implements IRedPacketsService { @Override public List<Map<String, Object>> selectAllByUserAccountId(Long accountId) { List<Map<String, Object>> mapList = new ArrayList<>(); List<RedPackets> list = mapper.selectByAccount(accountId); for (RedPackets r : list) { Map<String, Object> map = new HashMap<>(); map.put("id", r.getId()); map.put("name", r.getName()); map.put("userAccountId", r.getUserAccountId()); map.put("validDate", r.getValidDate()); map.put("overdueDate", r.getOverdueDate()); map.put("usePrice", r.getUsePrice()); map.put("worth", r.getWorth()); Integer useState = r.getUseState(); map.put("useState", useState); if (overdue(r)) { map.put("overdue", Settings.RED_PACKET_overdue); } else { map.put("overdue", Settings.RED_PACKET_overdue_not); } if (useState == Settings.RED_PACKET_USE_STATE_USED || overdue(r)) { map.put("usable", Settings.STATE_DISABLE); } else { map.put("usable", Settings.STATE_AVAILABLE); } mapList.add(map); } return mapList; }  @Override List<Map<String, Object>> selectAllByUserAccountId(Long accountId); @Override boolean useRedPacket(Long AccountId, Long rpId); @Override RedPackets selectOne(Long accountId,Long rpId); boolean overdue(RedPackets r); }
RedPacketsServiceImpl implements IRedPacketsService { @Override public List<Map<String, Object>> selectAllByUserAccountId(Long accountId) { List<Map<String, Object>> mapList = new ArrayList<>(); List<RedPackets> list = mapper.selectByAccount(accountId); for (RedPackets r : list) { Map<String, Object> map = new HashMap<>(); map.put("id", r.getId()); map.put("name", r.getName()); map.put("userAccountId", r.getUserAccountId()); map.put("validDate", r.getValidDate()); map.put("overdueDate", r.getOverdueDate()); map.put("usePrice", r.getUsePrice()); map.put("worth", r.getWorth()); Integer useState = r.getUseState(); map.put("useState", useState); if (overdue(r)) { map.put("overdue", Settings.RED_PACKET_overdue); } else { map.put("overdue", Settings.RED_PACKET_overdue_not); } if (useState == Settings.RED_PACKET_USE_STATE_USED || overdue(r)) { map.put("usable", Settings.STATE_DISABLE); } else { map.put("usable", Settings.STATE_AVAILABLE); } mapList.add(map); } return mapList; }  @Override List<Map<String, Object>> selectAllByUserAccountId(Long accountId); @Override boolean useRedPacket(Long AccountId, Long rpId); @Override RedPackets selectOne(Long accountId,Long rpId); boolean overdue(RedPackets r);  }