示例代码:
/** * 如果barCode字段值为null则不处理 * 如果barCode字段值不为null则在原本值的前面拼接 del: * @param dealer * @return */ @Modifying @Transactional @Query("update Dealer d set " + " d.deleteFlag = 1 ," + " d.barCode = CASE WHEN d.barCode IS NULL THEN d.barCode ELSE CONCAT('del:',d.barCode) END , " + " d.outerId = CASE WHEN d.outerId IS NULL THEN d.outerId ELSE CONCAT('del:',d.outerId) END " + " where d.uid = :#{#dealer.uid}") int fakeDelete(@Param("dealer") Dealer dealer);