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

update xdb

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