|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.boot.tools.excel.ExcelWriter;
|
|
@@ -87,10 +88,10 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean saveMatrix(Long id, Double content) {
|
|
|
+ public boolean saveMatrix(TPMatrix tpMatrix) {
|
|
|
UpdateWrapper<TPMatrix> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(TPMatrix::getContent, content)
|
|
|
- .eq(TPMatrix::getId, id);
|
|
|
+ updateWrapper.lambda().set(TPMatrix::getContent, tpMatrix.getContent())
|
|
|
+ .eq(TPMatrix::getId, tpMatrix.getId());
|
|
|
return this.update(updateWrapper);
|
|
|
}
|
|
|
|
|
@@ -169,16 +170,6 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
|
tpMatrix.setCourseId(tpCourse.getId());
|
|
|
tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
tpMatrixAddList.add(tpMatrix);
|
|
|
- } else {
|
|
|
- for (int i = 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
|
- TPMatrix tpMatrix = new TPMatrix();
|
|
|
- tpMatrix.insertInfo(sysUser.getId());
|
|
|
- tpMatrix.setProfessionalId(tpRequirement.getProfessionalId());
|
|
|
- tpMatrix.setCourseId(tpCourse.getId());
|
|
|
- tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
- tpMatrix.setSubName(tpRequirement.getSortNum() + "-" + i);
|
|
|
- tpMatrixAddList.add(tpMatrix);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
// 修改
|
|
@@ -194,19 +185,51 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
|
tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
tpMatrixAddList.add(tpMatrix);
|
|
|
} else {
|
|
|
- if (tpRequirement.getNodeCount() > matrixList.size()) {
|
|
|
- for (int i = matrixList.size() + 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
|
- TPMatrix tpMatrix = new TPMatrix();
|
|
|
- tpMatrix.insertInfo(sysUser.getId());
|
|
|
- tpMatrix.setProfessionalId(tpRequirement.getProfessionalId());
|
|
|
- tpMatrix.setCourseId(tpCourse.getId());
|
|
|
- tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
- tpMatrix.setSubName(tpRequirement.getSortNum() + "-" + i);
|
|
|
- tpMatrixAddList.add(tpMatrix);
|
|
|
+ if (matrixList.size() == 1) {
|
|
|
+ if(matrixList.get(0).getSubName() == null){
|
|
|
+ tpMatrixRemoveList.add(matrixList.get(0).getId());
|
|
|
+
|
|
|
+ for (int i = 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
|
+ TPMatrix tpMatrix = new TPMatrix();
|
|
|
+ tpMatrix.insertInfo(sysUser.getId());
|
|
|
+ tpMatrix.setProfessionalId(tpRequirement.getProfessionalId());
|
|
|
+ tpMatrix.setCourseId(tpCourse.getId());
|
|
|
+ tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
+ tpMatrix.setSubName(tpRequirement.getSortNum() + "-" + i);
|
|
|
+ tpMatrixAddList.add(tpMatrix);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (tpRequirement.getNodeCount() > matrixList.size()) {
|
|
|
+ for (int i = matrixList.size() + 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
|
+ TPMatrix tpMatrix = new TPMatrix();
|
|
|
+ tpMatrix.insertInfo(sysUser.getId());
|
|
|
+ tpMatrix.setProfessionalId(tpRequirement.getProfessionalId());
|
|
|
+ tpMatrix.setCourseId(tpCourse.getId());
|
|
|
+ tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
+ tpMatrix.setSubName(tpRequirement.getSortNum() + "-" + i);
|
|
|
+ tpMatrixAddList.add(tpMatrix);
|
|
|
+ }
|
|
|
+ } else if (tpRequirement.getNodeCount() < matrixList.size()) {
|
|
|
+ for (int i = tpRequirement.getNodeCount(); i <= matrixList.size() - 1; i++) {
|
|
|
+ tpMatrixRemoveList.add(matrixList.get(i).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else if (tpRequirement.getNodeCount() < matrixList.size()) {
|
|
|
- for (int i = tpRequirement.getNodeCount(); i <= matrixList.size() - 1; i++) {
|
|
|
- tpMatrixRemoveList.add(matrixList.get(i).getId());
|
|
|
+ } else {
|
|
|
+ if (tpRequirement.getNodeCount() > matrixList.size()) {
|
|
|
+ for (int i = matrixList.size() + 1; i <= tpRequirement.getNodeCount(); i++) {
|
|
|
+ TPMatrix tpMatrix = new TPMatrix();
|
|
|
+ tpMatrix.insertInfo(sysUser.getId());
|
|
|
+ tpMatrix.setProfessionalId(tpRequirement.getProfessionalId());
|
|
|
+ tpMatrix.setCourseId(tpCourse.getId());
|
|
|
+ tpMatrix.setRequirementId(tpRequirement.getId());
|
|
|
+ tpMatrix.setSubName(tpRequirement.getSortNum() + "-" + i);
|
|
|
+ tpMatrixAddList.add(tpMatrix);
|
|
|
+ }
|
|
|
+ } else if (tpRequirement.getNodeCount() < matrixList.size()) {
|
|
|
+ for (int i = tpRequirement.getNodeCount(); i <= matrixList.size() - 1; i++) {
|
|
|
+ tpMatrixRemoveList.add(matrixList.get(i).getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -218,4 +241,20 @@ public class TPMatrixServiceImpl extends ServiceImpl<TPMatrixMapper, TPMatrix> i
|
|
|
this.removeByIds(tpMatrixRemoveList);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void removeMatrixByCondition(Long professionalId, Long courseId, Long requirementId) {
|
|
|
+ UpdateWrapper<TPMatrix> updateWrapper = new UpdateWrapper<>();
|
|
|
+ LambdaUpdateWrapper<TPMatrix> lambda = updateWrapper.lambda();
|
|
|
+ if (professionalId != null) {
|
|
|
+ lambda.eq(TPMatrix::getProfessionalId, professionalId);
|
|
|
+ }
|
|
|
+ if (courseId != null) {
|
|
|
+ lambda.eq(TPMatrix::getCourseId, courseId);
|
|
|
+ }
|
|
|
+ if (requirementId != null) {
|
|
|
+ lambda.eq(TPMatrix::getRequirementId, requirementId);
|
|
|
+ }
|
|
|
+ this.remove(updateWrapper);
|
|
|
+ }
|
|
|
}
|