| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; |
| | | import com.dsh.account.service.TStudentService; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements TStudentService { |
| | | |
| | | @Override |
| | | public void addStuOfAppUser(StuDetailsReq stu,Integer appUserId) { |
| | | TStudent student = new TStudent(); |
| | | student.setAppUserId(appUserId); |
| | | student.setName(stu.getName()); |
| | | student.setHeadImg(stu.getHeadImg()); |
| | | student.setPhone(stu.getPhone()); |
| | | student.setSex(stu.getSex()); |
| | | student.setIdCard(stu.getIdCard()); |
| | | student.setBirthday(new Date(stu.getBirthday())); |
| | | student.setHeight(stu.getHeight()); |
| | | student.setWeight(stu.getWeight()); |
| | | BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight()); |
| | | BigDecimal multiply = bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())).multiply(bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight()))); |
| | | multiply.setScale(2); |
| | | student.setBmi(multiply.doubleValue()); |
| | | student.setInsertTime(new Date()); |
| | | student.setState(1); |
| | | this.baseMapper.insert(student); |
| | | } |
| | | } |