|
@@ -0,0 +1,26 @@
|
|
|
+package com.example.user.controller;
|
|
|
+
|
|
|
+import com.example.user.domain.Details;
|
|
|
+import com.example.user.domain.User;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/details")
|
|
|
+@Api("详情接口")
|
|
|
+public class DetailsController {
|
|
|
+ @Autowired
|
|
|
+ MongoTemplate mongoTemplate;
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ApiOperation("新增详情")
|
|
|
+ public Details add(@Validated @RequestBody Details details){
|
|
|
+ return mongoTemplate.insert( details );
|
|
|
+ }
|
|
|
+}
|