TODO: 用户订单管理

This commit is contained in:
myh 2023-11-12 19:38:15 +08:00
parent e646df6582
commit b211f6ebe5
2 changed files with 21 additions and 9 deletions

View File

@ -2,12 +2,17 @@ package com.example.springdemo.service;
import com.example.springdemo.entities.Orders;
import java.util.List;
public interface OrdersService {
Orders addIndent(Orders orders);
Orders addOrder(Orders order);
void deleteIndentById(Long id);
void deleteOrderById(Long orderId);
Orders updateIndent(Orders orders);
Orders updateOrder(Orders order);
Iterable<Orders> findAllIndents();
List<Orders> findAllOrders();
//TODO: 用户订单管理
List<Orders> findOrdersByUserId(Long userId);
}

View File

@ -5,28 +5,35 @@ import com.example.springdemo.entities.Orders;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OrdersServiceImpl implements OrdersService {
@Resource
private OrdersRepository ordersRepository;
@Override
public Orders addIndent(Orders orders) {
public Orders addOrder(Orders orders) {
return ordersRepository.save(orders);
}
@Override
public void deleteIndentById(Long id) {
ordersRepository.deleteById(id);
public void deleteOrderById(Long orderId) {
ordersRepository.deleteById(orderId);
}
@Override
public Orders updateIndent(Orders orders) {
public Orders updateOrder(Orders orders) {
return ordersRepository.save(orders);
}
@Override
public Iterable<Orders> findAllIndents() {
public List<Orders> findAllOrders() {
return ordersRepository.findAll();
}
@Override
public List<Orders> findOrdersByUserId(Long userId) {
return null;
}
}