spring boot的service层的update的实现

@Transactional
@Override
public Type updateType(Long id, Type type) {
     
    Type t=typeRepository.findOne(id);
    if(t ==null ){
     
        throw new NotFoundException("资源找不到");
    }
    BeanUtils.copyProperties(type,t);
    return  typeRepository.save(t);

 }

你可能感兴趣的:(java)