删除客户订单中的产品信息

pull/451/head
starrysky 2019-08-17 14:55:44 +08:00
parent ee08bb85bd
commit 41cf77b584
2 changed files with 16 additions and 1 deletions

View File

@ -16,8 +16,22 @@ public interface CustomerOrderProductRepository extends JpaRepository<CustomerOr
List<CustomerOrderProduct> findByCustomerOrderIdAndStatusTrue(Long customerOrderId); List<CustomerOrderProduct> findByCustomerOrderIdAndStatusTrue(Long customerOrderId);
/**
* codeid
* @param productCode
* @param customerOrderId
*/
@Modifying @Modifying
@Query(value = "delete s_customer_order_product where product_code = ?1 and customer_order = ?2", nativeQuery = true) @Query(value = "delete s_customer_order_product where product_code = ?1 and customer_order_id = ?2", nativeQuery = true)
void deleteByProductCodeAndCustomerOrderId(String productCode, Long customerOrderId); void deleteByProductCodeAndCustomerOrderId(String productCode, Long customerOrderId);
/**
*
* @param customerOrderId
*/
@Modifying
@Query(value = "update s_customer_order_product set status = 0 where customer_order_id = ?1", nativeQuery = true)
void deleteByCustomerOrderId(Long customerOrderId);
} }

View File

@ -168,5 +168,6 @@ public class CustomerOrderServiceImpl implements CustomerOrderService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Long id) { public void delete(Long id) {
customerOrderRepository.deleteCustomerOrder(id); customerOrderRepository.deleteCustomerOrder(id);
customerOrderProductRepository.deleteByCustomerOrderId(id);
} }
} }