|
@@ -60,12 +60,13 @@ public class TPCourseServiceImpl extends ServiceImpl<TPCourseMapper, TPCourse> i
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
List<TPCourse> tpCourseList = new ArrayList<>();
|
|
|
AtomicInteger i = new AtomicInteger(1);
|
|
|
+ int maxSortNum = this.getMaxSortNum(tpCourseParam.getProfessionalId());
|
|
|
tpCourseParam.getCourses().forEach(t -> {
|
|
|
TPCourse tpCourse = new TPCourse();
|
|
|
tpCourse.setProfessionalId(tpCourseParam.getProfessionalId());
|
|
|
tpCourse.setCourseCode(t.getCourseCode());
|
|
|
tpCourse.setCourseName(t.getCourseName());
|
|
|
- tpCourse.setSortNum(i.getAndIncrement());
|
|
|
+ tpCourse.setSortNum(maxSortNum + i.getAndIncrement());
|
|
|
tpCourse.insertInfo(sysUser.getId());
|
|
|
tpCourseList.add(tpCourse);
|
|
|
});
|
|
@@ -114,4 +115,18 @@ public class TPCourseServiceImpl extends ServiceImpl<TPCourseMapper, TPCourse> i
|
|
|
|
|
|
return this.baseMapper.queryList(professionalId, orgIdSet);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getMaxSortNum(Long professionalId) {
|
|
|
+ QueryWrapper<TPCourse> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(TPCourse::getProfessionalId, professionalId)
|
|
|
+ .orderByDesc(TPCourse::getSortNum)
|
|
|
+ .last("limit 1");
|
|
|
+ TPCourse tpCourse = this.getOne(queryWrapper);
|
|
|
+ if (tpCourse == null) {
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ return tpCourse.getSortNum();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|