| | |
| | | package com.mindskip.xzs.service.impl; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.base.RestResponse; |
| | | import com.mindskip.xzs.context.WebContext; |
| | | import com.mindskip.xzs.domain.Subject; |
| | | import com.mindskip.xzs.domain.SubjectDept; |
| | |
| | | import com.mindskip.xzs.repository.SubjectMapper; |
| | | import com.mindskip.xzs.service.SubjectService; |
| | | import com.mindskip.xzs.viewmodel.admin.education.SubjectPageRequestVM; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void add(AddSubjectForm form) { |
| | | public RestResponse add(AddSubjectForm form) { |
| | | Subject subject = new Subject(); |
| | | subject.setName(form.getSubjectName()); |
| | | subject.setDeleted(false); |
| | | subjectMapper.insert(subject); |
| | | try { |
| | | subjectMapper.insert(subject); |
| | | } catch (Exception e) { |
| | | return RestResponse.fail(500, "科目名不能重复"); |
| | | } |
| | | |
| | | SubjectDept subjectDept = new SubjectDept(); |
| | | subjectDept.setDeptId(form.getDeptId()); |
| | |
| | | List<SubjectDept> s = new ArrayList<>(1); |
| | | s.add(subjectDept); |
| | | subjectDeptMapper.add(s); |
| | | return RestResponse.ok(); |
| | | } |
| | | |
| | | @Override |