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 @@ ...@@ -39,9 +39,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.sap.cds</groupId>
<artifactId>h2</artifactId> <artifactId>cds-feature-hana</artifactId>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -53,10 +52,10 @@ ...@@ -53,10 +52,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<!-- Lombok -->
<dependency> <dependency>
<groupId>com.sap.cds</groupId> <groupId>org.projectlombok</groupId>
<artifactId>cds-feature-hana</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
...@@ -126,7 +125,6 @@ ...@@ -126,7 +125,6 @@
<configuration> <configuration>
<commands> <commands>
<command>build --for java</command> <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> </commands>
</configuration> </configuration>
</execution> </execution>
......
--- ---
spring: spring:
config.activate.on-profile: default config.activate.on-profile: default
#sql.init.schema-locations: classpath:schema-h2.sql
cds: cds:
data-source.auto-config.enabled: true index-page.enabled: true
datasource:
auto-config.enabled: true
security: security:
mock: mock:
users: 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