linzhijie
2021-03-11 c33914ba0a98c823c4b4d7da21cdd476906c9924
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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<TSubject> selectTSubjectList(TSubject tSubject) {
        return tSubjectMapper.selectTSubjectList(tSubject);
    }
    @Override
    public List<TSubject> 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<TSubject> selectTSubjectAndTLeveByTemplateId(String questionTemplateId) {
        return tSubjectMapper.selectTSubjectAndTLeveByTemplateId(questionTemplateId);
    }
}