File tree 3 files changed +7
-10
lines changed
spring-boot-jpa-hikari/src/main/java/com/springboot/springbootjpahikari
3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 4
4
import com .springboot .springbootjpahikari .repository .UserRepository ;
5
5
import org .springframework .beans .factory .annotation .Autowired ;
6
6
import org .springframework .data .domain .Sort ;
7
- import org .springframework .web .bind .annotation .DeleteMapping ;
8
- import org .springframework .web .bind .annotation .GetMapping ;
9
- import org .springframework .web .bind .annotation .PostMapping ;
10
- import org .springframework .web .bind .annotation .RestController ;
7
+ import org .springframework .web .bind .annotation .*;
11
8
12
9
import java .util .List ;
13
10
@@ -32,7 +29,7 @@ public List<UserModel> user() {
32
29
* @return
33
30
*/
34
31
@ PostMapping ("/user" )
35
- public UserModel user (UserModel user ) {
32
+ public UserModel user (@ RequestBody UserModel user ) {
36
33
return userRepository .save (user );
37
34
}
38
35
@@ -42,7 +39,7 @@ public UserModel user(UserModel user) {
42
39
* @return
43
40
*/
44
41
@ DeleteMapping ("/user" )
45
- public String deleteUserById (Long id ) {
42
+ public String deleteUserById (String id ) {
46
43
userRepository .deleteById (id );
47
44
return "success" ;
48
45
}
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ public class UserModel {
17
17
@ Id
18
18
@ GeneratedValue (generator = "paymentableGenerator" )
19
19
@ GenericGenerator (name = "paymentableGenerator" , strategy = "uuid" )
20
- @ Column (name ="ID" , nullable =false , length =36 )
21
- private Long id ;
20
+ @ Column (name ="ID" ,nullable =false ,length =36 )
21
+ private String id ;
22
22
@ Column (nullable = true , unique = true )
23
23
private String nickName ;
24
24
@ Column (nullable = false )
Original file line number Diff line number Diff line change 10
10
* @Version: 1.0
11
11
* @Desc:
12
12
*/
13
- public interface UserRepository extends JpaRepository <UserModel , Long > {
14
- UserModel getByIdIs (Long id );
13
+ public interface UserRepository extends JpaRepository <UserModel , String > {
14
+ UserModel getByIdIs (String id );
15
15
16
16
UserModel findByNickName (String nickName );
17
17
You can’t perform that action at this time.
0 commit comments