场景:我在模糊查询电话号码的时候,发现电话号码是进行过加密的,而传进来的参数却是明文的

明文参数:2352

在这里插入图片描述
数据库是加密的:
在这里插入图片描述
解决办法:
在这里插入图片描述

<if test="monitorManagerListParam.phoneNumber != null and monitorManagerListParam.phoneNumber != ''">
     AND   AES_DECRYPT(UNHEX( cmm.PHONE_NUMBER), "加密密钥") like CONCAT('%',#{monitorManagerListParam.phoneNumber},'%')
</if>

如果模糊搜索带中文,那需要如下代码:

在这里插入图片描述

<if test="monitorManagerListParam.keyWordThree != null and monitorManagerListParam.keyWordThree != ''">
        AND CAST(binary(AES_DECRYPT(UNHEX(cmm.MESSAGE),"加密密钥"))
        AS CHAR CHARACTER SET UTF8)
        LIKE CONCAT('%',#{monitorManagerListParam.keyWordThree},'%')
</if>
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐