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 com.example.springdemo.entities.Orders;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface OrdersService {
|
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 jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OrdersServiceImpl implements OrdersService {
|
public class OrdersServiceImpl implements OrdersService {
|
||||||
@Resource
|
@Resource
|
||||||
private OrdersRepository ordersRepository;
|
private OrdersRepository ordersRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Orders addIndent(Orders orders) {
|
public Orders addOrder(Orders orders) {
|
||||||
return ordersRepository.save(orders);
|
return ordersRepository.save(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteIndentById(Long id) {
|
public void deleteOrderById(Long orderId) {
|
||||||
ordersRepository.deleteById(id);
|
ordersRepository.deleteById(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Orders updateIndent(Orders orders) {
|
public Orders updateOrder(Orders orders) {
|
||||||
return ordersRepository.save(orders);
|
return ordersRepository.save(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Orders> findAllIndents() {
|
public List<Orders> findAllOrders() {
|
||||||
return ordersRepository.findAll();
|
return ordersRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Orders> findOrdersByUserId(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user