<?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.gxwebsoft.apps.mapper.HualalaFoodMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM apps_hualala_food a
        <where>
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.foodId != null">
                AND a.food_id LIKE CONCAT('%', #{param.foodId}, '%')
            </if>
            <if test="param.foodKey != null">
                AND a.food_key LIKE CONCAT('%', #{param.foodKey}, '%')
            </if>
            <if test="param.groupId != null">
                AND a.group_id LIKE CONCAT('%', #{param.groupId}, '%')
            </if>
            <if test="param.shopId != null">
                AND a.shop_id LIKE CONCAT('%', #{param.shopId}, '%')
            </if>
            <if test="param.foodCount != null">
                AND a.food_count LIKE CONCAT('%', #{param.foodCount}, '%')
            </if>
            <if test="param.foodCategoryId != null">
                AND a.food_category_id LIKE CONCAT('%', #{param.foodCategoryId}, '%')
            </if>
            <if test="param.foodCategoryKey != null">
                AND a.food_category_key LIKE CONCAT('%', #{param.foodCategoryKey}, '%')
            </if>
            <if test="param.foodCategoryName != null">
                AND a.food_category_name LIKE CONCAT('%', #{param.foodCategoryName}, '%')
            </if>
            <if test="param.foodOnlineCategoryId != null">
                AND a.food_online_category_id LIKE CONCAT('%', #{param.foodOnlineCategoryId}, '%')
            </if>
            <if test="param.foodOnlineCategoryKey != null">
                AND a.food_online_category_key LIKE CONCAT('%', #{param.foodOnlineCategoryKey}, '%')
            </if>
            <if test="param.foodOnlineCategoryName != null">
                AND a.food_online_category_name LIKE CONCAT('%', #{param.foodOnlineCategoryName}, '%')
            </if>
            <if test="param.isBatching != null">
                AND a.is_batching = #{param.isBatching}
            </if>
            <if test="param.isSingleSale != null">
                AND a.is_single_sale = #{param.isSingleSale}
            </if>
            <if test="param.foodSubjectKey != null">
                AND a.food_subject_key LIKE CONCAT('%', #{param.foodSubjectKey}, '%')
            </if>
            <if test="param.departmentKeyLst != null">
                AND a.department_key_lst LIKE CONCAT('%', #{param.departmentKeyLst}, '%')
            </if>
            <if test="param.batchingFoodCategoryKey != null">
                AND a.batching_food_category_key LIKE CONCAT('%', #{param.batchingFoodCategoryKey}, '%')
            </if>
            <if test="param.foodName != null">
                AND a.food_name LIKE CONCAT('%', #{param.foodName}, '%')
            </if>
            <if test="param.foodCode != null">
                AND a.food_code LIKE CONCAT('%', #{param.foodCode}, '%')
            </if>
            <if test="param.foodAliasName != null">
                AND a.food_alias_name LIKE CONCAT('%', #{param.foodAliasName}, '%')
            </if>
            <if test="param.foodMnemonicCode != null">
                AND a.food_mnemonic_code LIKE CONCAT('%', #{param.foodMnemonicCode}, '%')
            </if>
            <if test="param.isDiscount != null">
                AND a.is_discount = #{param.isDiscount}
            </if>
            <if test="param.isComments != null">
                AND a.is_comments = #{param.isComments}
            </if>
            <if test="param.isActive != null">
                AND a.is_active = #{param.isActive}
            </if>
            <if test="param.isOpen != null">
                AND a.is_open = #{param.isOpen}
            </if>
            <if test="param.isSetFood != null">
                AND a.is_set_food = #{param.isSetFood}
            </if>
            <if test="param.setFoodDetailJson != null">
                AND a.set_food_detail_json LIKE CONCAT('%', #{param.setFoodDetailJson}, '%')
            </if>
            <if test="param.isTempFood != null">
                AND a.is_temp_food = #{param.isTempFood}
            </if>
            <if test="param.units != null">
                AND a.units LIKE CONCAT('%', #{param.units}, '%')
            </if>
            <if test="param.py != null">
                AND a.py LIKE CONCAT('%', #{param.py}, '%')
            </if>
            <if test="param.minOrderCount != null">
                AND a.min_order_count LIKE CONCAT('%', #{param.minOrderCount}, '%')
            </if>
            <if test="param.tasteList != null">
                AND a.taste_list LIKE CONCAT('%', #{param.tasteList}, '%')
            </if>
            <if test="param.tasteGroupList != null">
                AND a.taste_group_list LIKE CONCAT('%', #{param.tasteGroupList}, '%')
            </if>
            <if test="param.makingMethodList != null">
                AND a.making_method_list LIKE CONCAT('%', #{param.makingMethodList}, '%')
            </if>
            <if test="param.makingMethodGroupList != null">
                AND a.making_method_group_list LIKE CONCAT('%', #{param.makingMethodGroupList}, '%')
            </if>
            <if test="param.isSpecialty != null">
                AND a.is_specialty = #{param.isSpecialty}
            </if>
            <if test="param.isRecommend != null">
                AND a.is_recommend = #{param.isRecommend}
            </if>
            <if test="param.isNews != null">
                AND a.is_news = #{param.isNews}
            </if>
            <if test="param.hotTag != null">
                AND a.hot_tag LIKE CONCAT('%', #{param.hotTag}, '%')
            </if>
            <if test="param.salesCount != null">
                AND a.sales_count LIKE CONCAT('%', #{param.salesCount}, '%')
            </if>
            <if test="param.isNeedConfirmFoodNumber != null">
                AND a.is_need_confirm_food_number = #{param.isNeedConfirmFoodNumber}
            </if>
            <if test="param.takeoutPackagingFee != null">
                AND a.takeout_packaging_fee LIKE CONCAT('%', #{param.takeoutPackagingFee}, '%')
            </if>
            <if test="param.incrementUnit != null">
                AND a.increment_unit LIKE CONCAT('%', #{param.incrementUnit}, '%')
            </if>
            <if test="param.takeawayTag != null">
                AND a.takeaway_tag LIKE CONCAT('%', #{param.takeawayTag}, '%')
            </if>
            <if test="param.workingLunchTag != null">
                AND a.working_lunch_tag LIKE CONCAT('%', #{param.workingLunchTag}, '%')
            </if>
            <if test="param.adsId != null">
                AND a.ads_id LIKE CONCAT('%', #{param.adsId}, '%')
            </if>
            <if test="param.imgePath != null">
                AND a.imge_path LIKE CONCAT('%', #{param.imgePath}, '%')
            </if>
            <if test="param.isHasImage != null">
                AND a.is_has_image = #{param.isHasImage}
            </if>
            <if test="param.imageHwp != null">
                AND a.image_hwp LIKE CONCAT('%', #{param.imageHwp}, '%')
            </if>
            <if test="param.starLevel != null">
                AND a.star_level LIKE CONCAT('%', #{param.starLevel}, '%')
            </if>
            <if test="param.foodTagIds != null">
                AND a.food_tag_ids LIKE CONCAT('%', #{param.foodTagIds}, '%')
            </if>
            <if test="param.parentFoodId != null">
                AND a.parent_food_id LIKE CONCAT('%', #{param.parentFoodId}, '%')
            </if>
            <if test="param.foodEnName != null">
                AND a.food_en_name LIKE CONCAT('%', #{param.foodEnName}, '%')
            </if>
            <if test="param.isAutoAdd != null">
                AND a.is_auto_add = #{param.isAutoAdd}
            </if>
            <if test="param.isCanRefund != null">
                AND a.is_can_refund = #{param.isCanRefund}
            </if>
            <if test="param.setPerson != null">
                AND a.set_person = #{param.setPerson}
            </if>
            <if test="param.tasteIsRequired != null">
                AND a.taste_is_required = #{param.tasteIsRequired}
            </if>
            <if test="param.tasteIsMultiple != null">
                AND a.taste_is_multiple = #{param.tasteIsMultiple}
            </if>
            <if test="param.makingMethodIsRequired != null">
                AND a.making_method_is_required = #{param.makingMethodIsRequired}
            </if>
            <if test="param.makingMethodIsMultiple != null">
                AND a.making_method_is_multiple = #{param.makingMethodIsMultiple}
            </if>
            <if test="param.initClickAmount != null">
                AND a.init_click_amount LIKE CONCAT('%', #{param.initClickAmount}, '%')
            </if>
            <if test="param.actualClickAmount != null">
                AND a.actual_click_amount LIKE CONCAT('%', #{param.actualClickAmount}, '%')
            </if>
            <if test="param.recentClickAmount != null">
                AND a.recent_click_amount LIKE CONCAT('%', #{param.recentClickAmount}, '%')
            </if>
            <if test="param.clickAlertMess != null">
                AND a.click_alert_mess LIKE CONCAT('%', #{param.clickAlertMess}, '%')
            </if>
            <if test="param.sourceFoodId != null">
                AND a.source_food_id LIKE CONCAT('%', #{param.sourceFoodId}, '%')
            </if>
            <if test="param.salesCommission != null">
                AND a.sales_commission LIKE CONCAT('%', #{param.salesCommission}, '%')
            </if>
            <if test="param.foodKeyElementLst != null">
                AND a.food_key_element_lst LIKE CONCAT('%', #{param.foodKeyElementLst}, '%')
            </if>
            <if test="param.foodSortIndex != null">
                AND a.food_sort_index LIKE CONCAT('%', #{param.foodSortIndex}, '%')
            </if>
            <if test="param.actionTime != null">
                AND a.action_time LIKE CONCAT('%', #{param.actionTime}, '%')
            </if>
            <if test="param.foodSubjectName != null">
                AND a.food_subject_name LIKE CONCAT('%', #{param.foodSubjectName}, '%')
            </if>
            <if test="param.foodSubjectCode != null">
                AND a.food_subject_code LIKE CONCAT('%', #{param.foodSubjectCode}, '%')
            </if>
            <if test="param.departmentId != null">
                AND a.department_id LIKE CONCAT('%', #{param.departmentId}, '%')
            </if>
            <if test="param.departmentKey != null">
                AND a.department_key LIKE CONCAT('%', #{param.departmentKey}, '%')
            </if>
            <if test="param.popularity != null">
                AND a.popularity LIKE CONCAT('%', #{param.popularity}, '%')
            </if>
            <if test="param.detailSplit != null">
                AND a.detail_split LIKE CONCAT('%', #{param.detailSplit}, '%')
            </if>
            <if test="param.batchingIsFoodNumberRate != null">
                AND a.batching_is_food_number_rate LIKE CONCAT('%', #{param.batchingIsFoodNumberRate}, '%')
            </if>
            <if test="param.foodCategoryCode != null">
                AND a.food_category_code LIKE CONCAT('%', #{param.foodCategoryCode}, '%')
            </if>
            <if test="param.foodCategoryEnName != null">
                AND a.food_category_en_name LIKE CONCAT('%', #{param.foodCategoryEnName}, '%')
            </if>
            <if test="param.foodCategoryGroupName != null">
                AND a.food_category_group_name LIKE CONCAT('%', #{param.foodCategoryGroupName}, '%')
            </if>
            <if test="param.specialPrice != null">
                AND a.special_price LIKE CONCAT('%', #{param.specialPrice}, '%')
            </if>
            <if test="param.specialPrice2 != null">
                AND a.special_price2 LIKE CONCAT('%', #{param.specialPrice2}, '%')
            </if>
            <if test="param.specialPrice3 != null">
                AND a.special_price3 LIKE CONCAT('%', #{param.specialPrice3}, '%')
            </if>
            <if test="param.specialPrice4 != null">
                AND a.special_price4 LIKE CONCAT('%', #{param.specialPrice4}, '%')
            </if>
            <if test="param.specialPrice5 != null">
                AND a.special_price5 LIKE CONCAT('%', #{param.specialPrice5}, '%')
            </if>
            <if test="param.specialPrice6 != null">
                AND a.special_price6 LIKE CONCAT('%', #{param.specialPrice6}, '%')
            </if>
            <if test="param.onlineWmPrice != null">
                AND a.online_wm_price LIKE CONCAT('%', #{param.onlineWmPrice}, '%')
            </if>
            <if test="param.tagIds != null">
                AND a.tag_ids LIKE CONCAT('%', #{param.tagIds}, '%')
            </if>
            <if test="param.tagNames != null">
                AND a.tag_names LIKE CONCAT('%', #{param.tagNames}, '%')
            </if>
            <if test="param.giftItemId != null">
                AND a.gift_item_id LIKE CONCAT('%', #{param.giftItemId}, '%')
            </if>
            <if test="param.giftValidPeriod != null">
                AND a.gift_valid_period LIKE CONCAT('%', #{param.giftValidPeriod}, '%')
            </if>
            <if test="param.description != null">
                AND a.description LIKE CONCAT('%', #{param.description}, '%')
            </if>
            <if test="param.action != null">
                AND a.action LIKE CONCAT('%', #{param.action}, '%')
            </if>
            <if test="param.settlementProportion != null">
                AND a.settlement_proportion LIKE CONCAT('%', #{param.settlementProportion}, '%')
            </if>
            <if test="param.sortIndex != null">
                AND a.sort_index = #{param.sortIndex}
            </if>
            <if test="param.image != null">
                AND a.image LIKE CONCAT('%', #{param.image}, '%')
            </if>
            <if test="param.content != null">
                AND a.content LIKE CONCAT('%', #{param.content}, '%')
            </if>
            <if test="param.sortNumber != null">
                AND a.sort_number = #{param.sortNumber}
            </if>
            <if test="param.comments != null">
                AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.deleted != null">
                AND a.deleted = #{param.deleted}
            </if>
            <if test="param.deleted == null">
                AND a.deleted = 0
            </if>
            <if test="param.merchantCode != null">
                AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.apps.entity.HualalaFood">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.apps.entity.HualalaFood">
        <include refid="selectSql"></include>
    </select>

</mapper>
