public void save() { UsersMapper mapper = (UsersMapper) SpringContextUtil.getBean("usersMapper"); mapper.add(this); this.setUseraddressid(this.getUserid()); this.setMembership(this.getUserid()); mapper.update(this); }
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; }