| | |
| | | package com.ltkj.hosp.service.impl; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ltkj.common.utils.DateUtils; |
| | | import com.ltkj.hosp.domain.TjTeamSelectRecord; |
| | | import com.ltkj.hosp.mapper.TjTeamSelectRecordMapper; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.common.utils.StringUtils; |
| | | import com.ltkj.hosp.domain.TjSurveyOptions; |
| | | import com.ltkj.hosp.domain.TjSurveyQuestion; |
| | | import com.ltkj.hosp.domain.TjSurveyTempQues; |
| | | import com.ltkj.hosp.mapper.TjSurveyQuestionMapper; |
| | | import com.ltkj.hosp.service.ITjSurveyQuestionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import com.ltkj.common.utils.StringUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ltkj.hosp.domain.TjSurveyOptions; |
| | | import com.ltkj.hosp.mapper.TjSurveyQuestionMapper; |
| | | import com.ltkj.hosp.domain.TjSurveyQuestion; |
| | | import com.ltkj.hosp.service.ITjSurveyQuestionService; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 问卷问题Service业务层处理 |
| | |
| | | @Autowired |
| | | private TjSurveyQuestionMapper tjSurveyQuestionMapper; |
| | | |
| | | @Autowired |
| | | private ITjSurveyQuestionService tjSurveyQuestionService; |
| | | |
| | | /** |
| | | * 查询问卷问题 |
| | | * |
| | |
| | | * @return 问卷问题 |
| | | */ |
| | | @Override |
| | | public TjSurveyQuestion selectTjSurveyQuestionByQid(Long qid) { |
| | | public TjSurveyQuestion selectTjSurveyQuestionByQid(String qid) { |
| | | return tjSurveyQuestionMapper.selectTjSurveyQuestionByQid(qid); |
| | | } |
| | | |
| | | @Override |
| | | public List<TjSurveyOptions> selectOptionsByQid(String qid) { |
| | | return tjSurveyQuestionMapper.selectOptionsByQid(qid); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param tjSurveyQuestion 问卷问题 |
| | | * @return 结果 |
| | | */ |
| | | @Transactional |
| | | // @Transactional |
| | | @Override |
| | | public int insertTjSurveyQuestion(TjSurveyQuestion tjSurveyQuestion) { |
| | | tjSurveyQuestion.setCreateTime(DateUtils.getNowDate()); |
| | | int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); |
| | | insertTjSurveyOptions(tjSurveyQuestion); |
| | | return rows; |
| | | tjSurveyQuestion.setCreateBy(SecurityUtils.getLoginUser().getUsername()); |
| | | // int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); |
| | | if (tjSurveyQuestionService.save(tjSurveyQuestion)) { |
| | | insertTjSurveyOptions(tjSurveyQuestion); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public int updateTjSurveyQuestion(TjSurveyQuestion tjSurveyQuestion) { |
| | | tjSurveyQuestion.setUpdateTime(DateUtils.getNowDate()); |
| | | tjSurveyQuestionMapper.deleteTjSurveyOptionsByQid(tjSurveyQuestion.getQid()) |
| | | ; |
| | | tjSurveyQuestionMapper.deleteTjSurveyOptionsByQid(tjSurveyQuestion.getQid()); |
| | | insertTjSurveyOptions(tjSurveyQuestion); |
| | | return tjSurveyQuestionMapper.updateTjSurveyQuestion(tjSurveyQuestion); |
| | | } |
| | |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public int deleteTjSurveyQuestionByQids(Long[] qids) { |
| | | public int deleteTjSurveyQuestionByQids(String[] qids) { |
| | | tjSurveyQuestionMapper.deleteTjSurveyOptionsByQids(qids); |
| | | return tjSurveyQuestionMapper.deleteTjSurveyQuestionByQids(qids); |
| | | } |
| | |
| | | return tjSurveyQuestionMapper.deleteTjSurveyQuestionByQid(qid); |
| | | } |
| | | |
| | | @Override |
| | | public List<TjSurveyTempQues> selectOptionsByMid(String mid) { |
| | | return tjSurveyQuestionMapper.selectOptionsByMid(mid); |
| | | } |
| | | |
| | | @Override |
| | | public List<TjSurveyQuestion> getOptionsByMid(String mid) { |
| | | return tjSurveyQuestionMapper.getOptionsByMid(mid); |
| | | } |
| | | |
| | | /** |
| | | * 新增问卷选项信息 |
| | | * |
| | |
| | | if (StringUtils.isNotNull(tjSurveyOptionsList)) { |
| | | List<TjSurveyOptions> list = new ArrayList<TjSurveyOptions>(); |
| | | for (TjSurveyOptions tjSurveyOptions : tjSurveyOptionsList) { |
| | | tjSurveyOptions.setQid(qid); |
| | | tjSurveyOptions.setQid(qid.toString()); |
| | | tjSurveyOptions.setDeleted(0); |
| | | tjSurveyOptions.setCreateBy(SecurityUtils.getLoginUser().getUsername()); |
| | | tjSurveyOptions.setCreateTime(DateUtils.getNowDate()); |
| | | list.add(tjSurveyOptions); |
| | | } |
| | | if (list.size() > 0) { |
| | | for (TjSurveyOptions tjSurveyOptions : list) { |
| | | tjSurveyOptions.setDeleted(0); |
| | | tjSurveyQuestionMapper.insertTjSurveyOptions(tjSurveyOptions); |
| | | } |
| | | tjSurveyQuestionMapper.batchTjSurveyOptions(list); |
| | | } |
| | | } |
| | | } |