parent
d210573d63
commit
df519e7868
|
|
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("adminapi/major")
|
||||
@RequestMapping("frontapi/major")
|
||||
@Api(tags = "专业管理")
|
||||
public class MajorController {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.front.service.IStudentInfoService;
|
||||
import com.mdd.front.validate.student.PreRegistrationStudentInfoValidate;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("frontapi/student")
|
||||
@Api(tags = "学生信息")
|
||||
public class StudentInfoController {
|
||||
|
||||
@Resource
|
||||
private IStudentInfoService IStudentInfoService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增预报名学生信息")
|
||||
public AjaxResult<Object> addPreRegistrationStudentInfo(@Validated @RequestBody PreRegistrationStudentInfoValidate studentInfoValidate) {
|
||||
return IStudentInfoService.add(studentInfoValidate);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.entity.StudentInfo;
|
||||
import com.mdd.front.validate.student.PreRegistrationStudentInfoValidate;
|
||||
|
||||
public interface IStudentInfoService extends IService<StudentInfo> {
|
||||
AjaxResult<Object> add(PreRegistrationStudentInfoValidate studentInfoValidate);
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.mdd.front.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import com.mdd.common.entity.StudentBaseInfo;
|
||||
import com.mdd.common.entity.StudentInfo;
|
||||
import com.mdd.common.mapper.StudentBaseInfoMapper;
|
||||
import com.mdd.common.mapper.StudentInfoMapper;
|
||||
import com.mdd.front.service.IStudentInfoService;
|
||||
import com.mdd.front.validate.student.PreRegistrationStudentInfoValidate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class StudentServiceImpl extends ServiceImpl<StudentInfoMapper, StudentInfo> implements IStudentInfoService {
|
||||
|
||||
@Resource
|
||||
private StudentBaseInfoMapper studentBaseInfoMapper;
|
||||
@Resource
|
||||
private StudentInfoMapper studentInfoMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult<Object> add(PreRegistrationStudentInfoValidate studentInfoValidate) {
|
||||
StudentInfo studentInfo = new StudentInfo();
|
||||
BeanUtils.copyProperties(studentInfoValidate, studentInfo);
|
||||
|
||||
StudentBaseInfo studentBaseInfo = new StudentBaseInfo();
|
||||
BeanUtils.copyProperties(studentInfoValidate, studentBaseInfo);
|
||||
|
||||
// 根据身份证号查询该学生是否已经提交过信息
|
||||
String idCard = studentInfoValidate.getIdCard();
|
||||
StudentBaseInfo baseInfo = studentBaseInfoMapper.selectOne(new QueryWrapper<StudentBaseInfo>().eq("id_card", idCard));
|
||||
// 编辑
|
||||
if (null != baseInfo) {
|
||||
Long studentId = baseInfo.getStudentId();
|
||||
Long studentBaseId = baseInfo.getStudentBaseId();
|
||||
|
||||
studentInfo.setStudentId(studentId);
|
||||
studentBaseInfo.setStudentBaseId(studentBaseId);
|
||||
|
||||
studentInfoMapper.updateById(studentInfo);
|
||||
studentBaseInfoMapper.updateById(studentBaseInfo);
|
||||
}
|
||||
// 新增
|
||||
else {
|
||||
// 学生学业信息入库
|
||||
BeanUtils.copyProperties(studentInfoValidate, studentInfo);
|
||||
studentInfoMapper.insert(studentInfo);
|
||||
|
||||
// 学生基本信息入库
|
||||
BeanUtils.copyProperties(studentInfoValidate, studentBaseInfo);
|
||||
studentBaseInfo.setStudentId(studentInfo.getStudentId());
|
||||
studentBaseInfoMapper.insert(studentBaseInfo);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.mdd.front.validate.student;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel("预报名学生信息参数")
|
||||
public class PreRegistrationStudentInfoValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private Integer gender;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty(value = "毕业院校")
|
||||
private String previousSchool;
|
||||
|
||||
@ApiModelProperty(value = "中考成绩")
|
||||
private BigDecimal highSchoolScore;
|
||||
|
||||
@ApiModelProperty(value = "身高")
|
||||
private BigDecimal height;
|
||||
|
||||
@ApiModelProperty(value = "体重")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ApiModelProperty(value = "鞋码")
|
||||
private BigDecimal shoeSize;
|
||||
|
||||
@ApiModelProperty(value = "专业id")
|
||||
private Integer majorId;
|
||||
|
||||
@ApiModelProperty(value = "招生老师")
|
||||
private Integer recruitmentTeacherId;
|
||||
|
||||
@ApiModelProperty(value = "接待老师")
|
||||
private Integer receptionTeacherId;
|
||||
|
||||
@ApiModelProperty(value = "预报名金额")
|
||||
private BigDecimal preRegistrationAmount;
|
||||
}
|
||||
Loading…
Reference in New Issue