コード例 #1
0
 @Override
 public User update(User entity) {
   log.info("Updating ... {}", entity);
   UserEntity usrEntity = modelMapper.map(entity, UserEntity.class);
   userRepo.save(usrEntity);
   return modelMapper.map(usrEntity, User.class);
 }
コード例 #2
0
 @Override
 public User create(User entity) {
   log.info("Saving... {}", entity);
   UserEntity usrEntity = modelMapper.map(entity, UserEntity.class);
   usrEntity.setCreateDate(LocalDateTime.now());
   userRepo.save(usrEntity);
   return modelMapper.map(usrEntity, User.class);
 }
コード例 #3
0
 @Override
 @Transactional(readOnly = true)
 public List<User> getAllUsers() {
   List<User> lstUsers = new ArrayList<>();
   userRepo
       .findAll()
       .forEach(
           usr -> {
             lstUsers.add(modelMapper.map(usr, User.class));
           });
   return lstUsers;
 }
コード例 #4
0
 @Override
 @Transactional(readOnly = true)
 public User getById(Long id) {
   return modelMapper.map(userRepo.findOne(id), User.class);
 }
コード例 #5
0
 @Override
 public void delete(Long id) {
   userRepo.delete(id);
 }