From adaaa23c789be3313a0e554fbf7beaa8ab261e68 Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期四, 16 五月 2024 18:07:01 +0800 Subject: [PATCH] zjh 2024/05/16-1 --- ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java index fff56f8..85c696e 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSurveyQuestionServiceImpl.java @@ -27,6 +27,9 @@ @Autowired private TjSurveyQuestionMapper tjSurveyQuestionMapper; + @Autowired + private ITjSurveyQuestionService tjSurveyQuestionService; + /** * 鏌ヨ闂嵎闂 * @@ -60,15 +63,17 @@ * @param tjSurveyQuestion 闂嵎闂 * @return 缁撴灉 */ - @Transactional +// @Transactional @Override public int insertTjSurveyQuestion(TjSurveyQuestion tjSurveyQuestion) { tjSurveyQuestion.setCreateTime(DateUtils.getNowDate()); tjSurveyQuestion.setCreateBy(SecurityUtils.getLoginUser().getUsername()); - int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); - System.out.println(tjSurveyQuestion); - insertTjSurveyOptions(tjSurveyQuestion); - return rows; +// int rows = tjSurveyQuestionMapper.insertTjSurveyQuestion(tjSurveyQuestion); + if (tjSurveyQuestionService.save(tjSurveyQuestion)) { + insertTjSurveyOptions(tjSurveyQuestion); + return 1; + } + return 0; } /** @@ -107,7 +112,7 @@ */ @Transactional @Override - public int deleteTjSurveyQuestionByQid(String qid) { + public int deleteTjSurveyQuestionByQid(Long qid) { tjSurveyQuestionMapper.deleteTjSurveyOptionsByQid(qid); return tjSurveyQuestionMapper.deleteTjSurveyQuestionByQid(qid); } @@ -129,11 +134,11 @@ */ public void insertTjSurveyOptions(TjSurveyQuestion tjSurveyQuestion) { List<TjSurveyOptions> tjSurveyOptionsList = tjSurveyQuestion.getTjSurveyOptionsList(); - String qid = tjSurveyQuestion.getQid(); + Long qid = tjSurveyQuestion.getQid(); 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()); -- Gitblit v1.8.0