使用环境:
sharding-jdbc5.0 + mybatis Plus3.4 + spring boot
spring.shardingsphere.encrypt.tables.person.columns.credentials_number.plainColumn=credentials_number
spring.shardingsphere.encrypt.tables.person.columns.credentials_number.cipherColumn=credentials_number_ency
spring.shardingsphere.encrypt.tables.person.columns.credentials_number.encryptor=custom_encryptor_aes
spring.shardingsphere.props.query.with.cipher.column=true
场景、问题:
在使用sharding对数据库证件号字段加密之后, 根据证件号查询,计算count时并没有将sql逻辑列转为密文列。
而查询单条记录时,会将逻辑列sql转为密文列。
结论
在使用mybatis的分页查询时,对加密字段不兼容