268 lines
18 KiB
XML
268 lines
18 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.WalletAddressMapper">
|
|
|
|
<resultMap type="WalletAddress" id="WalletAddressResult">
|
|
<result property="id" column="id" />
|
|
<result property="token" column="token" />
|
|
<result property="status" column="status" />
|
|
<result property="createdAt" column="created_at" />
|
|
<result property="updatedAt" column="updated_at" />
|
|
<result property="deletedAt" column="deleted_at" />
|
|
<result property="appId" column="app_id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="walletUserName" column="wallet_user_name" />
|
|
<result property="tokenIndex" column="token_index" />
|
|
<result property="usdtBalance" column="usdt_balance" />
|
|
<result property="trxBalance" column="trx_balance" />
|
|
<result property="energyNum" column="energy_num" />
|
|
<result property="energyAllNum" column="energy_all_num" />
|
|
<result property="energyUsedNum" column="energy_used_num" />
|
|
<result property="bandwidthNum" column="bandwidth_num" />
|
|
<result property="delegatedEnergyTrxNum" column="delegated_energy_trx_num" />
|
|
<result property="delegatedEnergyValue" column="delegated_energy_value" />
|
|
<result property="acquiredDelegatedEnergyTrxNum" column="acquired_delegated_energy_trx_num" />
|
|
<result property="acquiredDelegatedEnergyValue" column="acquired_delegated_energy_value" />
|
|
<result property="delegatedBandwidthTrxNum" column="delegated_bandwidth_trx_num" />
|
|
<result property="delegatedBandwidthValue" column="delegated_bandwidth_value" />
|
|
<result property="acquiredDelegatedBandwidthTrxNum" column="acquired_delegated_bandwidth_trx_num" />
|
|
<result property="acquiredDelegatedBandwidthValue" column="acquired_delegated_bandwidth_value" />
|
|
<result property="stakedTrxNum" column="staked_trx_num" />
|
|
<result property="energyStakedTrxNum" column="energy_staked_trx_num" />
|
|
<result property="bandwidthStakedTrxNum" column="bandwidth_staked_trx_num" />
|
|
<result property="voteNum" column="vote_num" />
|
|
<result property="votedNum" column="voted_num" />
|
|
<result property="bandwidthStakedNum" column="bandwidth_staked_num" />
|
|
<result property="bandwidthStakedAllNum" column="bandwidth_staked_all_num" />
|
|
<result property="bandwidthFreeNum" column="bandwidth_free_num" />
|
|
<result property="bandwidthFreeAllNum" column="bandwidth_free_all_num" />
|
|
</resultMap>
|
|
|
|
<resultMap type="com.ruoyi.system.domain.WalletAddressPlus" id="WalletAddressPlusResult">
|
|
<id property="id" column="id"/>
|
|
<result property="token" column="token"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createdAt" column="created_at"/>
|
|
<result property="updatedAt" column="updated_at"/>
|
|
<result property="deletedAt" column="deleted_at"/>
|
|
<result property="appId" column="app_id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="walletUserName" column="wallet_user_name"/>
|
|
<result property="tokenIndex" column="token_index"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectWalletAddressVo">
|
|
select id, token, status, created_at, updated_at, deleted_at, app_id, user_id, wallet_user_name, token_index, usdt_balance, trx_balance, energy_num, energy_all_num, energy_used_num, bandwidth_num, delegated_energy_trx_num, delegated_energy_value, acquired_delegated_energy_trx_num, acquired_delegated_energy_value, delegated_bandwidth_trx_num, delegated_bandwidth_value, acquired_delegated_bandwidth_trx_num, acquired_delegated_bandwidth_value, staked_trx_num, energy_staked_trx_num, bandwidth_staked_trx_num, vote_num, voted_num, bandwidth_staked_num, bandwidth_staked_all_num, bandwidth_free_num, bandwidth_free_all_num from wallet_address
|
|
</sql>
|
|
|
|
<select id="selectWalletAddressList" parameterType="WalletAddress" resultMap="WalletAddressResult">
|
|
<include refid="selectWalletAddressVo"/>
|
|
<where>
|
|
<if test="token != null and token != ''"> and token = #{token}</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
|
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
|
|
<if test="deletedAt != null "> and deleted_at = #{deletedAt}</if>
|
|
<if test="appId != null "> and app_id = #{appId}</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="walletUserName != null and walletUserName != ''"> and wallet_user_name like concat('%', #{walletUserName}, '%')</if>
|
|
<if test="tokenIndex != null and tokenIndex != ''"> and token_index = #{tokenIndex}</if>
|
|
<if test="usdtBalance != null "> and usdt_balance = #{usdtBalance}</if>
|
|
<if test="trxBalance != null "> and trx_balance = #{trxBalance}</if>
|
|
<if test="energyNum != null "> and energy_num = #{energyNum}</if>
|
|
<if test="energyAllNum != null "> and energy_all_num = #{energyAllNum}</if>
|
|
<if test="energyUsedNum != null "> and energy_used_num = #{energyUsedNum}</if>
|
|
<if test="bandwidthNum != null "> and bandwidth_num = #{bandwidthNum}</if>
|
|
<if test="delegatedEnergyTrxNum != null "> and delegated_energy_trx_num = #{delegatedEnergyTrxNum}</if>
|
|
<if test="delegatedEnergyValue != null "> and delegated_energy_value = #{delegatedEnergyValue}</if>
|
|
<if test="acquiredDelegatedEnergyTrxNum != null "> and acquired_delegated_energy_trx_num = #{acquiredDelegatedEnergyTrxNum}</if>
|
|
<if test="acquiredDelegatedEnergyValue != null "> and acquired_delegated_energy_value = #{acquiredDelegatedEnergyValue}</if>
|
|
<if test="delegatedBandwidthTrxNum != null "> and delegated_bandwidth_trx_num = #{delegatedBandwidthTrxNum}</if>
|
|
<if test="delegatedBandwidthValue != null "> and delegated_bandwidth_value = #{delegatedBandwidthValue}</if>
|
|
<if test="acquiredDelegatedBandwidthTrxNum != null "> and acquired_delegated_bandwidth_trx_num = #{acquiredDelegatedBandwidthTrxNum}</if>
|
|
<if test="acquiredDelegatedBandwidthValue != null "> and acquired_delegated_bandwidth_value = #{acquiredDelegatedBandwidthValue}</if>
|
|
<if test="stakedTrxNum != null "> and staked_trx_num = #{stakedTrxNum}</if>
|
|
<if test="energyStakedTrxNum != null "> and energy_staked_trx_num = #{energyStakedTrxNum}</if>
|
|
<if test="bandwidthStakedTrxNum != null "> and bandwidth_staked_trx_num = #{bandwidthStakedTrxNum}</if>
|
|
<if test="voteNum != null "> and vote_num = #{voteNum}</if>
|
|
<if test="votedNum != null "> and voted_num = #{votedNum}</if>
|
|
<if test="bandwidthStakedNum != null "> and bandwidth_staked_num = #{bandwidthStakedNum}</if>
|
|
<if test="bandwidthStakedAllNum != null "> and bandwidth_staked_all_num = #{bandwidthStakedAllNum}</if>
|
|
<if test="bandwidthFreeNum != null "> and bandwidth_free_num = #{bandwidthFreeNum}</if>
|
|
<if test="bandwidthFreeAllNum != null "> and bandwidth_free_all_num = #{bandwidthFreeAllNum}</if>
|
|
and wallet_user_name is not null
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectWalletAddressById" parameterType="Long" resultMap="WalletAddressResult">
|
|
<include refid="selectWalletAddressVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<select id="selectExistingTokenIndexes" resultType="String">
|
|
select token_index from wallet_address
|
|
where deleted_at is null and token_index is not null and token_index != ''
|
|
</select>
|
|
|
|
<select id="countGlobalChildAccounts" resultType="int">
|
|
select count(1) from wallet_address
|
|
where deleted_at is null and app_id is null and user_id is null and wallet_user_name is null
|
|
and cast(token_index as unsigned) > 0
|
|
</select>
|
|
|
|
<select id="selectFirstAvailableForUpdate" resultMap="WalletAddressResult">
|
|
<include refid="selectWalletAddressVo"/>
|
|
where deleted_at is null and status = 1 and app_id is null and user_id is null
|
|
and wallet_user_name is null
|
|
order by id asc limit 1 for update
|
|
</select>
|
|
|
|
<select id="selectByAppAndWalletUserName" resultMap="WalletAddressResult">
|
|
<include refid="selectWalletAddressVo"/>
|
|
where deleted_at is null and status = 1 and app_id = #{appId}
|
|
and wallet_user_name = #{walletUserName}
|
|
order by id asc limit 1
|
|
</select>
|
|
|
|
<select id="selectOldestAssignedWallets" resultMap="WalletAddressPlusResult">
|
|
<include refid="selectWalletAddressVo"/>
|
|
where deleted_at is null and status = 1
|
|
and wallet_user_name is not null and trim(wallet_user_name) != ''
|
|
and token is not null and trim(token) != ''
|
|
order by updated_at is not null, updated_at asc, id asc
|
|
limit #{limit}
|
|
</select>
|
|
|
|
<update id="bindAvailableWallet">
|
|
update wallet_address
|
|
set app_id = #{appId}, user_id = #{userId}, wallet_user_name = #{walletUserName},
|
|
updated_at = #{updatedAt}
|
|
where id = #{id} and deleted_at is null and status = 1
|
|
and app_id is null and user_id is null and wallet_user_name is null
|
|
</update>
|
|
|
|
<insert id="insertWalletAddress" parameterType="WalletAddress" useGeneratedKeys="true" keyProperty="id">
|
|
insert into wallet_address
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="token != null and token != ''">token,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="createdAt != null">created_at,</if>
|
|
<if test="updatedAt != null">updated_at,</if>
|
|
<if test="deletedAt != null">deleted_at,</if>
|
|
<if test="appId != null">app_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="walletUserName != null and walletUserName != ''">wallet_user_name,</if>
|
|
<if test="tokenIndex != null">token_index,</if>
|
|
<if test="usdtBalance != null">usdt_balance,</if>
|
|
<if test="trxBalance != null">trx_balance,</if>
|
|
<if test="energyNum != null">energy_num,</if>
|
|
<if test="energyAllNum != null">energy_all_num,</if>
|
|
<if test="energyUsedNum != null">energy_used_num,</if>
|
|
<if test="bandwidthNum != null">bandwidth_num,</if>
|
|
<if test="delegatedEnergyTrxNum != null">delegated_energy_trx_num,</if>
|
|
<if test="delegatedEnergyValue != null">delegated_energy_value,</if>
|
|
<if test="acquiredDelegatedEnergyTrxNum != null">acquired_delegated_energy_trx_num,</if>
|
|
<if test="acquiredDelegatedEnergyValue != null">acquired_delegated_energy_value,</if>
|
|
<if test="delegatedBandwidthTrxNum != null">delegated_bandwidth_trx_num,</if>
|
|
<if test="delegatedBandwidthValue != null">delegated_bandwidth_value,</if>
|
|
<if test="acquiredDelegatedBandwidthTrxNum != null">acquired_delegated_bandwidth_trx_num,</if>
|
|
<if test="acquiredDelegatedBandwidthValue != null">acquired_delegated_bandwidth_value,</if>
|
|
<if test="stakedTrxNum != null">staked_trx_num,</if>
|
|
<if test="energyStakedTrxNum != null">energy_staked_trx_num,</if>
|
|
<if test="bandwidthStakedTrxNum != null">bandwidth_staked_trx_num,</if>
|
|
<if test="voteNum != null">vote_num,</if>
|
|
<if test="votedNum != null">voted_num,</if>
|
|
<if test="bandwidthStakedNum != null">bandwidth_staked_num,</if>
|
|
<if test="bandwidthStakedAllNum != null">bandwidth_staked_all_num,</if>
|
|
<if test="bandwidthFreeNum != null">bandwidth_free_num,</if>
|
|
<if test="bandwidthFreeAllNum != null">bandwidth_free_all_num,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="token != null and token != ''">#{token},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="createdAt != null">#{createdAt},</if>
|
|
<if test="updatedAt != null">#{updatedAt},</if>
|
|
<if test="deletedAt != null">#{deletedAt},</if>
|
|
<if test="appId != null">#{appId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="walletUserName != null and walletUserName != ''">#{walletUserName},</if>
|
|
<if test="tokenIndex != null">#{tokenIndex},</if>
|
|
<if test="usdtBalance != null">#{usdtBalance},</if>
|
|
<if test="trxBalance != null">#{trxBalance},</if>
|
|
<if test="energyNum != null">#{energyNum},</if>
|
|
<if test="energyAllNum != null">#{energyAllNum},</if>
|
|
<if test="energyUsedNum != null">#{energyUsedNum},</if>
|
|
<if test="bandwidthNum != null">#{bandwidthNum},</if>
|
|
<if test="delegatedEnergyTrxNum != null">#{delegatedEnergyTrxNum},</if>
|
|
<if test="delegatedEnergyValue != null">#{delegatedEnergyValue},</if>
|
|
<if test="acquiredDelegatedEnergyTrxNum != null">#{acquiredDelegatedEnergyTrxNum},</if>
|
|
<if test="acquiredDelegatedEnergyValue != null">#{acquiredDelegatedEnergyValue},</if>
|
|
<if test="delegatedBandwidthTrxNum != null">#{delegatedBandwidthTrxNum},</if>
|
|
<if test="delegatedBandwidthValue != null">#{delegatedBandwidthValue},</if>
|
|
<if test="acquiredDelegatedBandwidthTrxNum != null">#{acquiredDelegatedBandwidthTrxNum},</if>
|
|
<if test="acquiredDelegatedBandwidthValue != null">#{acquiredDelegatedBandwidthValue},</if>
|
|
<if test="stakedTrxNum != null">#{stakedTrxNum},</if>
|
|
<if test="energyStakedTrxNum != null">#{energyStakedTrxNum},</if>
|
|
<if test="bandwidthStakedTrxNum != null">#{bandwidthStakedTrxNum},</if>
|
|
<if test="voteNum != null">#{voteNum},</if>
|
|
<if test="votedNum != null">#{votedNum},</if>
|
|
<if test="bandwidthStakedNum != null">#{bandwidthStakedNum},</if>
|
|
<if test="bandwidthStakedAllNum != null">#{bandwidthStakedAllNum},</if>
|
|
<if test="bandwidthFreeNum != null">#{bandwidthFreeNum},</if>
|
|
<if test="bandwidthFreeAllNum != null">#{bandwidthFreeAllNum},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateWalletAddress" parameterType="WalletAddress">
|
|
update wallet_address
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="token != null and token != ''">token = #{token},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
|
<if test="deletedAt != null">deleted_at = #{deletedAt},</if>
|
|
<if test="appId != null">app_id = #{appId},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="walletUserName != null and walletUserName != ''">wallet_user_name = #{walletUserName},</if>
|
|
<if test="tokenIndex != null">token_index = #{tokenIndex},</if>
|
|
<if test="usdtBalance != null">usdt_balance = #{usdtBalance},</if>
|
|
<if test="trxBalance != null">trx_balance = #{trxBalance},</if>
|
|
<if test="energyNum != null">energy_num = #{energyNum},</if>
|
|
<if test="energyAllNum != null">energy_all_num = #{energyAllNum},</if>
|
|
<if test="energyUsedNum != null">energy_used_num = #{energyUsedNum},</if>
|
|
<if test="bandwidthNum != null">bandwidth_num = #{bandwidthNum},</if>
|
|
<if test="delegatedEnergyTrxNum != null">delegated_energy_trx_num = #{delegatedEnergyTrxNum},</if>
|
|
<if test="delegatedEnergyValue != null">delegated_energy_value = #{delegatedEnergyValue},</if>
|
|
<if test="acquiredDelegatedEnergyTrxNum != null">acquired_delegated_energy_trx_num = #{acquiredDelegatedEnergyTrxNum},</if>
|
|
<if test="acquiredDelegatedEnergyValue != null">acquired_delegated_energy_value = #{acquiredDelegatedEnergyValue},</if>
|
|
<if test="delegatedBandwidthTrxNum != null">delegated_bandwidth_trx_num = #{delegatedBandwidthTrxNum},</if>
|
|
<if test="delegatedBandwidthValue != null">delegated_bandwidth_value = #{delegatedBandwidthValue},</if>
|
|
<if test="acquiredDelegatedBandwidthTrxNum != null">acquired_delegated_bandwidth_trx_num = #{acquiredDelegatedBandwidthTrxNum},</if>
|
|
<if test="acquiredDelegatedBandwidthValue != null">acquired_delegated_bandwidth_value = #{acquiredDelegatedBandwidthValue},</if>
|
|
<if test="stakedTrxNum != null">staked_trx_num = #{stakedTrxNum},</if>
|
|
<if test="energyStakedTrxNum != null">energy_staked_trx_num = #{energyStakedTrxNum},</if>
|
|
<if test="bandwidthStakedTrxNum != null">bandwidth_staked_trx_num = #{bandwidthStakedTrxNum},</if>
|
|
<if test="voteNum != null">vote_num = #{voteNum},</if>
|
|
<if test="votedNum != null">voted_num = #{votedNum},</if>
|
|
<if test="bandwidthStakedNum != null">bandwidth_staked_num = #{bandwidthStakedNum},</if>
|
|
<if test="bandwidthStakedAllNum != null">bandwidth_staked_all_num = #{bandwidthStakedAllNum},</if>
|
|
<if test="bandwidthFreeNum != null">bandwidth_free_num = #{bandwidthFreeNum},</if>
|
|
<if test="bandwidthFreeAllNum != null">bandwidth_free_all_num = #{bandwidthFreeAllNum},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteWalletAddressById" parameterType="Long">
|
|
delete from wallet_address where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteWalletAddressByIds" parameterType="String">
|
|
delete from wallet_address where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|