| | |
| | | package com.ots.project.exam.service.impl; |
| | | |
| | | import com.ots.common.utils.DateUtils; |
| | | import com.ots.common.utils.StringUtils; |
| | | import com.ots.common.utils.text.Convert; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 问卷类型Service业务层处理 |
| | | * |
| | | * @author ots |
| | | * @date 2019-12-15 |
| | | */ |
| | | @Service("examLevel") |
| | | public class TExamLevelServiceImpl implements ITExamLevelService { |
| | | @Autowired |
| | | private TExamLevelMapper tExamLevelMapper; |
| | | |
| | | @Autowired |
| | | private DictService dictService; |
| | | |
| | | |
| | | /** |
| | | * 查询问卷类型 |
| | | * |
| | | * @param id 问卷类型ID |
| | | * @return 问卷类型 |
| | | */ |
| | | @Override |
| | | public TExamLevel selectTExamLevelById(Long id) { |
| | | return tExamLevelMapper.selectTExamLevelById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<TExamLevel> selectTExamLevelByUuid(String uuid) { |
| | | return tExamLevelMapper.selectTExamLevelByUuid(uuid); |
| | | } |
| | | |
| | | @Override |
| | | public TExamLevel selectTExamLevelByUuidLan(String uuid,String langType) { |
| | | return tExamLevelMapper.selectTExamLevelByUuidLan(uuid,langType); |
| | | } |
| | | |
| | | @Override |
| | | public List<TExamLevel> selectTExamLevelAndTSubjectById(Long id) { |
| | | return tExamLevelMapper.selectTExamLevelAndTSubjectById(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询问卷类型列表 |
| | | * |
| | | * @param tExamLevel 问卷类型 |
| | | * @return 问卷类型 |
| | | */ |
| | | @Override |
| | | public List<TExamLevel> selectTExamLevelList(TExamLevel tExamLevel) { |
| | | |
| | | //globalization(tExamLevel); |
| | | return tExamLevelMapper.selectTExamLevelList(tExamLevel); |
| | | } |
| | | |
| | | |
| | | // 国际化 |
| | | private void globalization(TExamLevel tExamLevel) { |
| | | if(StringUtils.isNotBlank(tExamLevel.getUuid())){ |
| | | /*List<DictData> lang_types = this.dictService.getType("lang_type"); |
| | |
| | | tExamLevel.setLangType(this.dictService.getLangType(LocaleContextHolder.getLocale().toString())); |
| | | } |
| | | } |
| | | |
| | | public List<TExamLevel> selectTExamLevelList() { |
| | | TExamLevel t = new TExamLevel(); |
| | | t.setLangType(this.dictService.getLangType(LocaleContextHolder.getLocale().toString())); |
| | | return tExamLevelMapper.selectTExamLevelList(t); |
| | | } |
| | | |
| | | @Override |
| | | public List<TExamLevel> selectTExamLevelListByType(String type) { |
| | | List<Integer> types = new ArrayList<>(); |
| | |
| | | types.add(1); |
| | | types.add(3); |
| | | } |
| | | |
| | | if (StringUtils.equals(type, "questionnaire")) { |
| | | types.add(1); |
| | | types.add(2); |
| | | } |
| | | return tExamLevelMapper.selectTExamLevelListByType(types.stream().toArray(Integer[]::new)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TExamLevel> selectTExamLevelByquestionTemplateIdList(String questionTemplateId) { |
| | | return tExamLevelMapper.selectTExamLevelByquestionTemplateIdList(questionTemplateId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增问卷类型 |
| | | * |
| | | * @param tExamLevel 问卷类型 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertTExamLevel(TExamLevel tExamLevel) { |
| | | tExamLevel.setCreateTime(DateUtils.getNowDate()); |
| | |
| | | } |
| | | return tExamLevelMapper.insertTExamLevel(tExamLevel); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改问卷类型 |
| | | * |
| | | * @param tExamLevel 问卷类型 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateTExamLevel(TExamLevel tExamLevel) { |
| | | tExamLevel.setUpdateTime(DateUtils.getNowDate()); |
| | |
| | | } |
| | | return tExamLevelMapper.updateTExamLevel(tExamLevel); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除问卷类型对象 |
| | | * |
| | | * @param ids 需要删除的数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteTExamLevelByIds(String ids) { |
| | | return tExamLevelMapper.deleteTExamLevelByIds(Convert.toStrArray(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除问卷类型信息 |
| | | * |
| | | * @param id 问卷类型ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteTExamLevelById(Long id) { |
| | | return tExamLevelMapper.deleteTExamLevelById(id); |
| | | } |