337 lines
12 KiB
XML
337 lines
12 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.TenantGameQuotaFlowMapper">
|
|
<resultMap type="TenantGameQuotaFlow" id="TenantGameQuotaFlowResult">
|
|
<result property="id" column="id"/>
|
|
<result property="tenantKey" column="tenant_key"/>
|
|
<result property="quotaType" column="quota_type"/>
|
|
<result property="memberId" column="member_id"/>
|
|
<result property="platformCode" column="platform_code"/>
|
|
<result property="currencyCode" column="currency_code"/>
|
|
<result property="isOut" column="is_out"/>
|
|
<result property="operationType" column="operation_type"/>
|
|
<result property="balanceBefore" column="balance_before"/>
|
|
<result property="balance" column="balance"/>
|
|
<result property="exchangeRatio" column="exchange_ratio"/>
|
|
<result property="exchangeMoney" column="exchange_money"/>
|
|
<result property="balanceAfter" column="balance_after"/>
|
|
<result property="remark" column="remark"/>
|
|
<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="selectTenantGameQuotaFlowVo">
|
|
select id,
|
|
source_id,
|
|
tenant_key,
|
|
quota_type,
|
|
member_id,
|
|
platform_code,
|
|
currency_code,
|
|
is_out,
|
|
operation_type,
|
|
balance_before,
|
|
balance,
|
|
exchange_ratio,
|
|
exchange_money,
|
|
balance_after,
|
|
remark,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
from ff_tenant_game_quota_flow
|
|
</sql>
|
|
|
|
<select id="selectTenantGameQuotaFlowList" parameterType="TenantGameQuotaFlow"
|
|
resultMap="TenantGameQuotaFlowResult">
|
|
<include refid="selectTenantGameQuotaFlowVo"/>
|
|
<where>
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
and tenant_key = #{tenantKey}
|
|
</if>
|
|
<if test="quotaType != null and quotaType != ''">
|
|
and quota_type = #{quotaType}
|
|
</if>
|
|
<if test="memberId != null ">
|
|
and member_id = #{memberId}
|
|
</if>
|
|
<if test="platformCode != null and platformCode != ''">
|
|
and platform_code = #{platformCode}
|
|
</if>
|
|
<if test="currencyCode != null and currencyCode != ''">
|
|
and currency_code = #{currencyCode}
|
|
</if>
|
|
<if test="isOut != null ">
|
|
and is_out = #{isOut}
|
|
</if>
|
|
<if test="operationType != null ">
|
|
and operation_type = #{operationType}
|
|
</if>
|
|
<if test="balanceBefore != null ">
|
|
and balance_before = #{balanceBefore}
|
|
</if>
|
|
<if test="balance != null ">
|
|
and balance = #{balance}
|
|
</if>
|
|
<if test="exchangeRatio != null ">
|
|
and exchange_ratio = #{exchangeRatio}
|
|
</if>
|
|
<if test="exchangeMoney != null ">
|
|
and exchange_money = #{exchangeMoney}
|
|
</if>
|
|
<if test="balanceAfter != null ">
|
|
and balance_after = #{balanceAfter}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectTenantGameQuotaFlowById" parameterType="Long" resultMap="TenantGameQuotaFlowResult">
|
|
<include refid="selectTenantGameQuotaFlowVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertTenantGameQuotaFlow" parameterType="TenantGameQuotaFlow" useGeneratedKeys="true" keyProperty="id">
|
|
insert into ff_tenant_game_quota_flow
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
tenant_key,
|
|
</if>
|
|
<if test="quotaType != null">
|
|
quota_type,
|
|
</if>
|
|
<if test="memberId != null">
|
|
member_id,
|
|
</if>
|
|
<if test="platformCode != null">
|
|
platform_code,
|
|
</if>
|
|
<if test="currencyCode != null">
|
|
currency_code,
|
|
</if>
|
|
<if test="isOut != null">
|
|
is_out,
|
|
</if>
|
|
<if test="operationType != null">
|
|
operation_type,
|
|
</if>
|
|
<if test="balanceBefore != null">
|
|
balance_before,
|
|
</if>
|
|
<if test="balance != null">
|
|
balance,
|
|
</if>
|
|
<if test="exchangeRatio != null">
|
|
exchange_ratio,
|
|
</if>
|
|
<if test="exchangeMoney != null">
|
|
exchange_money,
|
|
</if>
|
|
<if test="balanceAfter != null">
|
|
balance_after,
|
|
</if>
|
|
<if test="remark != null">
|
|
remark,
|
|
</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>
|
|
<if test="sourceId != null">
|
|
source_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id},
|
|
</if>
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
#{tenantKey},
|
|
</if>
|
|
<if test="quotaType != null">
|
|
#{quotaType},
|
|
</if>
|
|
<if test="memberId != null">
|
|
#{memberId},
|
|
</if>
|
|
<if test="platformCode != null">
|
|
#{platformCode},
|
|
</if>
|
|
<if test="currencyCode != null">
|
|
#{currencyCode},
|
|
</if>
|
|
<if test="isOut != null">
|
|
#{isOut},
|
|
</if>
|
|
<if test="operationType != null">
|
|
#{operationType},
|
|
</if>
|
|
<if test="balanceBefore != null">
|
|
#{balanceBefore},
|
|
</if>
|
|
<if test="balance != null">
|
|
#{balance},
|
|
</if>
|
|
<if test="exchangeRatio != null">
|
|
#{exchangeRatio},
|
|
</if>
|
|
<if test="exchangeMoney != null">
|
|
#{exchangeMoney},
|
|
</if>
|
|
<if test="balanceAfter != null">
|
|
#{balanceAfter},
|
|
</if>
|
|
<if test="remark != null">
|
|
#{remark},
|
|
</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>
|
|
<if test="sourceId != null">
|
|
#{sourceId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateTenantGameQuotaFlow" parameterType="TenantGameQuotaFlow">
|
|
update ff_tenant_game_quota_flow
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
tenant_key = #{tenantKey},
|
|
</if>
|
|
<if test="quotaType != null">
|
|
quota_type = #{quotaType},
|
|
</if>
|
|
<if test="memberId != null">
|
|
member_id = #{memberId},
|
|
</if>
|
|
<if test="platformCode != null">
|
|
platform_code = #{platformCode},
|
|
</if>
|
|
<if test="currencyCode != null">
|
|
currency_code = #{currencyCode},
|
|
</if>
|
|
<if test="isOut != null">
|
|
is_out = #{isOut},
|
|
</if>
|
|
<if test="operationType != null">
|
|
operation_type = #{operationType},
|
|
</if>
|
|
<if test="balanceBefore != null">
|
|
balance_before = #{balanceBefore},
|
|
</if>
|
|
<if test="balance != null">
|
|
balance = #{balance},
|
|
</if>
|
|
<if test="exchangeRatio != null">
|
|
exchange_ratio = #{exchangeRatio},
|
|
</if>
|
|
<if test="exchangeMoney != null">
|
|
exchange_money = #{exchangeMoney},
|
|
</if>
|
|
<if test="balanceAfter != null">
|
|
balance_after = #{balanceAfter},
|
|
</if>
|
|
<if test="remark != null">
|
|
remark = #{remark},
|
|
</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>
|
|
<if test="sourceId != null">
|
|
source_id = #{sourceId},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteTenantGameQuotaFlowById" parameterType="Long">
|
|
delete
|
|
from ff_tenant_game_quota_flow
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteTenantGameQuotaFlowByIds" parameterType="String">
|
|
delete from ff_tenant_game_quota_flow where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
<select id="getExchangeMoneyByMemberId" parameterType="TenantGameQuotaFlow" resultType="java.math.BigDecimal">
|
|
select ifnull(sum(exchange_money),0) from ff_tenant_game_quota_flow
|
|
<where>
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
and tenant_key = #{tenantKey}
|
|
</if>
|
|
<if test="quotaType != null and quotaType != ''">
|
|
and quota_type = #{quotaType}
|
|
</if>
|
|
<if test="memberId != null ">
|
|
and member_id = #{memberId}
|
|
</if>
|
|
<if test="isOut != null ">
|
|
and is_out = #{isOut}
|
|
</if>
|
|
<if test="operationType != null ">
|
|
and operation_type = #{operationType}
|
|
</if>
|
|
<if test="balanceBefore != null ">
|
|
and balance_before = #{balanceBefore}
|
|
</if>
|
|
<if test="balance != null ">
|
|
and balance = #{balance}
|
|
</if>
|
|
<if test="balanceAfter != null ">
|
|
and balance_after = #{balanceAfter}
|
|
</if>
|
|
</where>
|
|
group by member_id
|
|
</select>
|
|
|
|
<select id="getBalanceByTenantKey" resultMap="TenantGameQuotaFlowResult">
|
|
select tenant_key,
|
|
sum(if(is_out, exchange_money, 0)) - sum(if(!is_out, exchange_money, 0)) as exchange_money,
|
|
currency_code,
|
|
platform_code
|
|
from ff_tenant_game_quota_flow
|
|
where create_time between #{params.beginTime} and #{params.endTime}
|
|
and quota_type = #{quotaType}
|
|
and operation_type = #{operationType} and currency_code is not null and platform_code is not null
|
|
group by tenant_key,platform_code, currency_code
|
|
</select>
|
|
</mapper> |