fix: 修复部分因字段加密导致的错误

This commit is contained in:
Charles7c 2024-02-09 09:58:28 +08:00
parent 6435175dc3
commit 43da462560
4 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package top.charles7c.continew.admin.common.config.mybatis;
import org.springframework.security.crypto.password.PasswordEncoder;

View File

@ -21,6 +21,7 @@ import org.apache.ibatis.annotations.Select;
import top.charles7c.continew.admin.common.config.mybatis.DataPermissionMapper;
import top.charles7c.continew.admin.system.model.entity.UserDO;
import top.charles7c.continew.starter.security.crypto.annotation.FieldEncrypt;
/**
* 用户 Mapper
@ -46,7 +47,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
* @return 用户信息
*/
@Select("SELECT * FROM `sys_user` WHERE `phone` = #{phone}")
UserDO selectByPhone(@Param("phone") String phone);
UserDO selectByPhone(@FieldEncrypt @Param("phone") String phone);
/**
* 根据邮箱查询
@ -55,7 +56,7 @@ public interface UserMapper extends DataPermissionMapper<UserDO> {
* @return 用户信息
*/
@Select("SELECT * FROM `sys_user` WHERE `email` = #{email}")
UserDO selectByEmail(@Param("email") String email);
UserDO selectByEmail(@FieldEncrypt @Param("email") String email);
/**
* 根据 ID 查询昵称

View File

@ -23,7 +23,6 @@ import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum;
import top.charles7c.continew.admin.common.enums.GenderEnum;
import top.charles7c.continew.starter.extension.crud.model.entity.BaseDO;
import top.charles7c.continew.starter.security.crypto.annotation.FieldEncrypt;
import top.charles7c.continew.starter.security.crypto.enums.Algorithm;
import java.io.Serial;
import java.time.LocalDateTime;
@ -65,13 +64,13 @@ public class UserDO extends BaseDO {
/**
* 邮箱
*/
@FieldEncrypt(Algorithm.AES)
@FieldEncrypt
private String email;
/**
* 手机号码
*/
@FieldEncrypt(Algorithm.AES)
@FieldEncrypt
private String phone;
/**

View File

@ -45,7 +45,7 @@ public class UserQuery implements Serializable {
* 用户名
*/
@Schema(description = "用户名", example = "zhangsan")
@Query(columns = {"username", "nickname", "email", "phone"}, type = QueryType.LIKE)
@Query(columns = {"username", "nickname"}, type = QueryType.LIKE)
private String username;
/**