package com.ots.project.exam.service.impl; import com.ots.common.utils.DateUtils; import com.ots.common.utils.text.Convert; import com.ots.project.exam.domain.TExamLevel; import com.ots.project.exam.domain.TSubject; import com.ots.project.exam.mapper.TExamLevelMapper; import com.ots.project.exam.mapper.TSubjectMapper; import com.ots.project.exam.service.ITSubjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("subject") public class TSubjectServiceImpl implements ITSubjectService { @Autowired private TSubjectMapper tSubjectMapper; @Autowired private TExamLevelMapper tExamLevelMapper; @Override public TSubject selectTSubjectById(Long id) { return tSubjectMapper.selectTSubjectById(id); } @Override public TSubject selectTSubjectAndTLeveById(Long id) { return tSubjectMapper.selectTSubjectAndTLeveById(id); } @Override public List selectTSubjectList(TSubject tSubject) { return tSubjectMapper.selectTSubjectList(tSubject); } @Override public List selectTSubjectList() { return tSubjectMapper.selectTSubjectList(); } @Override public int insertTSubject(TSubject tSubject) { tSubject.setCreateTime(DateUtils.getNowDate()); TExamLevel tExamLevel = tExamLevelMapper.selectTExamLevelById(tSubject.getLevel()); tSubject.setLevelName(tExamLevel.getLevelName()); return tSubjectMapper.insertTSubject(tSubject); } @Override public int updateTSubject(TSubject tSubject) { tSubject.setUpdateTime(DateUtils.getNowDate()); TExamLevel tExamLevel = tExamLevelMapper.selectTExamLevelById(tSubject.getLevel()); tSubject.setLevelName(tExamLevel.getLevelName()); return tSubjectMapper.updateTSubject(tSubject); } @Override public int deleteTSubjectByIds(String ids) { return tSubjectMapper.deleteTSubjectByIds(Convert.toStrArray(ids)); } public int deleteTSubjectById(Long id) { return tSubjectMapper.deleteTSubjectById(id); } @Override public List selectTSubjectAndTLeveByTemplateId(String questionTemplateId) { return tSubjectMapper.selectTSubjectAndTLeveByTemplateId(questionTemplateId); } }