|
|
|
@ -13,10 +13,12 @@ import com.ibeetl.jlw.entity.SchoolClass;
|
|
|
|
|
import com.ibeetl.jlw.web.query.SchoolClassQuery;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
|
|
import org.beetl.sql.core.query.interfacer.StrongValue;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -78,7 +80,7 @@ public class SchoolClassService extends CoreBaseService<SchoolClass>{
|
|
|
|
|
* 验证班级编号数据,是否已经存在
|
|
|
|
|
* @param classList
|
|
|
|
|
*/
|
|
|
|
|
public void validateClassSnListIsExistsThrow(List<SchoolClass> classList) {
|
|
|
|
|
public void validateClassSnListIsExistsThrow(List<SchoolClass> classList, String orgIds) {
|
|
|
|
|
if (CollectionUtil.isEmpty(classList)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -92,13 +94,33 @@ public class SchoolClassService extends CoreBaseService<SchoolClass>{
|
|
|
|
|
// 查询库里已经存在的编号
|
|
|
|
|
List<String> existsList = schoolClassDao.createLambdaQuery()
|
|
|
|
|
.andIsNotNull(SchoolClass::getClassSn)
|
|
|
|
|
.andIn(SchoolClass::getClassSn, classSnList).select(String.class,"class_sn");
|
|
|
|
|
.andIn(SchoolClass::getClassSn, classSnList)
|
|
|
|
|
.andIn(SchoolClass::getOrgId, new StrongValue() {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isEffective() {
|
|
|
|
|
return StrUtil.isNotBlank(orgIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object getValue() {
|
|
|
|
|
return Arrays.asList(orgIds.split(","));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.andEq(SchoolClass::getClassStatus, 1).select(String.class,"class_sn");
|
|
|
|
|
// 如果存在的话,属于异常数据
|
|
|
|
|
String errorClassSns = CollectionUtil.emptyIfNull(existsList).stream().collect(Collectors.joining(","));
|
|
|
|
|
// 构建异常信息,传给前端
|
|
|
|
|
Assert.isTrue(StrUtil.isBlank(errorClassSns), "已存在的班级编号:\"{}\",请修改后再进行提交!", errorClassSns);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 没有传递机构ID的验证方法
|
|
|
|
|
* @param classList
|
|
|
|
|
*/
|
|
|
|
|
public void validateClassSnListIsExistsThrow(List<SchoolClass> classList) {
|
|
|
|
|
validateClassSnListIsExistsThrow(classList, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询所有的班级
|
|
|
|
|
*
|
|
|
|
@ -108,4 +130,5 @@ public class SchoolClassService extends CoreBaseService<SchoolClass>{
|
|
|
|
|
// Long currentOrgId = SpringUtil.getBean(CorePlatformService.class).getCurrentOrgId();
|
|
|
|
|
return SpringUtil.getBean(SchoolClassDao.class).getAllSchoolClass(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|