| | |
| | | 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.TTextContent; |
| | |
| | | import com.ots.project.tool.exam.JsonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 题目的内容Service业务层处理 |
| | | * |
| | | * @author ots |
| | | * @date 2019-11-24 |
| | | */ |
| | | @Service |
| | | public class TTextContentServiceImpl implements ITTextContentService { |
| | | @Autowired |
| | | private TTextContentMapper tTextContentMapper; |
| | | |
| | | |
| | | /** |
| | | * 查询题目的内容 |
| | | * |
| | | * @param id 题目的内容ID |
| | | * @return 题目的内容 |
| | | */ |
| | | @Override |
| | | public TTextContent selectTTextContentById(Long id) { |
| | | return tTextContentMapper.selectTTextContentById(id); |
| | | } |
| | | |
| | | |
| | | //用in的方式查询 |
| | | @Override |
| | | public List<TTextContent> selectTTextContentByIds(String[] ids) { |
| | | return tTextContentMapper.selectTTextContentByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<TTextContentAndQuestion> selectTextContentAndQuestion(String[] ids) { |
| | | return tTextContentMapper.selectTextContentAndQuestion(ids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询题目的内容列表 |
| | | * |
| | | * @param tTextContent 题目的内容 |
| | | * @return 题目的内容 |
| | | */ |
| | | @Override |
| | | public List<TTextContent> selectTTextContentList(TTextContent tTextContent) { |
| | | return tTextContentMapper.selectTTextContentList(tTextContent); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增题目的内容 |
| | | * |
| | | * @param tTextContent 题目的内容 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertTTextContent(TTextContent tTextContent) { |
| | | tTextContent.setCreateTime(DateUtils.getNowDate()); |
| | | return tTextContentMapper.insertTTextContent(tTextContent); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改题目的内容 |
| | | * |
| | | * @param tTextContent 题目的内容 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateTTextContent(TTextContent tTextContent) { |
| | | tTextContent.setUpdateTime(DateUtils.getNowDate()); |
| | | return tTextContentMapper.updateTTextContent(tTextContent); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除题目的内容对象 |
| | | * |
| | | * @param ids 需要删除的数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteTTextContentByIds(String ids) { |
| | | return tTextContentMapper.deleteTTextContentByIds(Convert.toStrArray(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除题目的内容信息 |
| | | * |
| | | * @param id 题目的内容ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteTTextContentById(Long id) { |
| | | return tTextContentMapper.deleteTTextContentById(id); |
| | | } |
| | | |
| | | @Override |
| | | public <T, R> TTextContent jsonConvertInsert(List<T> list, Date now, Function<? super T, ? extends R> mapper) { |
| | | String frameTextContent = null; |
| | |
| | | frameTextContent = JsonUtil.toJsonStr(mapList); |
| | | } |
| | | TTextContent textContent = new TTextContent(frameTextContent, now); |
| | | |
| | | //insertByFilter(textContent); cache useless |
| | | return textContent; |
| | | } |
| | | |
| | | @Override |
| | | public <T, R> TTextContent jsonConvertUpdate(TTextContent textContent, List<T> list, Function<? super T, ? extends R> mapper) { |
| | | String frameTextContent = null; |
| | |
| | | frameTextContent = JsonUtil.toJsonStr(mapList); |
| | | } |
| | | textContent.setContent(frameTextContent); |
| | | |
| | | //this.updateByIdFilter(textContent); cache useless |
| | | return textContent; |
| | | } |
| | | } |