Browse Source

工作端--心理咨询-提交问题的回答app接口

hotfix/yujt_opt
zhangyuan 5 years ago
parent
commit
a9b0ef65db
  1. 29
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java
  2. 11
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologistDao.java
  3. 10
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java
  4. 11
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java
  5. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java
  6. 14
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java
  7. 32
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java
  8. 2
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java
  9. 14
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistDao.xml
  10. 10
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml

29
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java

@ -27,6 +27,7 @@ import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.psychology.form.*; import com.elink.esua.epdc.dto.psychology.form.*;
import com.elink.esua.epdc.dto.psychology.result.*; import com.elink.esua.epdc.dto.psychology.result.*;
import com.elink.esua.epdc.modules.psychology.service.PsychologistService; import com.elink.esua.epdc.modules.psychology.service.PsychologistService;
import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService;
import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService; import com.elink.esua.epdc.modules.psychology.service.PsychologyQuestionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -50,14 +51,21 @@ public class AppPsychologistController {
@Autowired @Autowired
private PsychologyQuestionService psychologyQuestionService; private PsychologyQuestionService psychologyQuestionService;
@Autowired
private PsychologyAnswerService psychologyAnswerService;
@GetMapping("listPsychiatrist") @GetMapping("listPsychiatrist")
public Result<List<PsychologistResultDTO>> listPsychiatrist(@RequestBody PsychologistFormDTO formDto) throws Exception { public Result<List<PsychologistResultDTO>> listPsychiatrist(@RequestBody PsychologistFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
List<PsychologistResultDTO> list = psychologistService.listPsychiatrist(formDto); List<PsychologistResultDTO> list = psychologistService.listPsychiatrist(formDto);
return new Result<List<PsychologistResultDTO>>().ok(list); return new Result<List<PsychologistResultDTO>>().ok(list);
} }
@GetMapping("psychologistInfo") @GetMapping("psychologistInfo")
public Result<PsychologistInfoResultDTO> psychologistInfo(@RequestBody PsychologistInfoFormDTO formDto) throws Exception { public Result<PsychologistInfoResultDTO> psychologistInfo(@RequestBody PsychologistInfoFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
PsychologistInfoResultDTO data = psychologistService.psychologistInfo(formDto); PsychologistInfoResultDTO data = psychologistService.psychologistInfo(formDto);
return new Result<PsychologistInfoResultDTO>().ok(data); return new Result<PsychologistInfoResultDTO>().ok(data);
} }
@ -66,24 +74,30 @@ public class AppPsychologistController {
public Result submitQuestion(@RequestBody PsychologyQuestionFormDTO formDto) throws Exception { public Result submitQuestion(@RequestBody PsychologyQuestionFormDTO formDto) throws Exception {
//效验数据 //效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
psychologyQuestionService.saveFromApp(formDto); psychologyQuestionService.saveQuestion(formDto);
return new Result(); return new Result();
} }
@GetMapping("listUserQuestion") @GetMapping("listUserQuestion")
public Result<List<PsychologyAnswerListUserResultDTO>> listUserQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { public Result<List<PsychologyAnswerListUserResultDTO>> listUserQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
List<PsychologyAnswerListUserResultDTO> data = psychologistService.listUserQuestion(formDto); List<PsychologyAnswerListUserResultDTO> data = psychologistService.listUserQuestion(formDto);
return new Result<List<PsychologyAnswerListUserResultDTO>>().ok(data); return new Result<List<PsychologyAnswerListUserResultDTO>>().ok(data);
} }
@GetMapping("listQuestion") @GetMapping("listQuestion")
public Result<List<PsychologyAnswerListResultDTO>> listAllQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { public Result<List<PsychologyAnswerListResultDTO>> listAllQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
List<PsychologyAnswerListResultDTO> data = psychologistService.listAllQuestion(formDto); List<PsychologyAnswerListResultDTO> data = psychologistService.listAllQuestion(formDto);
return new Result<List<PsychologyAnswerListResultDTO>>().ok(data); return new Result<List<PsychologyAnswerListResultDTO>>().ok(data);
} }
@GetMapping("listUnansweredQuestion") @GetMapping("listUnansweredQuestion")
public Result<List<PsychologyUnansweredResultDTO>> listUnansweredQuestion(@RequestBody PsychologyUnansweredFormDTO formDto) throws Exception { public Result<List<PsychologyUnansweredResultDTO>> listUnansweredQuestion(@RequestBody PsychologyUnansweredFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
List<PsychologyUnansweredResultDTO> data = psychologistService.listUnansweredQuestion(formDto); List<PsychologyUnansweredResultDTO> data = psychologistService.listUnansweredQuestion(formDto);
return new Result<List<PsychologyUnansweredResultDTO>>().ok(data); return new Result<List<PsychologyUnansweredResultDTO>>().ok(data);
} }
@ -92,7 +106,20 @@ public class AppPsychologistController {
public Result<List<PsychologyAnswerOfMineResultDTO>> listMyQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception { public Result<List<PsychologyAnswerOfMineResultDTO>> listMyQuestion(@RequestBody PsychologyAnswerFormDTO formDto) throws Exception {
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
formDto.setUserId(user.getId().toString()); formDto.setUserId(user.getId().toString());
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
List<PsychologyAnswerOfMineResultDTO> data = psychologistService.listMyQuestion(formDto); List<PsychologyAnswerOfMineResultDTO> data = psychologistService.listMyQuestion(formDto);
return new Result<List<PsychologyAnswerOfMineResultDTO>>().ok(data); return new Result<List<PsychologyAnswerOfMineResultDTO>>().ok(data);
} }
@PostMapping("submitAnswer")
public Result submitAnswer(@RequestBody PsychologySubmitAnswerFormDTO formDto) throws Exception {
UserDetail user = SecurityUser.getUser();
formDto.setUserId(user.getId().toString());
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
psychologyAnswerService.saveAnswer(formDto);
return new Result();
}
} }

11
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologistDao.java

@ -21,6 +21,7 @@ import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.psychology.PsychologistDTO; import com.elink.esua.epdc.dto.psychology.PsychologistDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologistFormDTO; import com.elink.esua.epdc.dto.psychology.form.PsychologistFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologistInfoFormDTO; import com.elink.esua.epdc.dto.psychology.form.PsychologistInfoFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologySubmitAnswerFormDTO;
import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity; import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -76,4 +77,14 @@ public interface PsychologistDao extends BaseDao<PsychologistEntity> {
*/ */
PsychologistEntity psychologistInfo(PsychologistInfoFormDTO dto); PsychologistEntity psychologistInfo(PsychologistInfoFormDTO dto);
/**
* 心理咨询师详细
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity>
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
PsychologistEntity psychologistDetail(PsychologySubmitAnswerFormDTO dto);
} }

10
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/dao/PsychologyQuestionDao.java

@ -19,6 +19,7 @@ package com.elink.esua.epdc.modules.psychology.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.psychology.form.PsychologyAnswerFormDTO; import com.elink.esua.epdc.dto.psychology.form.PsychologyAnswerFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologySubmitAnswerFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyUnansweredFormDTO; import com.elink.esua.epdc.dto.psychology.form.PsychologyUnansweredFormDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListResultDTO; import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListResultDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListUserResultDTO; import com.elink.esua.epdc.dto.psychology.result.PsychologyAnswerListUserResultDTO;
@ -78,4 +79,13 @@ public interface PsychologyQuestionDao extends BaseDao<PsychologyQuestionEntity>
*/ */
List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto); List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto);
/**
* 查询问题详情
*
* @return int
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
int updateQuestion(PsychologySubmitAnswerFormDTO dto);
} }

11
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyAnswerService.java

@ -20,6 +20,7 @@ package com.elink.esua.epdc.modules.psychology.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO; import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologySubmitAnswerFormDTO;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity;
import java.util.List; import java.util.List;
@ -73,6 +74,16 @@ public interface PsychologyAnswerService extends BaseService<PsychologyAnswerEnt
*/ */
void save(PsychologyAnswerDTO dto); void save(PsychologyAnswerDTO dto);
/**
* APP保存
*
* @param dto
* @return void
* @author zhangyuan
* @date 2020-06-08
*/
void saveAnswer(PsychologySubmitAnswerFormDTO dto);
/** /**
* 默认更新 * 默认更新
* *

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologyQuestionService.java

@ -82,7 +82,7 @@ public interface PsychologyQuestionService extends BaseService<PsychologyQuestio
* @author zhangyuan * @author zhangyuan
* @date 2020-06-08 * @date 2020-06-08
*/ */
void saveFromApp(PsychologyQuestionFormDTO dto); void saveQuestion(PsychologyQuestionFormDTO dto);
/** /**
* 默认更新 * 默认更新

14
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java

@ -160,8 +160,10 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
public PsychologistInfoResultDTO psychologistInfo(PsychologistInfoFormDTO dto) { public PsychologistInfoResultDTO psychologistInfo(PsychologistInfoFormDTO dto) {
PsychologistEntity entity = baseDao.psychologistInfo(dto); PsychologistEntity entity = baseDao.psychologistInfo(dto);
PsychologistInfoResultDTO data = ConvertUtils.sourceToTarget(entity, PsychologistInfoResultDTO.class); PsychologistInfoResultDTO data = ConvertUtils.sourceToTarget(entity, PsychologistInfoResultDTO.class);
List<String> titles = psychologistTitleRelationDao.selectTitles(dto.getPsychologistId()); if (data != null) {
data.setTitle(titles == null ? new ArrayList<>() : titles); List<String> titles = psychologistTitleRelationDao.selectTitles(dto.getPsychologistId());
data.setTitle(titles.size() == 0 ? new ArrayList<>() : titles);
}
return data; return data;
} }
@ -172,7 +174,7 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
List<PsychologyAnswerListUserResultDTO> data = psychologyQuestionDao.listUserQuestion(dto); List<PsychologyAnswerListUserResultDTO> data = psychologyQuestionDao.listUserQuestion(dto);
data.forEach(item -> { data.forEach(item -> {
List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId()); List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId());
item.setAnswerList(list == null ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerUserInfoResultDTO.class)); item.setAnswerList(list.size() == 0 ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerUserInfoResultDTO.class));
}); });
return data; return data;
@ -185,7 +187,7 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
List<PsychologyAnswerListResultDTO> data = psychologyQuestionDao.listAllQuestion(dto); List<PsychologyAnswerListResultDTO> data = psychologyQuestionDao.listAllQuestion(dto);
data.forEach(item -> { data.forEach(item -> {
List<PsychologyAnswerInfoResultDTO> list = psychologyAnswerDao.listAllQuestion(item.getId()); List<PsychologyAnswerInfoResultDTO> list = psychologyAnswerDao.listAllQuestion(item.getId());
item.setAnswerList(list == null ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerInfoResultDTO.class)); item.setAnswerList(list.size() == 0 ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerInfoResultDTO.class));
}); });
return data; return data;
@ -201,14 +203,14 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
@Override @Override
public List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto) { public List<PsychologyAnswerOfMineResultDTO> listMyQuestion(PsychologyAnswerFormDTO dto) {
List<String> questionIds = psychologyAnswerDao.listMyQuestion(dto.getUserId()).stream().map(PsychologyAnswerEntity::getId).collect(Collectors.toList()); List<String> questionIds = psychologyAnswerDao.listMyQuestion(dto.getUserId()).stream().map(PsychologyAnswerEntity::getQuestionId).collect(Collectors.toList());
dto.setQuestionIds(questionIds); dto.setQuestionIds(questionIds);
// sql limit条件转换 // sql limit条件转换
dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize()); dto.setPageIndex((dto.getPageIndex() - 1) * dto.getPageSize());
List<PsychologyAnswerOfMineResultDTO> data = psychologyQuestionDao.listMyQuestion(dto); List<PsychologyAnswerOfMineResultDTO> data = psychologyQuestionDao.listMyQuestion(dto);
data.forEach(item -> { data.forEach(item -> {
List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId()); List<PsychologyAnswerUserInfoResultDTO> list = psychologyAnswerDao.listUserQuestion(item.getId());
item.setAnswerList(list == null ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerUserInfoResultDTO.class)); item.setAnswerList(list.size() == 0 ? new ArrayList<>() : ConvertUtils.sourceToTarget(list, PsychologyAnswerUserInfoResultDTO.class));
}); });
return data; return data;

32
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyAnswerServiceImpl.java

@ -21,10 +21,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO; import com.elink.esua.epdc.dto.psychology.PsychologyAnswerDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologySubmitAnswerFormDTO;
import com.elink.esua.epdc.modules.psychology.dao.PsychologistDao;
import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao; import com.elink.esua.epdc.modules.psychology.dao.PsychologyAnswerDao;
import com.elink.esua.epdc.modules.psychology.dao.PsychologyQuestionDao;
import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity; import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity;
import com.elink.esua.epdc.modules.psychology.redis.PsychologyAnswerRedis; import com.elink.esua.epdc.modules.psychology.redis.PsychologyAnswerRedis;
import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService; import com.elink.esua.epdc.modules.psychology.service.PsychologyAnswerService;
@ -33,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -49,6 +55,12 @@ public class PsychologyAnswerServiceImpl extends BaseServiceImpl<PsychologyAnswe
@Autowired @Autowired
private PsychologyAnswerRedis psychologyAnswerRedis; private PsychologyAnswerRedis psychologyAnswerRedis;
@Resource
private PsychologistDao psychologistDao;
@Resource
private PsychologyQuestionDao psychologyQuestionDao;
@Override @Override
public PageData<PsychologyAnswerDTO> page(Map<String, Object> params) { public PageData<PsychologyAnswerDTO> page(Map<String, Object> params) {
IPage<PsychologyAnswerEntity> page = baseDao.selectPage( IPage<PsychologyAnswerEntity> page = baseDao.selectPage(
@ -65,8 +77,8 @@ public class PsychologyAnswerServiceImpl extends BaseServiceImpl<PsychologyAnswe
return ConvertUtils.sourceToTarget(entityList, PsychologyAnswerDTO.class); return ConvertUtils.sourceToTarget(entityList, PsychologyAnswerDTO.class);
} }
private QueryWrapper<PsychologyAnswerEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<PsychologyAnswerEntity> getWrapper(Map<String, Object> params) {
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PsychologyAnswerEntity> wrapper = new QueryWrapper<>(); QueryWrapper<PsychologyAnswerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -87,6 +99,22 @@ public class PsychologyAnswerServiceImpl extends BaseServiceImpl<PsychologyAnswe
insert(entity); insert(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void saveAnswer(PsychologySubmitAnswerFormDTO dto) {
PsychologistEntity psychologistEntity = psychologistDao.psychologistDetail(dto);
if (psychologistEntity == null) {
throw new RenException("查询不到该心理咨询师");
}
PsychologyAnswerEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyAnswerEntity.class);
entity.setPsychologistId(dto.getUserId());
entity.setPsychologistName(psychologistEntity.getName());
insert(entity);
// 问题回答数+1
psychologyQuestionDao.updateQuestion(dto);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(PsychologyAnswerDTO dto) { public void update(PsychologyAnswerDTO dto) {

2
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologyQuestionServiceImpl.java

@ -90,7 +90,7 @@ public class PsychologyQuestionServiceImpl extends BaseServiceImpl<PsychologyQue
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveFromApp(PsychologyQuestionFormDTO dto) { public void saveQuestion(PsychologyQuestionFormDTO dto) {
PsychologyQuestionEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyQuestionEntity.class); PsychologyQuestionEntity entity = ConvertUtils.sourceToTarget(dto, PsychologyQuestionEntity.class);
insert(entity); insert(entity);
} }

14
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistDao.xml

@ -50,8 +50,8 @@
epdc_psychologist epdc_psychologist
WHERE WHERE
DEL_FLAG = '0' DEL_FLAG = '0'
<if test="userId != null and userId != ''"> <if test="allFlag == '0' or allFlag == 0">
AND USER_ID = #{userId} LIMIT 4
</if> </if>
</select> </select>
@ -79,4 +79,14 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND ID = #{psychologistId} AND ID = #{psychologistId}
</select> </select>
<select id="psychologistDetail" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity">
SELECT
<include refid="Base_Column_List"/>
FROM
epdc_psychologist
WHERE
DEL_FLAG = '0'
AND USER_ID = #{userId}
</select>
</mapper> </mapper>

10
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologyQuestionDao.xml

@ -88,4 +88,14 @@
CREATED_TIME DESC CREATED_TIME DESC
LIMIT #{pageIndex}, #{pageSize}; LIMIT #{pageIndex}, #{pageSize};
</select> </select>
<update id="updateQuestion">
UPDATE epdc_psychology_question
SET UPDATED_BY = #{userId},
UPDATED_TIME = now(),
ANSWER_NUM = ANSWER_NUM + 1
WHERE
DEL_FLAG = '0'
AND ID = #{questionId}
</update>
</mapper> </mapper>
Loading…
Cancel
Save