教师修改,改成只是更新页面对应的4个字段值,不更改其它的值

This commit is contained in:
daihh
2023-01-03 12:42:47 +08:00
parent 85fba1a549
commit f63025e9bc

View File

@@ -23,6 +23,7 @@ import com.xboe.constants.Constants;
import com.xboe.core.exception.XaskException;
import com.xboe.core.orm.FieldFilters;
import com.xboe.core.orm.QueryBuilder;
import com.xboe.core.orm.UpdateBuilder;
import com.xboe.module.teacher.dao.TeacherDao;
import com.xboe.module.teacher.dto.TeacherSyncUpdateDto;
import com.xboe.module.teacher.entity.Teacher;
@@ -208,12 +209,20 @@ public class TeacherServiceImpl implements ITeacherService {
@Override
@Transactional
public void updateTeacher(TeacherFiledVo entity) {
Teacher teacher = dao.get(entity.getId());
teacher.setPhoto(entity.getPhoto());
teacher.setWorkExperience(entity.getWorkExperience());
teacher.setCourses(entity.getCourses());
teacher.setExpertise(entity.getExpertise());
dao.update(teacher);
// Teacher teacher = dao.get(entity.getId());
// teacher.setPhoto(entity.getPhoto());
// teacher.setWorkExperience(entity.getWorkExperience());
// teacher.setCourses(entity.getCourses());
// teacher.setExpertise(entity.getExpertise());
// dao.update(teacher);
//修改为以下方式,不影响其它字段的
dao.updateMultiFieldById(entity.getId(),
UpdateBuilder.create("photo", entity.getPhoto()),
UpdateBuilder.create("workExperience", entity.getWorkExperience()),
UpdateBuilder.create("courses", entity.getCourses()),
UpdateBuilder.create("expertise", entity.getExpertise())
);
}
@Override