game-api/ff-admin/target/classes/mapper/game/GameMapper.xml

142 lines
7.1 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.game.mapper.GameMapper">
<resultMap type="Game" id="GameResult">
<result property="id" column="id" />
<result property="sortNo" column="sort_no" />
<result property="platformId" column="platform_id" />
<result property="gameCode" column="game_code" />
<result property="gameSourceType" column="game_source_type" />
<result property="gameName" column="game_name" />
<result property="freespin" column="freespin" />
<result property="demoStatus" column="demo_status" />
<result property="stopStatus" column="stop_status" />
<result property="gameStatus" column="game_status" />
<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="selectGameVo">
select id, sort_no, platform_id, game_code, game_source_type, game_name, freespin, demo_status, stop_status, game_status, create_by, create_time, update_by, update_time from ff_game
</sql>
<select id="selectGameList" parameterType="Game" resultMap="GameResult">
<include refid="selectGameVo"/>
<where>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="platformId != null "> and platform_id = #{platformId}</if>
<if test="gameCode != null "> and game_code = #{gameCode}</if>
<if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if>
<if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if>
<if test="freespin != null "> and freespin = #{freespin}</if>
<if test="demoStatus != null "> and demo_status = #{demoStatus}</if>
<if test="stopStatus != null "> and stop_status = #{stopStatus}</if>
<if test="gameStatus != null "> and game_status = #{gameStatus}</if>
</where>
</select>
<select id="selectGameById" parameterType="Long" resultMap="GameResult">
<include refid="selectGameVo"/>
where id = #{id}
</select>
<insert id="insertGame" parameterType="Game" useGeneratedKeys="true" keyProperty="id">
insert into ff_game
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sortNo != null">sort_no,</if>
<if test="platformId != null">platform_id,</if>
<if test="gameCode != null">game_code,</if>
<if test="gameSourceType != null">game_source_type,</if>
<if test="gameName != null and gameName != ''">game_name,</if>
<if test="freespin != null">freespin,</if>
<if test="demoStatus != null">demo_status,</if>
<if test="stopStatus != null">stop_status,</if>
<if test="gameStatus != null">game_status,</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="sortNo != null">#{sortNo},</if>
<if test="platformId != null">#{platformId},</if>
<if test="gameCode != null">#{gameCode},</if>
<if test="gameSourceType != null">#{gameSourceType},</if>
<if test="gameName != null and gameName != ''">#{gameName},</if>
<if test="freespin != null">#{freespin},</if>
<if test="demoStatus != null">#{demoStatus},</if>
<if test="stopStatus != null">#{stopStatus},</if>
<if test="gameStatus != null">#{gameStatus},</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="updateGame" parameterType="Game">
update ff_game
<trim prefix="SET" suffixOverrides=",">
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="platformId != null">platform_id = #{platformId},</if>
<if test="gameCode != null">game_code = #{gameCode},</if>
<if test="gameSourceType != null">game_source_type = #{gameSourceType},</if>
<if test="gameName != null and gameName != ''">game_name = #{gameName},</if>
<if test="freespin != null">freespin = #{freespin},</if>
<if test="demoStatus != null">demo_status = #{demoStatus},</if>
<if test="stopStatus != null">stop_status = #{stopStatus},</if>
<if test="gameStatus != null">game_status = #{gameStatus},</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="deleteGameById" parameterType="Long">
delete from ff_game where id = #{id}
</delete>
<delete id="deleteGameByIds" parameterType="String">
delete from ff_game where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectMaxSortNoByPlatformId" parameterType="Long" resultType="java.lang.Integer">
select ifnull(max(sort_no), 0)
from ff_game
where platform_id = #{platformId}
</select>
<select id="selectGameUniqueList" parameterType="com.ff.game.api.request.GameUniqueDTO" resultMap="GameResult">
<include refid="selectGameVo"/>
<where>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="platformId != null "> and platform_id = #{platformId}</if>
<if test="gameCode != null "> and game_code = #{gameCode}</if>
<if test="gameSourceType != null "> and game_source_type = #{gameSourceType}</if>
<if test="gameName != null and gameName != ''"> and game_name like concat('%', #{gameName}, '%')</if>
<if test="freespin != null "> and freespin = #{freespin}</if>
<if test="demoStatus != null "> and demo_status = #{demoStatus}</if>
<if test="stopStatus != null "> and stop_status = #{stopStatus}</if>
<if test="gameStatus != null "> and game_status = #{gameStatus}</if>
<if test="gameIds != null and gameIds.size() >0 ">
and id in
<foreach item="gameId" collection="gameIds" open="(" separator="," close=")">
#{gameId}
</foreach>
</if>
</where>
</select>
</mapper>