Browse Source

获取心理咨询师详情接口修改

hotfix/yujt_opt
yujt 5 years ago
parent
commit
c9abcaf3ed
  1. 16
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/controller/AppPsychologistController.java
  2. 14
      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/PsychologistTitleRelationDao.java
  4. 5
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologistService.java
  5. 26
      epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/impl/PsychologistServiceImpl.java
  6. 30
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistDao.xml
  7. 24
      epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistTitleRelationDao.xml

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

@ -62,11 +62,17 @@ public class AppPsychologistController {
return new Result<List<PsychologistResultDTO>>().ok(list);
}
@GetMapping("psychologistInfo")
public Result<PsychologistInfoResultDTO> psychologistInfo(@RequestBody PsychologistInfoFormDTO formDto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(formDto, AddGroup.class, DefaultGroup.class);
PsychologistInfoResultDTO data = psychologistService.psychologistInfo(formDto);
/**
* 查询心理咨询师详细信息
*
* @param psychologistId
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.psychology.result.PsychologistInfoResultDTO>
* @author work@yujt.net.cn
* @date 2020/6/12 16:28
*/
@GetMapping("psychologistInfo/{psychologistId}")
public Result<PsychologistInfoResultDTO> psychologistInfo(@PathVariable("psychologistId") String psychologistId) {
PsychologistInfoResultDTO data = psychologistService.psychologistInfo(psychologistId);
return new Result<PsychologistInfoResultDTO>().ok(data);
}

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

@ -18,12 +18,12 @@
package com.elink.esua.epdc.modules.psychology.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
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.PsychologistInfoFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologySubmitAnswerFormDTO;
import com.elink.esua.epdc.dto.psychology.result.PsychologistInfoResultDTO;
import com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -60,12 +60,12 @@ public interface PsychologistDao extends BaseDao<PsychologistEntity> {
/**
* 心理咨询师详细
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity>
* @params [params]
* @author zhangyuan
* @since 2020/5/21 14:54
* @param psychologistId
* @return com.elink.esua.epdc.dto.psychology.result.PsychologistInfoResultDTO
* @author work@yujt.net.cn
* @date 2020/6/12 16:30
*/
PsychologistEntity psychologistInfo(PsychologistInfoFormDTO dto);
PsychologistInfoResultDTO psychologistInfo(@Param("psychologistId") String psychologistId);
/**
* 心理咨询师详细

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

@ -43,16 +43,6 @@ public interface PsychologistTitleRelationDao extends BaseDao<PsychologistTitleR
*/
List<String> selectTitleIds(@Param("id") String id);
/**
* 咨询师头衔名称列表
*
* @return java.util.List<com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity>
* @params [id]
* @author zhangyuan
* @since 2020/5/21 14:54
*/
List<String> selectTitles(@Param("id") String id);
/**
* 清空关联
*

5
epdc-cloud-property/src/main/java/com/elink/esua/epdc/modules/psychology/service/PsychologistService.java

@ -21,7 +21,6 @@ import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
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.PsychologistInfoFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyAnswerFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyUnansweredFormDTO;
import com.elink.esua.epdc.dto.psychology.result.*;
@ -111,12 +110,12 @@ public interface PsychologistService extends BaseService<PsychologistEntity> {
/**
* 心理咨询师详细API
*
* @param dto
* @param psychologistId
* @return PsychologistInfoResultDTO
* @author zhangyuan
* @date 2020-06-04
*/
PsychologistInfoResultDTO psychologistInfo(PsychologistInfoFormDTO dto);
PsychologistInfoResultDTO psychologistInfo(String psychologistId);
/**
* 居民端-心理咨询-我的问题列表

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

@ -29,7 +29,6 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
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.PsychologistInfoFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyAnswerFormDTO;
import com.elink.esua.epdc.dto.psychology.form.PsychologyUnansweredFormDTO;
import com.elink.esua.epdc.dto.psychology.result.*;
@ -40,9 +39,9 @@ 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.PsychologistTitleRelationEntity;
import com.elink.esua.epdc.modules.psychology.entity.PsychologyAnswerEntity;
import com.elink.esua.epdc.modules.psychology.redis.PsychologistRedis;
import com.elink.esua.epdc.modules.psychology.service.PsychologistService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -64,16 +63,13 @@ import java.util.stream.Collectors;
public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, PsychologistEntity> implements PsychologistService {
@Autowired
private PsychologistRedis psychologistRedis;
private PsychologistTitleRelationDao psychologistTitleRelationDao;
@Resource
PsychologistTitleRelationDao psychologistTitleRelationDao;
@Resource
PsychologyQuestionDao psychologyQuestionDao;
@Autowired
private PsychologyQuestionDao psychologyQuestionDao;
@Resource
PsychologyAnswerDao psychologyAnswerDao;
@Autowired
private PsychologyAnswerDao psychologyAnswerDao;
@Override
public PageData<PsychologistDTO> page(Map<String, Object> params) {
@ -175,14 +171,8 @@ public class PsychologistServiceImpl extends BaseServiceImpl<PsychologistDao, Ps
}
@Override
public PsychologistInfoResultDTO psychologistInfo(PsychologistInfoFormDTO dto) {
PsychologistEntity entity = baseDao.psychologistInfo(dto);
PsychologistInfoResultDTO data = ConvertUtils.sourceToTarget(entity, PsychologistInfoResultDTO.class);
if (data != null) {
List<String> titles = psychologistTitleRelationDao.selectTitles(dto.getPsychologistId());
data.setTitle(titles.size() == 0 ? new ArrayList<>() : titles);
}
return data;
public PsychologistInfoResultDTO psychologistInfo(String psychologistId) {
return baseDao.psychologistInfo(psychologistId);
}
@Override

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

@ -56,14 +56,34 @@
</if>
</select>
<select id="psychologistInfo" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity">
<!-- 居民端:心理咨询师详情 -->
<resultMap id="psychologistInfoResultMap" type="com.elink.esua.epdc.dto.psychology.result.PsychologistInfoResultDTO">
<result property="id" column="ID"/>
<result property="name" column="NAME"/>
<result property="avatar" column="AVATAR"/>
<result property="motto" column="MOBILE"/>
<result property="briefIntroduction" column="BRIEF_INTRODUCTION"/>
<collection property="titleList" ofType="java.lang.String">
<result column="TITLE" />
</collection>
</resultMap>
<select id="psychologistInfo" resultMap="psychologistInfoResultMap">
SELECT
<include refid="Base_Column_List"/>
p.ID,
p.`NAME`,
p.AVATAR,
p.MOTTO,
p.BRIEF_INTRODUCTION,
pt.TITLE
FROM
epdc_psychologist
epdc_psychologist p
LEFT JOIN epdc_psychologist_title_relation ptr ON p.ID = ptr.PSYCHOLOGIST_ID
LEFT JOIN epdc_psychologist_title pt ON ptr.TITLE_ID = pt.ID
WHERE
DEL_FLAG = '0'
AND ID = #{psychologistId}
p.ID = #{psychologistId}
AND p.DEL_FLAG = '0'
AND ptr.DEL_FLAG = '0'
</select>
<select id="psychologistDetail" resultType="com.elink.esua.epdc.modules.psychology.entity.PsychologistEntity">

24
epdc-cloud-property/src/main/resources/mapper/psychology/PsychologistTitleRelationDao.xml

@ -3,18 +3,6 @@
<mapper namespace="com.elink.esua.epdc.modules.psychology.dao.PsychologistTitleRelationDao">
<resultMap type="com.elink.esua.epdc.modules.psychology.entity.PsychologistTitleRelationEntity" id="psychologistTitleRelationMap">
<result property="id" column="ID"/>
<result property="titleId" column="TITLE_ID"/>
<result property="psychologistId" column="PSYCHOLOGIST_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectTitleIds" resultType="java.lang.String">
SELECT
TITLE_ID
@ -27,18 +15,6 @@
t.SORT ASC,
t.CREATED_TIME DESC
</select>
<select id="selectTitles" resultType="java.lang.String">
SELECT
t.TITLE
FROM
epdc_psychologist_title_relation r
LEFT JOIN epdc_psychologist_title t ON r.TITLE_ID = t.id
WHERE
r.PSYCHOLOGIST_ID = #{id}
ORDER BY
t.SORT ASC,
t.CREATED_TIME DESC
</select>
<delete id="clearRelation">
DELETE
FROM

Loading…
Cancel
Save