Commit d7b6dcf4 authored by guozhipeng's avatar guozhipeng

数据库

parent b29b6d81
### Create Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Read Book
GET http://localhost:8080/odata/v4/BooksService/Books(abed2f7a-c50e-4bc5-89fd-9a00a54b4b16)
Accept: application/json
### Create another Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "fd0c5fda-8811-4e20-bcff-3a776abc290a",
"amount": 10
}
]
}
### Read Orders
GET http://localhost:8080/odata/v4/OrdersService/Orders
Accept: application/json
### Create Order 不添加验证
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Create Order 添加验证
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic authenticated:
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Create Order
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic klaus:pass_klaus
{
"items": [
{
"book_ID": "abed2f7a-c50e-4bc5-89fd-9a00a54b4b16",
"amount": 2
}
]
}
### Read Products
GET http://localhost:8080/odata/v4/AdminService/Products
Accept: application/json
Authorization: Basic sabine:pass_sabine
### Create Order as Mia
POST http://localhost:8080/odata/v4/OrdersService/Orders
Content-Type: application/json
Authorization: Basic mia:pass_mia
{
"items": [
{
"book_ID": "fd0c5fda-8811-4e20-bcff-3a776abc290a",
"amount": 10
}
]
}
### Read Orders as Klaus 您将看到自己的订单和项目
GET http://localhost:8080/odata/v4/OrdersService/OrderItems
Accept: application/json
Authorization: Basic klaus:pass_klaus
### Read Orders as Sabine (Administrator) 您将看不到任何项目
GET http://localhost:8080/odata/v4/OrdersService/Orders?$expand=items
Accept: application/json
Authorization: Basic sabine:pass_sabine
......@@ -39,9 +39,8 @@
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-hana</artifactId>
</dependency>
<dependency>
......@@ -53,10 +52,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-hana</artifactId>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
......@@ -126,7 +125,6 @@
<configuration>
<commands>
<command>build --for java</command>
<!--<command>deploy &#45;&#45;to h2 &#45;&#45;dry &#45;&#45;out "${project.basedir}/src/main/resources/schema-h2.sql"</command>-->
</commands>
</configuration>
</execution>
......
---
spring:
config.activate.on-profile: default
#sql.init.schema-locations: classpath:schema-h2.sql
cds:
data-source.auto-config.enabled: true
index-page.enabled: true
datasource:
auto-config.enabled: true
security:
mock:
users:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment