|
|
|
@ -137,29 +137,51 @@ public class TeacherOpenCourseKnowledgePointRelationService extends CoreBaseServ
|
|
|
|
|
String teacherOpenCourseKnowledgePointIdPlural = Objects.isNull(pointRelationQuery.getTeacherOpenCourseKnowledgePointIdPlural()) ? "" : pointRelationQuery.getTeacherOpenCourseKnowledgePointIdPlural();
|
|
|
|
|
String[] knowledgePointIdPlural = teacherOpenCourseKnowledgePointIdPlural.split(",");
|
|
|
|
|
|
|
|
|
|
//先解绑
|
|
|
|
|
List<TeacherOpenCourseKnowledgePointRelation> pointRelationList = sqlManager.lambdaQuery(TeacherOpenCourseKnowledgePointRelation.class)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getBussinessId, pointRelationQuery.getBussinessId())
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getDelFlag, 0)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getOrgId, pointRelationQuery.getOrgId())
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getUserId, pointRelationQuery.getUserId())
|
|
|
|
|
.select();
|
|
|
|
|
|
|
|
|
|
pointRelationList.stream().filter(item -> {
|
|
|
|
|
boolean b = true;
|
|
|
|
|
for (String s : knowledgePointIdPlural) {
|
|
|
|
|
if (Objects.equals(s, item.getTeacherOpenCourseKnowledgePointId().toString())) {
|
|
|
|
|
b = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return b;
|
|
|
|
|
}).collect(Collectors.toList()).forEach(item ->{
|
|
|
|
|
sqlManager.lambdaQuery(TeacherOpenCourseKnowledgePointRelation.class)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getTeacherOpenCourseKnowledgeRelationId,item.getTeacherOpenCourseKnowledgeRelationId())
|
|
|
|
|
.delete();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//绑定、修改
|
|
|
|
|
for (String s : knowledgePointIdPlural) {
|
|
|
|
|
TeacherOpenCourseKnowledgePointRelation single = sqlManager.lambdaQuery(TeacherOpenCourseKnowledgePointRelation.class)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getTeacherOpenCourseKnowledgePointId, Long.valueOf(s))
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getBussinessId, pointRelationQuery.getBussinessId())
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getDelFlag, 0)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getOrgId, pointRelationQuery.getOrgId())
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getUserId, pointRelationQuery.getUserId())
|
|
|
|
|
.single();
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseKnowledgePointRelation relation = new TeacherOpenCourseKnowledgePointRelation();
|
|
|
|
|
relation.setBussinessId(pointRelationQuery.getBussinessId());
|
|
|
|
|
relation.setBussinessType(pointRelationQuery.getBussinessType());
|
|
|
|
|
relation.setCreateTime(new Date());
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(single)) {
|
|
|
|
|
relation.setTeacherOpenCourseKnowledgePointId(Long.parseLong(s));
|
|
|
|
|
relation.setBussinessId(pointRelationQuery.getBussinessId());
|
|
|
|
|
relation.setBussinessType(pointRelationQuery.getBussinessType());
|
|
|
|
|
relation.setCreateTime(new Date());
|
|
|
|
|
|
|
|
|
|
relation.setOrgId(pointRelationQuery.getOrgId());
|
|
|
|
|
relation.setUserId(pointRelationQuery.getUserId());
|
|
|
|
|
relation.setDelFlag(0);
|
|
|
|
|
sqlManager.lambdaQuery(TeacherOpenCourseKnowledgePointRelation.class).insert(relation);
|
|
|
|
|
} else {
|
|
|
|
|
relation.setDelFlag(1);
|
|
|
|
|
sqlManager.lambdaQuery(TeacherOpenCourseKnowledgePointRelation.class)
|
|
|
|
|
.andEq(TeacherOpenCourseKnowledgePointRelation::getTeacherOpenCourseKnowledgeRelationId, single.getTeacherOpenCourseKnowledgeRelationId())
|
|
|
|
|
.updateSelective(relation);
|
|
|
|
|