package com.ruoyi.common.orm.decipher;

import com.mybatisflex.core.datasource.DataSourceDecipher;
import com.mybatisflex.core.datasource.DataSourceProperty;

/**
 * 数据源解密
 *
 * @author dataprince数据小王子
 */
public class Decipher implements DataSourceDecipher {
    @Override
    public String decrypt(DataSourceProperty property, String value) {
        //解密用户名，通过编码支持任意加密方式的解密
        if (property == DataSourceProperty.USERNAME) {
            return value.substring(0, 4);
        }
        //解密密码
        else if (property == DataSourceProperty.PASSWORD) {
            return value.substring(0, 8);
        }
        return value;
    }
}
