|
@@ -12,7 +12,6 @@ import com.usoftchina.smartschool.school.dto.ListReqDTO;
|
|
|
import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
|
import com.usoftchina.smartschool.school.mapper.SubjectMapper;
|
|
import com.usoftchina.smartschool.school.mapper.SubjectMapper;
|
|
|
import com.usoftchina.smartschool.school.po.Subject;
|
|
import com.usoftchina.smartschool.school.po.Subject;
|
|
|
-import com.usoftchina.smartschool.school.po.SysStudent;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
@@ -51,13 +50,23 @@ public class SubjectServiceImpl implements SubjectService {
|
|
|
}
|
|
}
|
|
|
Long id = formdata.getSubject_id();
|
|
Long id = formdata.getSubject_id();
|
|
|
Long school = BaseContextHolder.getSchoolId();
|
|
Long school = BaseContextHolder.getSchoolId();
|
|
|
|
|
+ Integer check = 0;
|
|
|
if (StringUtils.isEmpty(id) || "0".equals(id.toString())) {
|
|
if (StringUtils.isEmpty(id) || "0".equals(id.toString())) {
|
|
|
formdata.setSchool_id(school);
|
|
formdata.setSchool_id(school);
|
|
|
formdata.setSubject_status(1);
|
|
formdata.setSubject_status(1);
|
|
|
|
|
+ //检测科目是否存在
|
|
|
|
|
+ check = subjectMapper.checkSubject(formdata.getSubject_name());
|
|
|
|
|
+ if (check > 0) {
|
|
|
|
|
+ throw new BizException(BizExceptionCode.EXISTS_SUBJECT);
|
|
|
|
|
+ }
|
|
|
subjectMapper.insertSelective(formdata);
|
|
subjectMapper.insertSelective(formdata);
|
|
|
id = formdata.getSubject_id();
|
|
id = formdata.getSubject_id();
|
|
|
} else {
|
|
} else {
|
|
|
//更新
|
|
//更新
|
|
|
|
|
+ check = subjectMapper.checkSubject(formdata.getSubject_name());
|
|
|
|
|
+ if (check > 0) {
|
|
|
|
|
+ throw new BizException(BizExceptionCode.EXISTS_SUBJECT);
|
|
|
|
|
+ }
|
|
|
subjectMapper.updateByPrimaryKeySelective(formdata);
|
|
subjectMapper.updateByPrimaryKeySelective(formdata);
|
|
|
}
|
|
}
|
|
|
return new DocBaseDTO(formdata.getSubject_id());
|
|
return new DocBaseDTO(formdata.getSubject_id());
|