这一篇博文应该在在7月3日左右开始写,由于考试周+赶进度的原因,拖到了这个时期,其实是非常不应该的,这里先进行一下自省吧
实体集entity
package com.sdu.postgraduate.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
@Entity
public class Teacher {
@Id
private Integer teaId;
private String teaName;
private String teaGender;
private Date teaBirthday;
private Integer teaTelNum;
private String mailAddress;
private String position;
private String highestEdu;
private String finalEdu;
private Date teaDocTime;
private Date teaMasterTime;
private String teaDname;
private String personIntro;
private String searchDirection;
private String workAddress;
private byte[] teaPhoto;
public Integer getTeaId() {
return teaId;
}
public void setTeaId(Integer teaId) {
this.teaId = teaId;
}
public String getTeaName() {
return teaName;
}
public void setTeaName(String teaName) {
this.teaName = teaName == null ? null : teaName.trim();
}
public String getTeaGender() {
return teaGender;
}
public void setTeaGender(String teaGender) {
this.teaGender = teaGender == null ? null : teaGender.trim();
}
public Date getTeaBirthday() {
return teaBirthday;
}
public void setTeaBirthday(Date teaBirthday) {
this.teaBirthday = teaBirthday;
}
public Integer getTeaTelNum() {
return teaTelNum;
}
public void setTeaTelNum(Integer teaTelNum) {
this.teaTelNum = teaTelNum;
}
public String getMailAddress() {
return mailAddress;
}
public void setMailAddress(String mailAddress) {
this.mailAddress = mailAddress == null ? null : mailAddress.trim();
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position == null ? null : position.trim();
}
public String getHighestEdu() {
return highestEdu;
}
public void setHighestEdu(String highestEdu) {
this.highestEdu = highestEdu == null ? null : highestEdu.trim();
}
public String getFinalEdu() {
return finalEdu;
}
public void setFinalEdu(String finalEdu) {
this.finalEdu = finalEdu == null ? null : finalEdu.trim();
}
public Date getTeaDocTime() {
return teaDocTime;
}
public void setTeaDocTime(Date teaDocTime) {
this.teaDocTime = teaDocTime;
}
public Date getTeaMasterTime() {
return teaMasterTime;
}
public void setTeaMasterTime(Date teaMasterTime) {
this.teaMasterTime = teaMasterTime;
}
public String getTeaDname() {
return teaDname;
}
public void setTeaDname(String teaDname) {
this.teaDname = teaDname == null ? null : teaDname.trim();
}
public String getPersonIntro() {
return personIntro;
}
public void setPersonIntro(String personIntro) {
this.personIntro = personIntro == null ? null : personIntro.trim();
}
public String getSearchDirection() {
return searchDirection;
}
public void setSearchDirection(String searchDirection) {
this.searchDirection = searchDirection == null ? null : searchDirection.trim();
}
public String getWorkAddress() {
return workAddress;
}
public void setWorkAddress(String workAddress) {
this.workAddress = workAddress == null ? null : workAddress.trim();
}
public byte[] getTeaPhoto() {
return teaPhoto;
}
public void setTeaPhoto(byte[] teaPhoto) {
this.teaPhoto = teaPhoto;
}
}
dao包中的接口
package com.sdu.postgraduate.dao;
import com.sdu.postgraduate.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@Mapper
public interface TeacherMapper {
int deleteByPrimaryKey(Integer teaId);
int insert(Teacher record);
int insertSelective(Teacher record);
Teacher selectByPrimaryKey(Integer teaId);
int updateByPrimaryKeySelective(Teacher record);
int updateByPrimaryKeyWithBLOBs(Teacher record);
int updateByPrimaryKey(Teacher record);
List<Teacher> selective(Teacher record);
}
controller包中的查询
@RestController
@RequestMapping(value = "/teacher")
public class TeacherController {
@Resource
private TeacherService teacherService;
@RequestMapping("/test")
public Result test(@RequestBody Map<String, Object> request) {
int tea_id = (int) request.get("tea_id");
return Result.succ(teacherService.selectTeacherByPrimaryKey(tea_id));
}
}
教师查询:
/**
* 教师查询:
* 根据包含查询条件的对象teacher加载教师列表
* 空对象则为全部导师
* @param request
* @return
*/
@RequestMapping("/loadTeacher")
public Result LoadTeacher(@RequestBody Map<String, Object> request) {
Integer tea_id = (Integer) request.get("tea_id");
String tea_name = (String) request.get("teaName");
String search_direction = (String) request.get("searchDirection");
String tea_dname = (String) request.get("teaDname");
// List<Student> stu = teacherService.loadStudent(tea_id);
Teacher a = new Teacher();
if(tea_id!=null)
a.setTeaId(tea_id);
if(!tea_name.equals(""))
a.setTeaName(tea_name);
if(!search_direction.equals(""))
a.setSearchDirection(search_direction);
if(!tea_dname.equals(""))
a.setTeaDname(tea_dname);
// return Result.succ(a);
return Result.succ(teacherService.loadTeacher(a));
}
service包中的查询
/**
* 教师查询:
* 根据包含查询条件的对象teacher加载教师列表
* 空对象则为全部导师
* @param request
* @return
*/
@RequestMapping("/loadTeacher")
public Result LoadTeacher(@RequestBody Map<String, Object> request) {
Integer tea_id = (Integer) request.get("tea_id");
String tea_name = (String) request.get("teaName");
String search_direction = (String) request.get("searchDirection");
String tea_dname = (String) request.get("teaDname");
// List<Student> stu = teacherService.loadStudent(tea_id);
Teacher a = new Teacher();
if(tea_id!=null)
a.setTeaId(tea_id);
if(!tea_name.equals(""))
a.setTeaName(tea_name);
if(!search_direction.equals(""))
a.setSearchDirection(search_direction);
if(!tea_dname.equals(""))
a.setTeaDname(tea_dname);
// return Result.succ(a);
return Result.succ(teacherService.loadTeacher(a));
}
这大概就是当时写的一些内容了