Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
3a1beee46f
@ -10,5 +10,11 @@ public class ChangePasswordDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String newPassword;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
long existUserByAccount(@Param("account") String account);
|
||||
IPage<SysUserVo> queryUserList(IPage<SysUserVo> page, @Param("sysUser") SysUserQueryDto sysUserQueryDto);
|
||||
|
||||
long existUserByUserName(@Param("userName") String userName);
|
||||
/**
|
||||
* 根据用户id查询权限列表
|
||||
* @param userId 用户id
|
||||
|
@ -135,15 +135,21 @@ public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@Override
|
||||
public int changePassword(ChangePasswordDto changePasswordDto) {
|
||||
if (changePasswordDto.getId() == null || StringUtils.isEmpty(changePasswordDto.getNewPassword())) {
|
||||
if (changePasswordDto.getId() == null) {
|
||||
throw new ServiceException("非法调用,参数缺失");
|
||||
}
|
||||
String passwordEncode = BCrypt.hashpw(changePasswordDto.getNewPassword(), BCrypt.gensalt());
|
||||
SysUser sysUser = sysUserMapper.selectById(changePasswordDto.getId());
|
||||
if (sysUser == null) {
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
sysUser.setPassword(passwordEncode);
|
||||
String newPassword ="";
|
||||
if (!StringUtils.isEmpty(changePasswordDto.getNewPassword())) {
|
||||
newPassword = BCrypt.hashpw(changePasswordDto.getNewPassword(), BCrypt.gensalt());
|
||||
}
|
||||
sysUser.setUserName(changePasswordDto.getUserName());
|
||||
sysUser.setEmail(changePasswordDto.getEmail());
|
||||
sysUser.setPhone(changePasswordDto.getPhone());
|
||||
sysUser.setPassword(newPassword);
|
||||
sysUser.setUpdatedTime(new Date());
|
||||
return sysUserMapper.updateById(sysUser);
|
||||
}
|
||||
|
@ -126,13 +126,13 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
if (sysUser == null) {
|
||||
throw new ServiceException(String.format("账号 %d 不存在", sysUserDto.getId()));
|
||||
}
|
||||
if (StringUtils.hasText(sysUserDto.getUserName())) {
|
||||
if (StringUtils.hasText(sysUserDto.getAccount())) {
|
||||
//若与数据库中账户名相同 则表示未对名称进行修改
|
||||
if (!sysUser.getUserName().equals(sysUserDto.getUserName())) {
|
||||
if (!sysUser.getAccount().equals(sysUserDto.getAccount())) {
|
||||
//判断账户名是否存在
|
||||
long userCount = sysUserMapper.existUserByUserName(sysUserDto.getUserName());
|
||||
long userCount = sysUserMapper.existUserByAccount(sysUserDto.getAccount());
|
||||
if (userCount > 0) {
|
||||
throw new ServiceException(String.format("账户名 %s 已存在", sysUserDto.getUserName()));
|
||||
throw new ServiceException(String.format("账户名 %s 已存在", sysUserDto.getAccount()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,6 @@
|
||||
select count(1) from sys_user t where t.account=#{account}
|
||||
</select>
|
||||
|
||||
<select id="existUserByUserName" resultType="java.lang.Long">
|
||||
select count(1) from sys_user t where t.user_name=#{userName}
|
||||
</select>
|
||||
|
||||
<select id="queryRoleByUserId" resultMap="UserRoleRelationMap">
|
||||
select sr.role_code,sr.role_name ,sr.id ,sr.revision from sys_role sr left join sys_r_user_role srur on sr.id = srur.role_id
|
||||
where srur.user_id = #{id}
|
||||
|
@ -5,9 +5,11 @@ ENV = 'development'
|
||||
VITE_BASE_PATH = './'
|
||||
|
||||
# 代理配置(开发使用),必须在一行中
|
||||
|
||||
# 本地
|
||||
# VITE_APP_PROXY=[["/api","http://192.168.130.12:8080/api"]]
|
||||
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
||||
# 线上
|
||||
VITE_APP_PROXY=[["/api","http://192.168.109.195:8080/api"]]
|
||||
|
||||
|
||||
|
||||
# 开发环境下跨域代理,请输入要跨域的api地址 - 尾部无需带'/'
|
||||
|
@ -270,14 +270,19 @@ const props = {
|
||||
|
||||
const loadNode = (node: Node, resolve: (data: Tree[]) => void) => {
|
||||
if (node.level === 0) {
|
||||
return resolve([])
|
||||
}
|
||||
if (node.level > 1) return resolve([])
|
||||
|
||||
setTimeout(() => {
|
||||
const data: Tree[] = []
|
||||
|
||||
resolve(data)
|
||||
}, 500)
|
||||
const fromParameter = {
|
||||
parentMenuId: node.data.id,
|
||||
recursive: false,
|
||||
}
|
||||
menusTree(fromParameter)
|
||||
.then((res: any) => {
|
||||
return resolve(res.data)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
// 菜单搜索查询
|
||||
const input2 = ref('')
|
||||
|
Loading…
Reference in New Issue
Block a user