add register code
parent
56a1c1f035
commit
92b014a3cd
|
@ -153,12 +153,14 @@ public class SysUserController extends BaseController
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
//注册
|
//注册
|
||||||
@PostMapping("/register/user")
|
@PostMapping("/register/user")
|
||||||
public Result<Boolean> registerUser(@RequestBody CommonBody commonBody){
|
public Result<?> registerUser(@RequestBody CommonBody commonBody){
|
||||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||||
{
|
// {
|
||||||
return Result.error("当前系统没有开启注册功能!");
|
// return Result.error("当前系统没有开启注册功能!");
|
||||||
}
|
// }
|
||||||
return Result.success(userService.registerNewUser(commonBody));
|
|
||||||
|
int i = userService.registerNewUser(commonBody);
|
||||||
|
return i>0?Result.success("","注册成功"):Result.error("注册失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,5 +133,13 @@ public interface SysUserMapper {
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
int insertNewUser(CommonBody commonBody);
|
|
||||||
|
//添新的患者
|
||||||
|
int insertPatient(CommonBody commonBody);
|
||||||
|
|
||||||
|
//为新增用户添加角色
|
||||||
|
void addUserRole(int patientId, Integer roleId, int i);
|
||||||
|
|
||||||
|
//添加新的医生
|
||||||
|
int insertDoctor(CommonBody commonBody);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,5 +210,5 @@ public interface ISysUserService
|
||||||
|
|
||||||
Result getEmailCode(String email);
|
Result getEmailCode(String email);
|
||||||
|
|
||||||
Boolean registerNewUser(CommonBody commonBody);
|
int registerNewUser(CommonBody commonBody);
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,10 +578,28 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
|
|
||||||
//-----------------------------
|
//-----------------------------
|
||||||
@Override
|
@Override
|
||||||
public Boolean registerNewUser(CommonBody commonBody) {
|
@Transactional
|
||||||
int i= userMapper.insertNewUser(commonBody);
|
public int registerNewUser(CommonBody commonBody) {
|
||||||
|
|
||||||
return null;
|
|
||||||
|
//1证明是患者 不用审核直接注册成功
|
||||||
|
if (commonBody.getRoleId()==1){
|
||||||
|
//先添加患者表
|
||||||
|
int patientId= userMapper.insertPatient(commonBody);
|
||||||
|
//添加用户角色
|
||||||
|
userMapper.addUserRole(patientId,commonBody.getRoleId(),101);
|
||||||
|
|
||||||
|
return patientId;
|
||||||
|
}
|
||||||
|
//2证明是医生则需要审核
|
||||||
|
if (commonBody.getRoleId()==2){
|
||||||
|
|
||||||
|
int doctorId= userMapper.insertDoctor(commonBody);
|
||||||
|
//添加用户角色
|
||||||
|
userMapper.addUserRole(doctorId,commonBody.getRoleId(),100);
|
||||||
|
return doctorId;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<!--新增用户-->
|
<!--添加新患者-->
|
||||||
<insert id="insertNewUser"></insert>
|
<insert id="insertPatient">
|
||||||
|
insert into tb_patient values (#{name},#{password},#{email},#{6666},#{avatar},#{gender},#{height},#{weight},#{age},#{wechatNumber})
|
||||||
|
<!--为用户添加角色-->
|
||||||
|
</insert>
|
||||||
|
<insert id="addUserRole"></insert>
|
||||||
|
|
||||||
|
<!--添加新的医生-->
|
||||||
|
<insert id="insertDoctor"></insert>
|
||||||
|
|
||||||
<update id="updateUser" parameterType="SysUser">
|
<update id="updateUser" parameterType="SysUser">
|
||||||
update sys_user
|
update sys_user
|
||||||
|
|
Loading…
Reference in New Issue