TODO: 用户订单管理
This commit is contained in:
parent
e646df6582
commit
b211f6ebe5
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user