master
parent
55766bef78
commit
a5af4b41ad
|
@ -0,0 +1,20 @@
|
|||
package com.grail.domain.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:
|
||||
* @Date:
|
||||
* @Description
|
||||
*/
|
||||
@Data
|
||||
public class User {
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String username;
|
||||
|
||||
private List<Doctor> doctorList;
|
||||
}
|
|
@ -87,7 +87,11 @@
|
|||
<artifactId>grail-patient-doctor-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>cloudauth20190307</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -98,4 +98,13 @@ public class DoctorController {
|
|||
JSON.toJSONString(result.getData()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/doctorUser")
|
||||
private R doctorUser(){
|
||||
R r=doctorService.doctorUser();
|
||||
log.info("功能:一对多列表展示 URI:{} 方法:{} 参数:{}",request.getRequestURI(),request.getMethod(),
|
||||
JSON.toJSONString(r.getData()));
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.grail.doctor.mapper;
|
||||
|
||||
import com.grail.domain.Vo;
|
||||
import com.grail.domain.model.Doctor;
|
||||
import com.grail.domain.model.User;
|
||||
import com.grail.domain.request.DoctorRequest;
|
||||
import com.grail.domain.response.DoctorResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
@ -24,4 +26,6 @@ public interface DoctorMapper {
|
|||
Integer doctorDelete(@Param("doctorId") String doctorId);
|
||||
|
||||
DoctorRequest doctorFind(@Param("doctorId") Integer doctorId);
|
||||
|
||||
List<Doctor> doctorAdmin(@Param("userId") Integer userId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.grail.doctor.mapper;
|
||||
|
||||
import com.grail.domain.model.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:
|
||||
* @Date:
|
||||
* @Description
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
List<User> userList();
|
||||
|
||||
}
|
|
@ -21,4 +21,6 @@ public interface DoctorService {
|
|||
R doctorDelete(String doctorId);
|
||||
|
||||
R doctorFind(Integer doctorId);
|
||||
|
||||
R doctorUser();
|
||||
}
|
||||
|
|
|
@ -2,9 +2,13 @@ package com.grail.doctor.service.impl;
|
|||
|
||||
import com.grail.common.core.domain.R;
|
||||
import com.grail.common.core.domain.Result;
|
||||
import com.grail.common.redis.service.RedisService;
|
||||
import com.grail.doctor.mapper.DoctorMapper;
|
||||
import com.grail.doctor.mapper.UserMapper;
|
||||
import com.grail.doctor.service.DoctorService;
|
||||
import com.grail.domain.Vo;
|
||||
import com.grail.domain.model.Doctor;
|
||||
import com.grail.domain.model.User;
|
||||
import com.grail.domain.request.DoctorRequest;
|
||||
import com.grail.domain.response.DoctorResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -22,6 +26,16 @@ public class DoctorServiceImpl implements DoctorService {
|
|||
|
||||
@Autowired
|
||||
public DoctorMapper doctorMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
public RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
public UserMapper userMapper;
|
||||
|
||||
private static final String DOCTOR="doctor";
|
||||
|
||||
@Override
|
||||
public R doctorList(Vo vo) {
|
||||
List<DoctorRequest> doctorRequestList=doctorMapper.doctorList(vo);
|
||||
|
@ -51,4 +65,19 @@ public class DoctorServiceImpl implements DoctorService {
|
|||
DoctorRequest doctorFind=doctorMapper.doctorFind(doctorId);
|
||||
return R.ok(doctorFind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R doctorUser() {
|
||||
if (redisService.hasKey(DOCTOR)){
|
||||
List<User> userList=redisService.getCacheList(DOCTOR);
|
||||
}
|
||||
List<User> userList=userMapper.userList();
|
||||
|
||||
userList.forEach(item->{
|
||||
List<Doctor> doctorList=doctorMapper.doctorAdmin(item.getUserId());
|
||||
item.setDoctorList(doctorList);
|
||||
});
|
||||
redisService.setCacheList(DOCTOR,userList);
|
||||
return R.ok(userList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,4 +76,20 @@
|
|||
<select id="doctorFind" resultType="com.grail.domain.request.DoctorRequest">
|
||||
SELECT * FROM t_doctor d LEFT JOIN t_user u on d.user_id=u.user_id WHERE d.doctor_id=#{doctorId}
|
||||
</select>
|
||||
<select id="doctorAdmin" resultType="com.grail.domain.model.Doctor">
|
||||
select doctor_id,
|
||||
doctor_name,
|
||||
doctor_gender,
|
||||
doctor_hospital,
|
||||
doctor_career,
|
||||
doctor_picture,
|
||||
personal_profile,
|
||||
doctor_field,
|
||||
department_id,
|
||||
reply_status,
|
||||
reply_content,
|
||||
user_id,
|
||||
consultation_price
|
||||
from t_doctor where user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.grail.doctor.mapper.UserMapper">
|
||||
|
||||
<select id="userList" resultType="com.grail.domain.model.User">
|
||||
select user_id,
|
||||
user_name,
|
||||
password,
|
||||
oldpassword,
|
||||
user_email,
|
||||
user_avatar,
|
||||
user_invitation,
|
||||
role_id
|
||||
from t_user
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue