|
@@ -1,6 +1,8 @@
|
|
package org.dromara.system.service.impl;
|
|
package org.dromara.system.service.impl;
|
|
|
|
|
|
|
|
+import lombok.SneakyThrows;
|
|
import org.dromara.common.core.domain.R;
|
|
import org.dromara.common.core.domain.R;
|
|
|
|
+import org.dromara.common.core.utils.ClassUtils;
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
@@ -11,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.dromara.system.domain.bo.RegisterParentsStudentBo;
|
|
import org.dromara.system.domain.bo.RegisterParentsStudentBo;
|
|
|
|
+import org.dromara.system.domain.bo.RegisterTeacherClassBo;
|
|
import org.dromara.system.domain.vo.RegisterParentsStudentVo;
|
|
import org.dromara.system.domain.vo.RegisterParentsStudentVo;
|
|
import org.dromara.system.mapper.RegisterParentsStudentMapper;
|
|
import org.dromara.system.mapper.RegisterParentsStudentMapper;
|
|
import org.dromara.system.service.IRegisterParentsStudentService;
|
|
import org.dromara.system.service.IRegisterParentsStudentService;
|
|
@@ -20,6 +23,7 @@ import org.dromara.system.domain.vo.RegisterParentsVo;
|
|
import org.dromara.system.domain.RegisterParents;
|
|
import org.dromara.system.domain.RegisterParents;
|
|
import org.dromara.system.mapper.RegisterParentsMapper;
|
|
import org.dromara.system.mapper.RegisterParentsMapper;
|
|
import org.dromara.system.service.IRegisterParentsService;
|
|
import org.dromara.system.service.IRegisterParentsService;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -81,7 +85,9 @@ public class RegisterParentsServiceImpl implements IRegisterParentsService {
|
|
/**
|
|
/**
|
|
* 新增注册-家长
|
|
* 新增注册-家长
|
|
*/
|
|
*/
|
|
|
|
+ @SneakyThrows
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public R<RegisterParentsVo> insertByBo(RegisterParentsBo bo) {
|
|
public R<RegisterParentsVo> insertByBo(RegisterParentsBo bo) {
|
|
|
|
|
|
//查询是否已经注册过
|
|
//查询是否已经注册过
|
|
@@ -97,6 +103,10 @@ public class RegisterParentsServiceImpl implements IRegisterParentsService {
|
|
}
|
|
}
|
|
bo.setCreateTime(DateUtils.getNowDate());
|
|
bo.setCreateTime(DateUtils.getNowDate());
|
|
bo.setUpdateTime(DateUtils.getNowDate());
|
|
bo.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
+ RegisterParents add = MapstructUtils.convert(bo, RegisterParents.class);
|
|
|
|
+ validEntityBeforeSave(add);
|
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
+ bo.setId(add.getId());
|
|
|
|
|
|
List<RegisterParentsStudentVo> registerParentsStudentList = bo.getRegisterParentsStudentList();
|
|
List<RegisterParentsStudentVo> registerParentsStudentList = bo.getRegisterParentsStudentList();
|
|
if(registerParentsStudentList!=null && registerParentsStudentList.size()>0){
|
|
if(registerParentsStudentList!=null && registerParentsStudentList.size()>0){
|
|
@@ -107,17 +117,15 @@ public class RegisterParentsServiceImpl implements IRegisterParentsService {
|
|
registerParentsStudent.setCreateTime(DateUtils.getNowDate());
|
|
registerParentsStudent.setCreateTime(DateUtils.getNowDate());
|
|
registerParentsStudent.setUpdateTime(DateUtils.getNowDate());
|
|
registerParentsStudent.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
|
- RegisterParentsStudentBo registerParentsStudentBo = MapstructUtils.convert(registerParentsStudent, RegisterParentsStudentBo.class);
|
|
|
|
|
|
+ RegisterParentsStudentBo registerParentsStudentBo = new RegisterParentsStudentBo();
|
|
|
|
+ ClassUtils.copyProperties(registerParentsStudent, registerParentsStudentBo);
|
|
registerParentsStudentService.insertByBo(registerParentsStudentBo);
|
|
registerParentsStudentService.insertByBo(registerParentsStudentBo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- RegisterParents add = MapstructUtils.convert(bo, RegisterParents.class);
|
|
|
|
- validEntityBeforeSave(add);
|
|
|
|
- boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
if (flag) {
|
|
if (flag) {
|
|
bo.setId(add.getId());
|
|
bo.setId(add.getId());
|
|
- R.ok();
|
|
|
|
|
|
+ return R.ok();
|
|
}
|
|
}
|
|
return R.fail();
|
|
return R.fail();
|
|
}
|
|
}
|