<?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.willalp.canteen.mapper.HsGiftMapper">

    <resultMap type="com.willalp.canteen.domain.HsGift" id="HsGiftResult">
        <result property="giftId" column="gift_id"/>
        <result property="giftNumber" column="gift_number"/>
        <result property="giftName" column="gift_name"/>
        <result property="giftPictrue" column="gift_pictrue"/>
        <result property="giftPrice" column="gift_price"/>
        <result property="amount" column="amount"/>
        <result property="qybz" column="qybz"/>
        <result property="jgid" column="jgid"/>
        <result property="isDelete" column="is_delete"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectHsGiftVo">
        select gift_id, gift_number, gift_name, gift_pictrue, gift_price, amount, qybz, jgid, is_delete, create_by, create_time, update_by, update_time, remark        from hs_gift
    </sql>

    <select id="selectHsGiftList" parameterType="HsGift" resultMap="HsGiftResult">
        <include refid="selectHsGiftVo"/>
        <where>
            is_delete = 0
            <if test="giftName != null  and giftName != ''">
                and gift_name like concat('%', #{giftName}, '%')
            </if>
            <if test="qybz != null  and qybz != ''">
                and qybz = #{qybz}
            </if>
            <if test="jgid != null and jgid !=''">
                and jgid = #{jgid}
            </if>
            <if test="giftNumber != null and giftNumber != ''">
                and gift_number = #{giftNumber}
            </if>
        </where>
    </select>
</mapper>
