SpringDataJpa的框架没有线程的更新方法,只能调用save()方法实行保存,如果是只更新一处的话,这个也不太适用。所以楼主尝试着自定义sql语句来写。

service层

 

@Override
public int updateStateById(Integer wid) {
return orderMapper.updateStateById(wid);
}

Mapper
@Transactional//事务的注解
@Modifying//增删改必须有这个注解
@Query(value = "update work_order set last_reply =:lestReply where id = :id",nativeQuery = true)
int updateContextById(Integer id, String lestReply);

就可以实现自定义update了。

相关文章:

  • 2022-01-22
  • 2022-12-23
  • 2021-04-21
  • 2021-10-09
  • 2021-12-24
  • 2022-12-23
  • 2021-07-21
  • 2022-01-05
猜你喜欢
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-09-21
相关资源
相似解决方案