|
@@ -1527,13 +1527,32 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
|
|
|
}
|
|
|
|
|
|
private void addBindUnBindRecord(Long teacherId, Long tenantId, Boolean bind) {
|
|
|
- UserTenantBindRecord bindRecord = new UserTenantBindRecord();
|
|
|
- bindRecord.setUserId(teacherId);
|
|
|
- bindRecord.setUserType("TEACHER");
|
|
|
- bindRecord.setTenantId(tenantId);
|
|
|
- bindRecord.setBindStatus(bind);
|
|
|
- bindRecord.setBindTime(new Date());
|
|
|
- userTenantBindRecordService.save(bindRecord);
|
|
|
+ if (bind){
|
|
|
+ UserTenantBindRecord bindRecord = userTenantBindRecordService.lambdaQuery()
|
|
|
+ .eq(UserTenantBindRecord::getUserId, teacherId)
|
|
|
+ .eq(UserTenantBindRecord::getUserType, "TEACHER")
|
|
|
+ .eq(UserTenantBindRecord::getTenantId, tenantId).one();
|
|
|
+ if (bindRecord != null) {
|
|
|
+ bindRecord.setBindStatus(true);
|
|
|
+ bindRecord.setBindTime(new Date());
|
|
|
+ userTenantBindRecordService.updateById(bindRecord);
|
|
|
+ }else {
|
|
|
+ UserTenantBindRecord userTenantBindRecord = new UserTenantBindRecord();
|
|
|
+ userTenantBindRecord.setUserId(teacherId);
|
|
|
+ userTenantBindRecord.setUserType("TEACHER");
|
|
|
+ userTenantBindRecord.setTenantId(tenantId);
|
|
|
+ userTenantBindRecord.setBindStatus(true);
|
|
|
+ userTenantBindRecord.setBindTime(new Date());
|
|
|
+ userTenantBindRecordService.save(userTenantBindRecord);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ userTenantBindRecordService.lambdaUpdate()
|
|
|
+ .eq(UserTenantBindRecord::getUserId, teacherId)
|
|
|
+ .eq(UserTenantBindRecord::getUserType, "TEACHER")
|
|
|
+ .eq(UserTenantBindRecord::getTenantId, tenantId)
|
|
|
+ .set(UserTenantBindRecord::getBindStatus, false)
|
|
|
+ .update();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void sendBindUnBindSMS(Long userId, String phone, MessageTypeEnum messageType, Long tenantId) {
|