public List<PromotionDto> getListPromotionDto(Map map) { PromotionPriceMapper promotionPriceMapper = (PromotionPriceMapper) SpringContextUtil.getBean("promotionPriceMapper"); List<PromotionPrice> list = promotionPriceMapper.getPromotionPriceList(map); List<PromotionDto> dtoList = new ArrayList<PromotionDto>(); if (map == null) { map = new HashMap(); } for (PromotionPrice temp : list) { PromotionDto dto = BeanMapper.map(temp, PromotionDto.class); map.clear(); map.put("commodityid", dto.getPromotionid()); dto.setCommodity(mapper.getSimpleCommodityDtoList(map).get(0)); dtoList.add(dto); } return dtoList; }
public List<UserDto> getListUserDto(Map map) { UsersMapper usersMapper = (UsersMapper) SpringContextUtil.getBean("usersMapper"); UserAddressMapper userAddressMapper = (UserAddressMapper) SpringContextUtil.getBean("userAddressMapper"); List<Users> list = usersMapper.getUsersList(map); List<UserDto> dtoList = new ArrayList<UserDto>(); if (map == null) { map = new HashMap(); } for (Users temp : list) { UserDto dto = BeanMapper.map(temp, UserDto.class); map.clear(); map.put("useraddressid", temp.getUseraddressid()); // 可能需要进行修改 dto.setUserAddress(userAddressMapper.getUserAddressList(map)); // 可能需要进行修改 dtoList.add(dto); } return dtoList; }
public List<UserDiscountDto> getListUserDiscountDto(Map map) { UserDiscountMapper userDiscountMapper = (UserDiscountMapper) SpringContextUtil.getBean("userDiscountMapper"); CommodityTypeMapper commodityTypeMapper = (CommodityTypeMapper) SpringContextUtil.getBean("commodityTypeMapper"); List<UserDiscount> list = userDiscountMapper.getUserDiscountList(map); List<UserDiscountDto> dtoList = new ArrayList<UserDiscountDto>(); if (map == null) { map = new HashMap(); } for (UserDiscount temp : list) { UserDiscountDto dto = BeanMapper.map(temp, UserDiscountDto.class); map.clear(); map.put("commodityid", temp.getCommodityid()); List<SimpleCommodityDto> SimpleCommoditydtolist = mapper.getSimpleCommodityDtoList(map); if (!SimpleCommoditydtolist.isEmpty()) { dto.setCommodity(SimpleCommoditydtolist.get(0)); dto.setType(commodityTypeMapper.getCommodityTypeById(temp.getTypeid())); dtoList.add(dto); } } return dtoList; }