Skip to content

Commit

Permalink
fix: 修复部分因字段加密导致的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Feb 9, 2024
1 parent 6435175 commit 43da462
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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:https://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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

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
Expand All @@ -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);

/**
* 根据邮箱查询
Expand All @@ -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 查询昵称
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand Down Expand Up @@ -65,13 +64,13 @@ public class UserDO extends BaseDO {
/**
* 邮箱
*/
@FieldEncrypt(Algorithm.AES)
@FieldEncrypt
private String email;

/**
* 手机号码
*/
@FieldEncrypt(Algorithm.AES)
@FieldEncrypt
private String phone;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down

0 comments on commit 43da462

Please sign in to comment.