关于python:Mybatis动态SQL

56次阅读

共计 3091 个字符,预计需要花费 8 分钟才能阅读完成。

package cn.yyj1.entity;
public class StudentInfo {

private String studentid;
private String studentName;
private String studentSex;
private String studentPhone;
private String studentAddress;
private int  studentAge;
private int  stuclassid;
// 公有的  类型  名字
// 只有空的构造方法  能力查到 className 的信息
private ClassInfo classInfo;
public String getStudentid() {return studentid;}
public void setStudentid(String studentid) {this.studentid = studentid;}
public String getStudentName() {return studentName;}
public void setStudentName(String studentName) {this.studentName = studentName;}
public String getStudentSex() {return studentSex;}
public void setStudentSex(String studentSex) {this.studentSex = studentSex;}
public String getStudentPhone() {return studentPhone;}
public void setStudentPhone(String studentPhone) {this.studentPhone = studentPhone;}
public String getStudentAddress() {return studentAddress;}
public void setStudentAddress(String studentAddress) {this.studentAddress = studentAddress;}
public int getStudentAge() {return studentAge;}
public void setStudentAge(int studentAge) {this.studentAge = studentAge;}
public int getStuclassid() {return stuclassid;}
public void setStuclassid(int stuclassid) {this.stuclassid = stuclassid;}
public ClassInfo getClassInfo() {return classInfo;}
public void setClassInfo(ClassInfo classInfo) {this.classInfo = classInfo;}
public StudentInfo(String studentid, String studentName, String studentSex, String studentPhone, String studentAddress, int studentAge, int stuclassid, ClassInfo classInfo) {
    this.studentid = studentid;
    this.studentName = studentName;
    this.studentSex = studentSex;
    this.studentPhone = studentPhone;
    this.studentAddress = studentAddress;
    this.studentAge = studentAge;
    this.stuclassid = stuclassid;
    this.classInfo = classInfo;
}
public StudentInfo(String studentName, String studentSex, String studentPhone, String studentAddress, int studentAge, int stuclassid, ClassInfo classInfo) {
    this.studentName = studentName;
    this.studentSex = studentSex;
    this.studentPhone = studentPhone;
    this.studentAddress = studentAddress;
    this.studentAge = studentAge;
    this.stuclassid = stuclassid;
    this.classInfo = classInfo;
}
public StudentInfo() {}

}
package cn.yyj1.mapper;
import cn.yyj1.entity.ClassInfo;
import cn.yyj1.entity.StudentInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface StudentInfoMapper {

// 依据班级编号查问所属班级的所有学生信息  id 班级编号   所属这个班级的学生
public List<StudentInfo> findStuByClassId(int id);
// 依据班级编号查问班级信息 id [货币代码](https://www.gendan5.com/currencycode.html) 班级信息 班级信息
public ClassInfo findClassByClassId(int id);
// 依据班级编号查问所属姓名的学生
public  List<StudentInfo> findStudNameByClassId(@Param("stuclassid") int stuclassid, @Param("studentName") String studentName);
// 依据 ID 批改学生信息
public  int update (StudentInfo si);
public StudentInfo findStudentById(String id);
// 依据数组查问所有学生信息 定义数组 int [] array
public  List<StudentInfo> findStudentByArray(int [] array);
// 依据汇合查学生信息
public  List<StudentInfo> findStudentByList(List<StudentInfo> list);
// 依据 Map 查问
public  List<StudentInfo> findStudentByMap(Map<String,Object> map);
//Choose
public  List<StudentInfo> findStudentByChoose(@Param("studentName")String studentName,@Param("studentAge")int studentAge,@Param("stuclassid")int stuclassid);
// 分页
public  List<StudentInfo> findStudentByPage(@Param("pageSize")int pageSize,@Param("pageCode")int pageCode);

}

正文完
 0