game-api/ff-base/src/main/resources/mapper/system/TenantPlatformMapper.xml

113 lines
5.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.ff.base.system.mapper.TenantPlatformMapper">
<resultMap type="TenantPlatform" id="TenantPlatformResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="platformCode" column="platform_code" />
<result property="currencyCode" column="currency_code" />
<result property="cost" column="cost" />
<result property="useCost" column="use_cost" />
<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="selectTenantPlatformVo">
select id, tenant_id, platform_code, currency_code, cost, use_cost, create_by, create_time, update_by, update_time from ff_tenant_platform
</sql>
<select id="selectTenantPlatformList" parameterType="TenantPlatform" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</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="cost != null "> and cost = #{cost}</if>
<if test="useCost != null "> and use_cost = #{useCost}</if>
</where>
</select>
<select id="selectTenantPlatformById" parameterType="Long" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
where id = #{id}
</select>
<select id="findTenantPlatform" parameterType="TenantPlatform" resultMap="TenantPlatformResult">
<include refid="selectTenantPlatformVo"/>
<where>
<if test="tenantId != null "> and tenant_id = #{tenantId}</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="cost != null "> and cost = #{cost}</if>
<if test="useCost != null "> and use_cost = #{useCost}</if>
</where>
limit 1
</select>
<select id="selectCurrencyCodeByTenantId" >
select currency_code from ff_tenant_platform
where tenant_id = #{tenantId} group by currency_code
</select>
<insert id="insertTenantPlatform" parameterType="TenantPlatform">
insert into ff_tenant_platform
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="platformCode != null and platformCode != ''">platform_code,</if>
<if test="currencyCode != null and currencyCode != ''">currency_code,</if>
<if test="cost != null">cost,</if>
<if test="useCost != null">use_cost,</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="tenantId != null">#{tenantId},</if>
<if test="platformCode != null and platformCode != ''">#{platformCode},</if>
<if test="currencyCode != null and currencyCode != ''">#{currencyCode},</if>
<if test="cost != null">#{cost},</if>
<if test="useCost != null">#{useCost},</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="updateTenantPlatform" parameterType="TenantPlatform">
update ff_tenant_platform
<trim prefix="SET" suffixOverrides=",">
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="platformCode != null and platformCode != ''">platform_code = #{platformCode},</if>
<if test="currencyCode != null and currencyCode != ''">currency_code = #{currencyCode},</if>
<if test="cost != null">cost = #{cost},</if>
<if test="useCost != null">use_cost = #{useCost},</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>
<delete id="deleteTenantPlatformById" parameterType="Long">
delete from ff_tenant_platform where id = #{id}
</delete>
<delete id="deleteTenantPlatformByIds" parameterType="String">
delete from ff_tenant_platform where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>