mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-WebAPi.git
synced 2026-04-01 23:14:51 +00:00
feature(demo): 新增查询学生表
This commit is contained in:
parent
d6c06d1f06
commit
b2960541ba
4 changed files with 15 additions and 0 deletions
|
|
@ -52,4 +52,9 @@ public class DemoController {
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/search")
|
||||
public List<Student> searchById(@RequestParam int id) {
|
||||
return studentService.findById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,6 @@ public interface StudentMapper {
|
|||
List<Student> findAll();
|
||||
|
||||
void insert(Student student);
|
||||
|
||||
List<Student> findById(int id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,8 @@ public class StudentService {
|
|||
studentMapper.insert(student);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<Student> findById(int id) {
|
||||
return studentMapper.findById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,8 @@
|
|||
#{name}, #{email}, #{phone}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="findById" resultType="Student" parameterType="int">
|
||||
SELECT * FROM student WHERE id=#{id};
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in a new issue