添加用户注册
parent
1608b66fad
commit
87204c512e
|
@ -130,4 +130,8 @@ public class SysDeptController extends BaseController
|
|||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -171,10 +171,22 @@ public class SysUserController extends BaseController
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
* 注册
|
||||
*/
|
||||
|
||||
@InnerAuth
|
||||
@PostMapping("/healthRegister")
|
||||
public R<Boolean> healthRegister(@RequestBody SysUser sysUser){
|
||||
if(!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))){
|
||||
return R.fail("当前系统没有开启注册功能");
|
||||
}
|
||||
if(!userService.checkEmailUnique(sysUser)){
|
||||
return R.fail("保存用户'" + sysUser.getEmail() + "'失败,注册账号已存在");
|
||||
}
|
||||
return R.ok(userService.healthRegister(sysUser));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
|
@ -190,6 +202,22 @@ public class SysUserController extends BaseController
|
|||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 维度健康获取用户信息
|
||||
* */
|
||||
@GetMapping("healthGetInfo")
|
||||
public AjaxResult healthGetInfo(){
|
||||
SysUser user = userService.selectHealthUserById(SecurityUtils.getUserId());
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
||||
Set<String> permission = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user",user);
|
||||
ajax.put("roles",roles);
|
||||
ajax.put("permission",permission);
|
||||
return ajax;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
|
|
|
@ -144,4 +144,10 @@ public interface SysUserMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public SysUser selectByEmail(String email);
|
||||
|
||||
Boolean selectHealthUserId(SysUser sysUser);
|
||||
|
||||
public int insertHealthUser(SysUser sysUser);
|
||||
|
||||
SysUser selectHealthUserById(Long userId);
|
||||
}
|
||||
|
|
|
@ -208,4 +208,8 @@ public interface ISysUserService
|
|||
SysUser selectUserByUserName(String userName);
|
||||
|
||||
SysUser selectByEmail(String email);
|
||||
|
||||
public boolean healthRegister(SysUser sysUser);
|
||||
|
||||
public SysUser selectHealthUserById(Long userId);
|
||||
}
|
||||
|
|
|
@ -549,4 +549,24 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.selectByEmail(email);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean healthRegister(SysUser sysUser) {
|
||||
System.out.println(sysUser);
|
||||
int i = userMapper.insertHealthUser(sysUser);
|
||||
Long userId = sysUser.getUserId();
|
||||
Long[] logs =new Long[]{sysUser.getUserId()};
|
||||
insertUserRole(userId,logs);
|
||||
|
||||
if(i>0 && sysUser.getRoleId() == 101 && StringUtils.isNotNull(sysUser.getInvitationCode())){
|
||||
System.out.println("等待接口开放");
|
||||
}
|
||||
return i>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser selectHealthUserById(Long userId) {
|
||||
return userMapper.selectHealthUserById(userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -136,10 +136,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
|
@ -165,36 +161,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectUserVo"/>
|
||||
where u.email = #{email} and u.del_flag = '0'
|
||||
</select>
|
||||
<select id="selectHealthUserById" resultType="com.four.system.api.domain.SysUser">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="user_id != null and userId != 0">user_id,</if>
|
||||
<if test="dept_id != null and deptId != 0">dept_id,</if>
|
||||
<if test="user_name != null and userName != ''">user_name,</if>
|
||||
<if test="nick_name != null and nickName != ''">nick_name,</if>
|
||||
<if test="user_type != null and userType != ''">user_type,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="del_flag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="login_ip != null and loginIp != ''">login_ip,</if>
|
||||
<if test="login_date != null and loginDate != ''">login_date,</if>
|
||||
<if test="create_by != null and createBy != ''">create_by,</if>
|
||||
<if test="create_time != null and createTime != ''">create_time,</if>
|
||||
<if test="update_by != null and updateBy != ''">update_by,</if>
|
||||
<if test="update_time != null and updateTime != ''">update_time,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="user_sign != null and userSign != ''">user_sign,</if>
|
||||
<if test="bind_wechat_status != null and bindWechatStatus != ''">bind_wechat_status,</if>
|
||||
<if test="real_name_authentication_status != null and realNameAuthenticationStatus != ''">real_name_authentication_status,</if>
|
||||
<if test="bind_bank_card_status != null and bindBankCardStatus != ''">bind_bank_card_status,</if>
|
||||
<if test="user_money != null and userMoney != ''">user_money,</if>
|
||||
<if test="invitation_code != null and invitationCode != ''">invitation_code,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="user_id != null and user_id != 0">#{userId},</if>
|
||||
<if test="dept_id != null and dept_id != 0">#{deptId},</if>
|
||||
<if test="user_name != null and user_name != ''">#{userName},</if>
|
||||
<if test="nick_name != null and nick_name != ''">#{nickName},</if>
|
||||
<if test="user_type != null and user_type != ''">#{userType},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="del_flag != null and del_flag != ''">#{delFlag},</if>
|
||||
<if test="login_ip != null and login_ip != ''">#{loginIp},</if>
|
||||
<if test="login_date != null and login_date != ''">#{loginDate},</if>
|
||||
<if test="create_by != null and create_by != ''">#{createBy},</if>
|
||||
<if test="create_time != null and create_time != ''">#{createTime},</if>
|
||||
<if test="update_by != null and update_by != ''">#{updateBy},</if>
|
||||
<if test="update_time != null and update_time != ''">#{updateTime},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="user_sign != null and user_sign != ''">#{userSign},</if>
|
||||
<if test="bind_wechat_status != null and bind_wechat_status != ''">#{bindWechatStatus},</if>
|
||||
<if test="real_name_authentication_status != null and real_name_authentication_status != ''">#{realNameAuthenticationStatus},</if>
|
||||
<if test="bind_bank_card_status != null and bind_bank_card_status != ''">#{bindBankCardStatus},</if>
|
||||
<if test="user_money != null and user_money != ''">#{userMoney},</if>
|
||||
<if test="invitation_code != null and invitation_code != ''">#{invitationCode},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
Loading…
Reference in New Issue