软工日报(软件工程随笔)
今天完成了学习记录app的部分代码:
package com.hebei.studyapp.mapper;
import org.apache.catalina.User;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserMapper {
void insertUser(User user);
User getUserById(String userId);
}
package com.hebei.studyapp.controller;
import com.hebei.studyapp.service.UserService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/users")
public class UserController {
@Autowired
private UserService userService;
@PostMapping
public void registerUser(@RequestBody User user) {
userService.saveUser(user);
}
@GetMapping("/{studentId}")
public User getUserByStudentId(@PathVariable String studentId) {
return userService.getUserByStudentId(studentId);
}
}

浙公网安备 33010602011771号