<?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="org.jeecg.modules.system.app.mapper.AppGamePriceRulesMapper">

    <update id="updateByIdDel">
        UPDATE nm_game_price_rules SET del_flag=1 WHERE id=#{id}
    </update>
    <select id="findByGameId" resultType="org.jeecg.modules.system.app.dto.AppGameRuleDTO">
        select a.id,a.game_id,a.category_id,a.selling_price,a.people_num,a.type,a.del_flag,b.name AS category_name
        from  nm_game_price_rules a
        LEFT JOIN nm_category b   ON a.category_id  =b.id AND b.del_flag = 0
        where  a.del_flag = 0  and a.game_id =#{gameId}
    </select>
    <select id="findByGameIdList" resultType="org.jeecg.modules.app.vo.game.GamePriceRulesVO">
        select a.id,a.game_id,a.category_id,a.selling_price,a.people_num,a.type,b.name AS category_name
        from  nm_game_price_rules a
        LEFT JOIN nm_category b   ON a.category_id  =b.id AND b.del_flag = 0
        where  a.del_flag = 0  and a.game_id =#{gameId}
        <if test="type!= null">
            AND a.type =#{type}
        </if>
    </select>
</mapper>