登录 增加1.7
parent
7191fd00aa
commit
00aec8337c
|
@ -8,7 +8,7 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.5</version>
|
||||
<version>3.6.6</version>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>base-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
<version>3.6.8</version>
|
||||
<version>3.6.9</version>
|
||||
<artifactId>base-system-remote</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
<version>3.6.4</version>
|
||||
<version>3.6.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface RemoteUserService {
|
|||
|
||||
|
||||
@PostMapping("/user/register/user")
|
||||
public Result<Boolean> registerUser(@RequestBody CommonBody commonBody,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
public Result<Boolean> registerUser(@RequestBody User user,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PostMapping("/user/getEmailCode")
|
||||
public Result getEmailCode(@RequestParam("email") String email,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.health.common.core.user.CommonBody;
|
|||
|
||||
import com.health.system.common.domain.EmailLoginUser;
|
||||
import com.health.system.common.domain.SysUser;
|
||||
import com.health.system.common.domain.User;
|
||||
import com.health.system.common.domain.model.LoginUser;
|
||||
import com.health.system.remote.RemoteUserService;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -43,7 +44,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
}
|
||||
//--------------------------------------------------------------------------
|
||||
@Override
|
||||
public Result<Boolean> registerUser(CommonBody commonBody,String source) {
|
||||
public Result<Boolean> registerUser(User user, String source) {
|
||||
|
||||
return Result.error("薪注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>com.health</groupId>
|
||||
<artifactId>base-system-common</artifactId>
|
||||
<version>3.6.5</version>
|
||||
<version>3.6.6</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
|
|
|
@ -164,9 +164,9 @@ public class SysUserController extends BaseController
|
|||
//----------------------------------------
|
||||
//注册
|
||||
@PostMapping("/register/user")
|
||||
public Result<?> registerUser(@RequestBody CommonBody commonBody){
|
||||
public Result<?> registerUser(@RequestBody User user){
|
||||
|
||||
int i = userService.registerNewUser(commonBody);
|
||||
int i = userService.registerNewUser(user);
|
||||
return i>0?Result.success("","注册成功"):Result.error("注册失败");
|
||||
}
|
||||
|
||||
|
|
|
@ -141,12 +141,12 @@ public interface SysUserMapper {
|
|||
|
||||
|
||||
//为新增用户添加角色
|
||||
void addUserRole(@Param("patientId") int patientId, @Param("roleId") Integer roleId, @Param("i") int i);
|
||||
void addUserRole(@Param("patientId") int patientId, @Param("roleId") Integer roleId);
|
||||
|
||||
//添加新的医生
|
||||
|
||||
//添加患者或者医生公用这个动态sql
|
||||
int insertNewUser(CommonBody commonBody);
|
||||
int insertNewUser(User user);
|
||||
|
||||
//------------------------------------------
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ public interface ISysUserService
|
|||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
|
||||
int registerNewUser(CommonBody commonBody);
|
||||
int registerNewUser(User user);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -560,24 +560,24 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
//-----------------------------
|
||||
@Override
|
||||
@Transactional
|
||||
public int registerNewUser(CommonBody commonBody) {
|
||||
public int registerNewUser(User user) {
|
||||
//默认是患者角色
|
||||
System.out.println("对象是:"+commonBody);
|
||||
System.out.println(commonBody.getGender()+",");
|
||||
System.out.println(commonBody.getAge()+",");
|
||||
System.out.println(commonBody.getHeight()+",");
|
||||
System.out.println(commonBody.getWeight());
|
||||
System.out.println("对象是:"+user);
|
||||
System.out.println(user.getGender()+",");
|
||||
System.out.println(user.getAge()+",");
|
||||
System.out.println(user.getHeight()+",");
|
||||
System.out.println(user.getWeight());
|
||||
int role=101;
|
||||
//添加用户不管是患者还是医生
|
||||
int userId=userMapper.insertNewUser(commonBody);
|
||||
Integer userId1 = commonBody.getUserId();
|
||||
int userId=userMapper.insertNewUser(user);
|
||||
Integer userId1 = user.getUserId();
|
||||
System.out.println("获取的自增userId是"+userId1);
|
||||
//如果角色标识roleId==2的时候再赋值为102
|
||||
if (commonBody.getRoleId()==2){
|
||||
if (user.getDeptId()!=null){
|
||||
role=100;
|
||||
}
|
||||
//为用户添加角色
|
||||
userMapper.addUserRole(userId1,role,commonBody.getRoleId());
|
||||
userMapper.addUserRole(userId1,role);
|
||||
return userId;
|
||||
}
|
||||
|
||||
|
|
|
@ -184,18 +184,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
|
||||
<insert id="addUserRole">
|
||||
insert into tb_user_role values (#{patientId},#{roleId},#{i})
|
||||
insert into tb_user_role values (#{patientId},#{roleId})
|
||||
</insert>
|
||||
|
||||
|
||||
<!--添加患者或者医生公用这个动态sql-->
|
||||
<insert id="insertNewUser" useGeneratedKeys="true" keyProperty="userId" >
|
||||
<choose>
|
||||
<when test="roleId==1">
|
||||
insert into tb_patient
|
||||
|
||||
insert into tb_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null">user_id,</if>
|
||||
<if test="name!=null and name!=''">patient_name,</if>
|
||||
<if test="userName!=null and userName!=''">user_name,</if>
|
||||
<if test="password!=null and password!=''">password,</if>
|
||||
<if test="email!=null and email!=''">email,</if>
|
||||
<if test="inviteCode!=null and inviteCode!=''">invite_code,</if>
|
||||
|
@ -205,52 +204,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="weight!=null">weight,</if>
|
||||
<if test="age!=null">age,</if>
|
||||
<if test="wechatNumber!=null and wechatNumber!=''">wechat_number</if>
|
||||
<if test="hospital!=null and hospital!=''">hospital,</if>
|
||||
<if test="deptId!=null">dept_id,</if>
|
||||
<if test="titleId!=null ">title_id,</if>
|
||||
<if test="introduce!=null and introduce!=''">introduce,</if>
|
||||
<if test="skilled!=null and skilled!=''">skilled,</if>
|
||||
<if test="status!=null">status,</if>
|
||||
</trim>
|
||||
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null">#{userId},</if>
|
||||
<if test="name!=null and name!=''">#{name},</if>
|
||||
<if test="userName!=null and userName!=''">#{userName},</if>
|
||||
<if test="password!=null and password!=''">#{password},</if>
|
||||
<if test="email!=null and email!=''">#{email},</if>
|
||||
<if test="inviteCode!=null and inviteCode!=''">#{inviteCode},</if>
|
||||
<if test="avatar!=null and avatar!=''">#{avatar},</if>
|
||||
<if test="gender!=null">#{gender},</if>
|
||||
<if test="height!=null">#{height},</if>
|
||||
<if test="weight!=null">#{weight},</if>
|
||||
<if test="weight!=null">3{weight},</if>
|
||||
<if test="age!=null">#{age},</if>
|
||||
<if test="wechatNumber!=null and wechatNumber!=''">#{wechatNumber}</if>
|
||||
<if test="wechatNumber!=null and wechatNumber!=''">#{wechaNumber}</if>
|
||||
<if test="hospital!=null and hospital!=''">#{hospital},</if>
|
||||
<if test="deptId!=null">#{deptId},</if>
|
||||
<if test="titleId!=null ">#{titleId},</if>
|
||||
<if test="introduce!=null and introduce!=''">#{introduce},</if>
|
||||
<if test="skilled!=null and skilled!=''">#{skilled},</if>
|
||||
<if test="status!=null">#{status},</if>
|
||||
</trim>
|
||||
</when>
|
||||
<otherwise>
|
||||
insert into tb_doctor
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null"> user_id,</if>
|
||||
<if test="name!=null and name!=''">doctor_name,</if>
|
||||
<if test="password!=null and password!=''">password,</if>
|
||||
<if test="email!=null and email!=''">email,</if>
|
||||
<if test="hospital!=null and hospital!=''">hospital,</if>
|
||||
<if test="deptId!=null">dept_id,</if>
|
||||
<if test="titleId!=null ">title_id,</if>
|
||||
<if test="introduce!=null and introduce!=''">introduce,</if>
|
||||
<if test="skilled!=null and skilled!=''">skilled,</if>
|
||||
<if test="avatar!=null and avatar!=''">avatar,</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId!=null"> #{userId},</if>
|
||||
<if test="name!=null and name!=''">#{name},</if>
|
||||
<if test="password!=null and password!=''">#{password},</if>
|
||||
<if test="email!=null and email!=''">#{email},</if>
|
||||
<if test="hospital!=null and hospital!=''">#{hospital},</if>
|
||||
<if test="deptId!=null">#{deptId},</if>
|
||||
<if test="titleId!=null ">#{titleId},</if>
|
||||
<if test="introduce!=null and introduce!=''">#{introduce},</if>
|
||||
<if test="skilled!=null and skilled!=''">#{skilled},</if>
|
||||
<if test="avatar!=null and avatar!=''">#{avatar},</if>
|
||||
</trim>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
|
|
Loading…
Reference in New Issue