|
@@ -6,6 +6,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.module.organization.dto.UserStudentAddDto;
|
|
import com.xjrsoft.module.organization.dto.UserStudentAddDto;
|
|
|
import com.xjrsoft.module.organization.dto.UserStudentDeleteDto;
|
|
import com.xjrsoft.module.organization.dto.UserStudentDeleteDto;
|
|
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
import com.xjrsoft.module.organization.entity.UserStudent;
|
|
import com.xjrsoft.module.organization.entity.UserStudent;
|
|
|
import com.xjrsoft.module.organization.mapper.UserStudentMapper;
|
|
import com.xjrsoft.module.organization.mapper.UserStudentMapper;
|
|
|
import com.xjrsoft.module.organization.service.IUserStudentService;
|
|
import com.xjrsoft.module.organization.service.IUserStudentService;
|
|
@@ -23,9 +24,10 @@ public class UserStudentServiceImpl extends MPJBaseServiceImpl<UserStudentMapper
|
|
|
public boolean add(UserStudentAddDto dto) {
|
|
public boolean add(UserStudentAddDto dto) {
|
|
|
long count = count(Wrappers.<UserStudent>query().lambda()
|
|
long count = count(Wrappers.<UserStudent>query().lambda()
|
|
|
.eq(UserStudent::getUserId, dto.getUserId())
|
|
.eq(UserStudent::getUserId, dto.getUserId())
|
|
|
- .eq(UserStudent::getStudentId, dto.getStudentId()));
|
|
|
|
|
|
|
+ .eq(UserStudent::getStudentId, dto.getStudentId())
|
|
|
|
|
+ );
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
|
- throw new MyException("已经绑定了学生,不能出重复绑定");
|
|
|
|
|
|
|
+ throw new MyException("已经绑定了该学生,不能出重复绑定");
|
|
|
}
|
|
}
|
|
|
UserStudent userStudent = BeanUtil.toBean(dto, UserStudent.class);
|
|
UserStudent userStudent = BeanUtil.toBean(dto, UserStudent.class);
|
|
|
userStudentMapper.insert(userStudent);
|
|
userStudentMapper.insert(userStudent);
|