用户查询修改

This commit is contained in:
lhx
2025-12-17 15:39:16 +08:00
parent c0c95ed1f8
commit d78250aad8
3 changed files with 16 additions and 6 deletions

View File

@@ -14,10 +14,12 @@ public class CorsConfig {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 允许所有路径
.allowedOrigins("http://localhost:8080", // 你的前端开发服务器地址
"http://localhost:3000",
"http://localhost:8000",
"https://www.yourfrontend.com" ) // 允许的来源(可修改为前端地址)
//.allowedOrigins("http://localhost:8080",
// "http://127.0.0.1:8080",
// "http://localhost:3000",
// "http://localhost:8000",
// "https://www.yourfrontend.com" )
.allowedOriginPatterns("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // 允许的请求方法
.allowedHeaders("*") // 允许所有请求头
.allowCredentials(false); // 允许携带 Cookie

View File

@@ -155,6 +155,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
if(personnel.getUserId() != null){
return ResponseResult.error("已存在用户账号");
}
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<User>()
.eq(User::getPhone, userDto.getPhone())
.eq(User::getIsDeleted, 0);
if(baseMapper.exists(queryWrapper)){
return ResponseResult.error("手机号已存在");
}
if(userDto.getPassword() == null){
userDto.setPassword(userDto.getPhone());
}

View File

@@ -73,10 +73,12 @@
AND u.status = #{userReqDto.status}
</if>
<if test="orgIds != null">
AND o.id in (#{orgIds})
o.id in
<foreach item="item" collection="orgIds" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and u.is_deleted = 0
</where>
limit #{userReqDto.current},#{userReqDto.size}
</select>
</mapper>