Files
usdt/ruoyi-system/src/main/resources/mapper/system/UsdtConfigMapper.xml
T
2026-10-08 04:36:53 -04:00

158 lines
9.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.UsdtConfigMapper">
<resultMap type="UsdtConfig" id="UsdtConfigResult">
<result property="id" column="id" />
<result property="payUsdtNum" column="pay_usdt_num" />
<result property="receiveUsdtNum" column="receive_usdt_num" />
<result property="tronNetType" column="tron_net_type" />
<result property="version" column="version" />
<result property="encryptionAlgorithm" column="encryption_algorithm" />
<result property="passwordKdf" column="password_kdf" />
<result property="iterations" column="iterations" />
<result property="encryptedMnemonic" column="encrypted_mnemonic" />
<result property="mnemonicNonce" column="mnemonic_nonce" />
<result property="encryptedDek" column="encrypted_dek" />
<result property="dekNonce" column="dek_nonce" />
<result property="keySalt" column="key_salt" />
<result property="passwordSalt" column="password_salt" />
<result property="passwordHash" column="password_hash" />
<result property="rotatedAt" column="rotated_at" />
<result property="trxNum" column="trx_num" />
<result property="tokenAddress" column="token_address" />
</resultMap>
<sql id="selectUsdtConfigVo">
select id, pay_usdt_num, receive_usdt_num, tron_net_type, version, encryption_algorithm, password_kdf, iterations, encrypted_mnemonic, mnemonic_nonce, encrypted_dek, dek_nonce, key_salt, password_salt, password_hash, rotated_at, trx_num, token_address from usdt_config
</sql>
<select id="selectUsdtConfigList" parameterType="UsdtConfig" resultMap="UsdtConfigResult">
<include refid="selectUsdtConfigVo"/>
<where>
<if test="payUsdtNum != null "> and pay_usdt_num = #{payUsdtNum}</if>
<if test="receiveUsdtNum != null "> and receive_usdt_num = #{receiveUsdtNum}</if>
<if test="tronNetType != null "> and tron_net_type = #{tronNetType}</if>
<if test="version != null "> and version = #{version}</if>
<if test="encryptionAlgorithm != null and encryptionAlgorithm != ''"> and encryption_algorithm = #{encryptionAlgorithm}</if>
<if test="passwordKdf != null and passwordKdf != ''"> and password_kdf = #{passwordKdf}</if>
<if test="iterations != null "> and iterations = #{iterations}</if>
<if test="encryptedMnemonic != null and encryptedMnemonic != ''"> and encrypted_mnemonic = #{encryptedMnemonic}</if>
<if test="mnemonicNonce != null and mnemonicNonce != ''"> and mnemonic_nonce = #{mnemonicNonce}</if>
<if test="encryptedDek != null and encryptedDek != ''"> and encrypted_dek = #{encryptedDek}</if>
<if test="dekNonce != null and dekNonce != ''"> and dek_nonce = #{dekNonce}</if>
<if test="keySalt != null and keySalt != ''"> and key_salt = #{keySalt}</if>
<if test="passwordSalt != null and passwordSalt != ''"> and password_salt = #{passwordSalt}</if>
<if test="passwordHash != null and passwordHash != ''"> and password_hash = #{passwordHash}</if>
<if test="rotatedAt != null "> and rotated_at = #{rotatedAt}</if>
<if test="trxNum != null "> and trx_num = #{trxNum}</if>
<if test="tokenAddress != null and tokenAddress != ''"> and token_address = #{tokenAddress}</if>
</where>
</select>
<select id="selectUsdtConfigById" parameterType="Long" resultMap="UsdtConfigResult">
<include refid="selectUsdtConfigVo"/>
where id = #{id}
</select>
<select id="selectFirstForUpdate" resultMap="UsdtConfigResult">
<include refid="selectUsdtConfigVo"/>
order by id asc limit 1 for update
</select>
<update id="rotateEnvelope">
update usdt_config
set version = #{config.version},
encryption_algorithm = #{config.encryptionAlgorithm},
password_kdf = #{config.passwordKdf},
iterations = #{config.iterations},
encrypted_dek = #{config.encryptedDek},
dek_nonce = #{config.dekNonce},
key_salt = #{config.keySalt},
password_salt = #{config.passwordSalt},
password_hash = #{config.passwordHash},
rotated_at = #{config.rotatedAt}
where id = #{config.id}
and version = #{oldVersion}
</update>
<insert id="insertUsdtConfig" parameterType="UsdtConfig" useGeneratedKeys="true" keyProperty="id">
insert into usdt_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="payUsdtNum != null">pay_usdt_num,</if>
<if test="receiveUsdtNum != null">receive_usdt_num,</if>
<if test="tronNetType != null">tron_net_type,</if>
<if test="version != null">version,</if>
<if test="encryptionAlgorithm != null and encryptionAlgorithm != ''">encryption_algorithm,</if>
<if test="passwordKdf != null and passwordKdf != ''">password_kdf,</if>
<if test="iterations != null">iterations,</if>
<if test="encryptedMnemonic != null and encryptedMnemonic != ''">encrypted_mnemonic,</if>
<if test="mnemonicNonce != null and mnemonicNonce != ''">mnemonic_nonce,</if>
<if test="encryptedDek != null and encryptedDek != ''">encrypted_dek,</if>
<if test="dekNonce != null and dekNonce != ''">dek_nonce,</if>
<if test="keySalt != null and keySalt != ''">key_salt,</if>
<if test="passwordSalt != null and passwordSalt != ''">password_salt,</if>
<if test="passwordHash != null and passwordHash != ''">password_hash,</if>
<if test="rotatedAt != null">rotated_at,</if>
<if test="trxNum != null">trx_num,</if>
<if test="tokenAddress != null">token_address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="payUsdtNum != null">#{payUsdtNum},</if>
<if test="receiveUsdtNum != null">#{receiveUsdtNum},</if>
<if test="tronNetType != null">#{tronNetType},</if>
<if test="version != null">#{version},</if>
<if test="encryptionAlgorithm != null and encryptionAlgorithm != ''">#{encryptionAlgorithm},</if>
<if test="passwordKdf != null and passwordKdf != ''">#{passwordKdf},</if>
<if test="iterations != null">#{iterations},</if>
<if test="encryptedMnemonic != null and encryptedMnemonic != ''">#{encryptedMnemonic},</if>
<if test="mnemonicNonce != null and mnemonicNonce != ''">#{mnemonicNonce},</if>
<if test="encryptedDek != null and encryptedDek != ''">#{encryptedDek},</if>
<if test="dekNonce != null and dekNonce != ''">#{dekNonce},</if>
<if test="keySalt != null and keySalt != ''">#{keySalt},</if>
<if test="passwordSalt != null and passwordSalt != ''">#{passwordSalt},</if>
<if test="passwordHash != null and passwordHash != ''">#{passwordHash},</if>
<if test="rotatedAt != null">#{rotatedAt},</if>
<if test="trxNum != null">#{trxNum},</if>
<if test="tokenAddress != null">#{tokenAddress},</if>
</trim>
</insert>
<update id="updateUsdtConfig" parameterType="UsdtConfig">
update usdt_config
<trim prefix="SET" suffixOverrides=",">
<if test="payUsdtNum != null">pay_usdt_num = #{payUsdtNum},</if>
<if test="receiveUsdtNum != null">receive_usdt_num = #{receiveUsdtNum},</if>
<if test="tronNetType != null">tron_net_type = #{tronNetType},</if>
<if test="version != null">version = #{version},</if>
<if test="encryptionAlgorithm != null and encryptionAlgorithm != ''">encryption_algorithm = #{encryptionAlgorithm},</if>
<if test="passwordKdf != null and passwordKdf != ''">password_kdf = #{passwordKdf},</if>
<if test="iterations != null">iterations = #{iterations},</if>
<if test="encryptedMnemonic != null and encryptedMnemonic != ''">encrypted_mnemonic = #{encryptedMnemonic},</if>
<if test="mnemonicNonce != null and mnemonicNonce != ''">mnemonic_nonce = #{mnemonicNonce},</if>
<if test="encryptedDek != null and encryptedDek != ''">encrypted_dek = #{encryptedDek},</if>
<if test="dekNonce != null and dekNonce != ''">dek_nonce = #{dekNonce},</if>
<if test="keySalt != null and keySalt != ''">key_salt = #{keySalt},</if>
<if test="passwordSalt != null and passwordSalt != ''">password_salt = #{passwordSalt},</if>
<if test="passwordHash != null and passwordHash != ''">password_hash = #{passwordHash},</if>
<if test="rotatedAt != null">rotated_at = #{rotatedAt},</if>
<if test="trxNum != null">trx_num = #{trxNum},</if>
<if test="tokenAddress != null">token_address = #{tokenAddress},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteUsdtConfigById" parameterType="Long">
delete from usdt_config where id = #{id}
</delete>
<delete id="deleteUsdtConfigByIds" parameterType="String">
delete from usdt_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>