<?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.HsGiftTypeMapper">

    <resultMap type="HsGiftType" id="HsGiftTypeResult">
        <result property="id" column="id"/>
        <result property="giftTypeNo" column="gift_type_no"/>
        <result property="giftTypeName" column="gift_type_name"/>
        <result property="parentId" column="parent_id"/>
        <result property="orderNum" column="order_num"/>
        <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="selectHsGiftTypeVo">
        select id,
               gift_type_no,
               gift_type_name,
               parent_id,
               order_num,
               is_delete,
               create_by,
               create_time,
               update_by,
               update_time,
               remark
        from hs_gift_type
    </sql>

    <select id="selectHsGiftTypeList" parameterType="HsGiftType" resultMap="HsGiftTypeResult">
        <include refid="selectHsGiftTypeVo"/>
        <where>
            is_delete = 0
            <if test="giftTypeNo != null  and giftTypeNo != ''">and gift_type_no like concat('%', #{giftTypeNo}, '%')
            </if>
            <if test="giftTypeName != null  and giftTypeName != ''">and gift_type_name like concat('%', #{giftTypeName},
                '%')
            </if>
            <if test="parentId != null  and parentId != ''">and parent_id = #{parentId}</if>
        </where>
    </select>

</mapper>
