StudentRepository.java 1.5 KB
Newer Older
7
7wc98#14 已提交
1 2 3 4 5 6 7 8 9 10 11
//IntelliJ IDEA
//campus
//DataController
//2020/5/4
// Author:御承扬
//E-mail:2923616405@qq.com

package com.pyc.campus.dao;

import com.pyc.campus.domain.Student;
import org.springframework.data.jpa.repository.JpaRepository;
7
Update  
7wc98#14 已提交
12 13 14
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
7
7wc98#14 已提交
15

7
Update  
7wc98#14 已提交
16 17
import java.util.List;

7
7wc98#14 已提交
18 19
public interface StudentRepository extends JpaRepository<Student,Long> {
    Student findPasswordByStudentID(String studentID);
7
Update  
7wc98#14 已提交
20
    Student findNameByStudentID(String studentID);
7
Update  
7wc98#14 已提交
21
    Student findAllByStudentID(String studentID);
7
Update  
7wc98#14 已提交
22 23 24 25
    @Modifying
    @Transactional
    @Query("update Student s set s.name=?1,s.weChat=?2, s.QQ=?3 where s.studentID=?4")
    int update(String name, String WeChat, String QQ, String studentID);
7
Update  
7wc98#14 已提交
26 27 28 29
    @Modifying
    @Transactional
    @Query("update Student s set s.password=?1 where s.studentID=?2")
    int saveChangePWD(String password, String studentID);
7
modify  
7wc98#14 已提交
30 31 32 33
    @Modifying
    @Transactional
    @Query("update Student s set s.onlineStatus=?1 where s.studentID=?2")
    void setOnlineStatus(Boolean onlineStatus, String studentID);
7
Update  
7wc98#14 已提交
34 35 36 37 38 39 40 41 42
    // 根据Student ID前缀查询
    @Modifying
    @Transactional
    @Query("select s from Student s where s.studentID like ?1")
    List<Student> query01(String classPrefix);
    @Modifying
    @Transactional
    @Query("delete from Student  where studentID=?1")
    void delByStudentID(String studentId);
7
7wc98#14 已提交
43
}