<?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.game.business.mapper.AppGameClassifyMapper">
    
    <resultMap type="com.game.business.domain.AppGameClassify" id="AppGameClassifyResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="logoUrl"    column="logo_url"    />
        <result property="status"    column="status"    />
        <result property="orderno"    column="orderno"    />
    </resultMap>

    <sql id="selectAppGameClassifyVo">
        select id, name, logo_url, status, orderno from app_game_classify
    </sql>

    <select id="selectAppGameClassifyList" parameterType="com.game.business.domain.AppGameClassify" resultMap="AppGameClassifyResult">
        <include refid="selectAppGameClassifyVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="logoUrl != null  and logoUrl != ''"> and logo_url = #{logoUrl}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="orderno != null "> and orderno = #{orderno}</if>
        </where>
    </select>
    
    <select id="selectAppGameClassifyById" parameterType="Long" resultMap="AppGameClassifyResult">
        <include refid="selectAppGameClassifyVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAppGameClassify" parameterType="com.game.business.domain.AppGameClassify">
        insert into app_game_classify
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="name != null">name,</if>
            <if test="logoUrl != null">logo_url,</if>
            <if test="status != null">status,</if>
            <if test="orderno != null">orderno,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="logoUrl != null">#{logoUrl},</if>
            <if test="status != null">#{status},</if>
            <if test="orderno != null">#{orderno},</if>
         </trim>
    </insert>

    <update id="updateAppGameClassify" parameterType="com.game.business.domain.AppGameClassify">
        update app_game_classify
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="logoUrl != null">logo_url = #{logoUrl},</if>
            <if test="status != null">status = #{status},</if>
            <if test="orderno != null">orderno = #{orderno},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAppGameClassifyById" parameterType="Long">
        delete from app_game_classify where id = #{id}
    </delete>

    <delete id="deleteAppGameClassifyByIds" parameterType="String">
        delete from app_game_classify where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>