game-api/ff-game/src/main/resources/mapper/tenant/TenantQuotaExchangeMapper.xml

102 lines
5.7 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.ff.tenant.mapper.TenantQuotaExchangeMapper">
<resultMap type="TenantQuotaExchange" id="TenantQuotaExchangeResult">
<result property="id" column="id" />
<result property="currencyCode" column="currency_code" />
<result property="exchangeCurrencyCode" column="exchange_currency_code" />
<result property="exchangeRate" column="exchange_rate" />
<result property="differenceType" column="difference_type" />
<result property="differenceValue" column="difference_value" />
<result property="actualBalance" column="actual_balance" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantQuotaExchangeVo">
select id, currency_code, exchange_currency_code, exchange_rate, difference_type, difference_value, actual_balance, create_by, create_time, update_by, update_time from ff_tenant_quota_exchange
</sql>
<select id="selectTenantQuotaExchangeList" parameterType="TenantQuotaExchange" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
<where>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="exchangeCurrencyCode != null and exchangeCurrencyCode != ''"> and exchange_currency_code = #{exchangeCurrencyCode}</if>
<if test="exchangeRate != null "> and exchange_rate = #{exchangeRate}</if>
<if test="differenceType != null "> and difference_type = #{differenceType}</if>
<if test="differenceValue != null "> and difference_value = #{differenceValue}</if>
<if test="actualBalance != null "> and actual_balance = #{actualBalance}</if>
</where>
</select>
<select id="selectTenantQuotaExchangeById" parameterType="Long" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
where id = #{id}
</select>
<insert id="insertTenantQuotaExchange" parameterType="TenantQuotaExchange" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_quota_exchange
<trim prefix="(" suffix=")" suffixOverrides=","><if test="id != null">id,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="exchangeCurrencyCode != null">exchange_currency_code,</if>
<if test="exchangeRate != null">exchange_rate,</if>
<if test="differenceType != null">difference_type,</if>
<if test="differenceValue != null">difference_value,</if>
<if test="actualBalance != null">actual_balance,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null">#{id},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="exchangeCurrencyCode != null">#{exchangeCurrencyCode},</if>
<if test="exchangeRate != null">#{exchangeRate},</if>
<if test="differenceType != null">#{differenceType},</if>
<if test="differenceValue != null">#{differenceValue},</if>
<if test="actualBalance != null">#{actualBalance},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTenantQuotaExchange" parameterType="TenantQuotaExchange">
update ff_tenant_quota_exchange
<trim prefix="SET" suffixOverrides=",">
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="exchangeCurrencyCode != null">exchange_currency_code = #{exchangeCurrencyCode},</if>
<if test="exchangeRate != null">exchange_rate = #{exchangeRate},</if>
<if test="differenceType != null">difference_type = #{differenceType},</if>
<if test="differenceValue != null">difference_value = #{differenceValue},</if>
<if test="actualBalance != null">actual_balance = #{actualBalance},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<select id="getTenantQuotaExchange" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
where currency_code = #{currencyCode} and exchange_currency_code = #{exchangeCurrencyCode}
</select>
<delete id="deleteTenantQuotaExchangeById" parameterType="Long">
delete from ff_tenant_quota_exchange where id = #{id}
</delete>
<delete id="deleteTenantQuotaExchangeByIds" parameterType="String">
delete from ff_tenant_quota_exchange where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>