提交 3f6c4ad6 authored 作者: Matrix's avatar Matrix

update xdb

上级 439b22b1
...@@ -25,7 +25,7 @@ public class SdbUserController { ...@@ -25,7 +25,7 @@ public class SdbUserController {
private SdbUserMapper userMapper; private SdbUserMapper userMapper;
@GetMapping @GetMapping
public ResponseEntity findUsers(){ public ResponseEntity findUsers() {
return ResponseEntity.ok(userMapper.selectList(Wrappers.emptyWrapper())); return ResponseEntity.ok(userMapper.selectList(Wrappers.emptyWrapper()));
} }
......
...@@ -6,10 +6,7 @@ import com.matrix.md.xdb.entity.User; ...@@ -6,10 +6,7 @@ import com.matrix.md.xdb.entity.User;
import com.matrix.md.xdb.mapper.XdbUserMapper; import com.matrix.md.xdb.mapper.XdbUserMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -29,8 +26,14 @@ public class XdbUserController { ...@@ -29,8 +26,14 @@ public class XdbUserController {
private XdbUserMapper userMapper; private XdbUserMapper userMapper;
@GetMapping @GetMapping
public ResponseEntity<List<User>> findUsers(){ public ResponseEntity findUsers() {
return ResponseEntity.ok(userMapper.selectList(Wrappers.emptyWrapper())); return ResponseEntity.ok(userMapper.selectList(Wrappers.emptyWrapper()));
} }
@PostMapping
public ResponseEntity insertUsers(@RequestBody User user) {
int i = userMapper.insert(user);
return ResponseEntity.ok(i);
}
} }
...@@ -20,13 +20,13 @@ import lombok.experimental.Accessors; ...@@ -20,13 +20,13 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@TableName(value = "XUSER")
public class User implements Serializable { public class User implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO) private Long id;
private long id;
private Integer age; private Integer age;
......
package com.matrix.md.ydb.controller; package com.matrix.md.ydb.controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.matrix.md.ydb.entity.User;
import org.springframework.web.bind.annotation.RestController; import com.matrix.md.ydb.mapper.YdbUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/** /**
* <p> * <p>
...@@ -17,4 +20,18 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -17,4 +20,18 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/ydb/user") @RequestMapping("/ydb/user")
public class YdbUserController { public class YdbUserController {
@Autowired
private YdbUserMapper userMapper;
@GetMapping
public ResponseEntity findUsers() {
return ResponseEntity.ok(userMapper.selectList(Wrappers.emptyWrapper()));
}
@PostMapping
public ResponseEntity insertUsers(@RequestBody User user) {
int i = userMapper.insert(user);
return ResponseEntity.ok(i);
}
} }
...@@ -4,6 +4,7 @@ import java.io.Serializable; ...@@ -4,6 +4,7 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -19,11 +20,13 @@ import lombok.experimental.Accessors; ...@@ -19,11 +20,13 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@TableName(value = "YUSER")
public class User implements Serializable { public class User implements Serializable {
@TableId(type = IdType.AUTO)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long id;
private Integer age; private Integer age;
private String email; private String email;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论