beetlsql3-dev
Mlxa0324 2 years ago
parent 85d23de625
commit ce833778b3

@ -1114,13 +1114,15 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
.limit(1, 1)
.select(CourseInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
CourseInfo minOrderClientLink = result.get(0);
// 最小的排序值
BigDecimal minLinkOrder = minOrderClientLink.getOrderIndex();
// 置顶就现有的最小值减1。但是需要确保结果小于0
calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1);
}
} break;
@ -1134,7 +1136,10 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
.limit(1, 2)
.select(CourseInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
@ -1147,7 +1152,6 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
// 左移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
@ -1161,7 +1165,10 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
.limit(1, 2)
.select(CourseInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置底状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
@ -1174,7 +1181,6 @@ public class CourseInfoService extends CoreBaseService<CourseInfo>{
// 右移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
default:
log.error("不支持的移动类型!");

@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.jlw.aliPay.utils.StringUtils;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.jlw.dao.CourseInfoDao;
import com.ibeetl.jlw.dao.ResourcesInfoDao;
import com.ibeetl.jlw.entity.CourseInfo;
@ -331,13 +332,15 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
.limit(1, 1)
.select(ResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
ResourcesInfo minOrderClientLink = result.get(0);
// 最小的排序值
BigDecimal minLinkOrder = minOrderClientLink.getOrderIndex();
// 置顶就现有的最小值减1。但是需要确保结果小于0
calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1);
}
} break;
@ -349,7 +352,10 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
.limit(1, 2)
.select(ResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
@ -362,7 +368,6 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
// 左移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
@ -374,7 +379,10 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
.limit(1, 2)
.select(ResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置底状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
@ -387,7 +395,6 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo>{
// 右移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
default:
log.error("不支持的移动类型!");

@ -208,7 +208,10 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
.limit(1, 1)
.select(StudentClientLink::getStudentClientLinkOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
StudentClientLink minOrderClientLink = result.get(0);
// 最小的排序值
BigDecimal minLinkOrder = minOrderClientLink.getStudentClientLinkOrder();
@ -220,7 +223,6 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
updatePO.setStudentClientLinkId(studentClientLink.getStudentClientLinkId());
updatePO.setStudentClientLinkOrder(calcedOrder);
updateTemplate(updatePO);
}
} break;
@ -234,7 +236,10 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
.limit(1, 2)
.select(StudentClientLink::getStudentClientLinkOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getStudentClientLinkOrder();
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
@ -253,8 +258,6 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
updatePO.setStudentClientLinkId(studentClientLink.getStudentClientLinkId());
updatePO.setStudentClientLinkOrder(BigDecimal.valueOf(calcedOrder));
updateTemplate(updatePO);
}
} break;
@ -268,7 +271,10 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
.limit(1, 2)
.select(StudentClientLink::getStudentClientLinkOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getStudentClientLinkOrder();
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
@ -287,7 +293,6 @@ public class StudentClientLinkService extends CoreBaseService<StudentClientLink>
updatePO.setStudentClientLinkId(studentClientLink.getStudentClientLinkId());
updatePO.setStudentClientLinkOrder(BigDecimal.valueOf(calcedOrder));
updateTemplate(updatePO);
}
} break;

@ -1210,13 +1210,15 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
.limit(1, 1)
.select(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseMergeCourseInfoOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
TeacherOpenCourseMergeCourseInfo minOrderClientLink = result.get(0);
// 最小的排序值
BigDecimal minLinkOrder = minOrderClientLink.getTeacherOpenCourseMergeCourseInfoOrder();
// 置顶就现有的最小值减1。但是需要确保结果小于0
calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1);
}
} break;
@ -1230,7 +1232,10 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
.limit(1, 2)
.select(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseMergeCourseInfoOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getTeacherOpenCourseMergeCourseInfoOrder();
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
@ -1243,7 +1248,6 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
// 左移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
@ -1257,7 +1261,10 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
.limit(1, 2)
.select(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseMergeCourseInfoOrder);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置底状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getTeacherOpenCourseMergeCourseInfoOrder();
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
@ -1270,7 +1277,6 @@ public class TeacherOpenCourseMergeCourseInfoService extends CoreBaseService<Tea
// 右移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
default:
log.error("不支持的移动类型!");

@ -484,13 +484,15 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
.limit(1, 1)
.select(TeacherOpenCourseMergeResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
TeacherOpenCourseMergeResourcesInfo minOrderClientLink = result.get(0);
// 最小的排序值
BigDecimal minLinkOrder = minOrderClientLink.getOrderIndex();
// 置顶就现有的最小值减1。但是需要确保结果小于0
calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1);
}
} break;
@ -505,7 +507,10 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
.limit(1, 2)
.select(TeacherOpenCourseMergeResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置顶状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.subtract(BigDecimal.ONE);
@ -518,7 +523,6 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
// 左移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
@ -532,7 +536,10 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
.limit(1, 2)
.select(TeacherOpenCourseMergeResourcesInfo::getOrderIndex);
if (CollectionUtil.isNotEmpty(result)) {
if (CollectionUtil.isEmpty(result)) {
throw new PlatformException("已处于置底状态!");
}
// 找到应该安插的位置
BigDecimal LinkOrder0 = result.get(0).getOrderIndex();
BigDecimal LinkOrder1 = LinkOrder0.add(BigDecimal.ONE);
@ -545,7 +552,6 @@ public class TeacherOpenCourseMergeResourcesInfoService extends CoreBaseService<
// 右移位后的值
calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP);
}
} break;
default:
log.error("不支持的移动类型!");

Loading…
Cancel
Save