<?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.project.zcustom.mapper.smart.PlatGreenSmartMapper">
    
    <resultMap type="PlatGreenSmart" id="PlatGreenSmartResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <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="appOrg"    column="app_org"    />
        <result property="canteenNum"    column="canteen_num"    />
        <result property="canteenType"    column="canteen_type"    />
        <result property="areaNum"    column="area_num"    />
        <result property="seatsNum"    column="seats_num"    />
        <result property="managementNum"    column="management_num"    />
        <result property="chefsNum"    column="chefs_num"    />
        <result property="serviceNum"    column="service_num"    />
        <result property="healthNum"    column="health_num"    />
        <result property="licenceNum"    column="licence_num"    />
        <result property="dishHygieneScore"    column="dish_hygiene_score"    />
        <result property="tasteDishesScore"    column="taste_dishes_score"    />
        <result property="attitudeScore"    column="attitude_score"    />
        <result property="tablewareScore"    column="tableware_score"    />
        <result property="typesDishesScore"    column="types_dishes_score"    />
        <result property="diningScore"    column="dining_score"    />
        <result property="personnelNum"    column="personnel_num"    />
        <result property="serviceDinersNum"    column="service_diners_num"    />
    </resultMap>

    <sql id="selectPlatGreenSmartVo">
        select id, del_flag, create_by, create_time, update_by, update_time, app_org, canteen_num, canteen_type, area_num, seats_num, management_num, chefs_num, service_num, health_num, licence_num, dish_hygiene_score, taste_dishes_score, attitude_score, tableware_score, types_dishes_score, dining_score, personnel_num, service_diners_num from large_plat_green_smart
    </sql>

    <select id="selectPlatGreenSmartList" parameterType="PlatGreenSmart" resultMap="PlatGreenSmartResult">
        <include refid="selectPlatGreenSmartVo"/>
        <where>  
            <if test="appOrg != null  and appOrg != ''"> and app_org = #{appOrg}</if>
            <if test="canteenNum != null  and canteenNum != ''"> and canteen_num = #{canteenNum}</if>
            <if test="canteenType != null  and canteenType != ''"> and canteen_type = #{canteenType}</if>
            <if test="areaNum != null "> and area_num = #{areaNum}</if>
            <if test="seatsNum != null "> and seats_num = #{seatsNum}</if>
            <if test="managementNum != null "> and management_num = #{managementNum}</if>
            <if test="chefsNum != null "> and chefs_num = #{chefsNum}</if>
            <if test="serviceNum != null "> and service_num = #{serviceNum}</if>
            <if test="healthNum != null "> and health_num = #{healthNum}</if>
            <if test="licenceNum != null "> and licence_num = #{licenceNum}</if>
            <if test="dishHygieneScore != null "> and dish_hygiene_score = #{dishHygieneScore}</if>
            <if test="tasteDishesScore != null "> and taste_dishes_score = #{tasteDishesScore}</if>
            <if test="attitudeScore != null "> and attitude_score = #{attitudeScore}</if>
            <if test="tablewareScore != null "> and tableware_score = #{tablewareScore}</if>
            <if test="typesDishesScore != null "> and types_dishes_score = #{typesDishesScore}</if>
            <if test="diningScore != null "> and dining_score = #{diningScore}</if>
            <if test="personnelNum != null "> and personnel_num = #{personnelNum}</if>
            <if test="serviceDinersNum != null "> and service_diners_num = #{serviceDinersNum}</if>
        </where>
    </select>
    
    <select id="selectPlatGreenSmartById" parameterType="Long" resultMap="PlatGreenSmartResult">
        <include refid="selectPlatGreenSmartVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlatGreenSmart" parameterType="PlatGreenSmart" useGeneratedKeys="true" keyProperty="id">
        insert into large_plat_green_smart
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="appOrg != null">app_org,</if>
            <if test="canteenNum != null">canteen_num,</if>
            <if test="canteenType != null">canteen_type,</if>
            <if test="areaNum != null">area_num,</if>
            <if test="seatsNum != null">seats_num,</if>
            <if test="managementNum != null">management_num,</if>
            <if test="chefsNum != null">chefs_num,</if>
            <if test="serviceNum != null">service_num,</if>
            <if test="healthNum != null">health_num,</if>
            <if test="licenceNum != null">licence_num,</if>
            <if test="dishHygieneScore != null">dish_hygiene_score,</if>
            <if test="tasteDishesScore != null">taste_dishes_score,</if>
            <if test="attitudeScore != null">attitude_score,</if>
            <if test="tablewareScore != null">tableware_score,</if>
            <if test="typesDishesScore != null">types_dishes_score,</if>
            <if test="diningScore != null">dining_score,</if>
            <if test="personnelNum != null">personnel_num,</if>
            <if test="serviceDinersNum != null">service_diners_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="appOrg != null">#{appOrg},</if>
            <if test="canteenNum != null">#{canteenNum},</if>
            <if test="canteenType != null">#{canteenType},</if>
            <if test="areaNum != null">#{areaNum},</if>
            <if test="seatsNum != null">#{seatsNum},</if>
            <if test="managementNum != null">#{managementNum},</if>
            <if test="chefsNum != null">#{chefsNum},</if>
            <if test="serviceNum != null">#{serviceNum},</if>
            <if test="healthNum != null">#{healthNum},</if>
            <if test="licenceNum != null">#{licenceNum},</if>
            <if test="dishHygieneScore != null">#{dishHygieneScore},</if>
            <if test="tasteDishesScore != null">#{tasteDishesScore},</if>
            <if test="attitudeScore != null">#{attitudeScore},</if>
            <if test="tablewareScore != null">#{tablewareScore},</if>
            <if test="typesDishesScore != null">#{typesDishesScore},</if>
            <if test="diningScore != null">#{diningScore},</if>
            <if test="personnelNum != null">#{personnelNum},</if>
            <if test="serviceDinersNum != null">#{serviceDinersNum},</if>
         </trim>
    </insert>

    <update id="updatePlatGreenSmart" parameterType="PlatGreenSmart">
        update large_plat_green_smart
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="appOrg != null">app_org = #{appOrg},</if>
            <if test="canteenNum != null">canteen_num = #{canteenNum},</if>
            <if test="canteenType != null">canteen_type = #{canteenType},</if>
            <if test="areaNum != null">area_num = #{areaNum},</if>
            <if test="seatsNum != null">seats_num = #{seatsNum},</if>
            <if test="managementNum != null">management_num = #{managementNum},</if>
            <if test="chefsNum != null">chefs_num = #{chefsNum},</if>
            <if test="serviceNum != null">service_num = #{serviceNum},</if>
            <if test="healthNum != null">health_num = #{healthNum},</if>
            <if test="licenceNum != null">licence_num = #{licenceNum},</if>
            <if test="dishHygieneScore != null">dish_hygiene_score = #{dishHygieneScore},</if>
            <if test="tasteDishesScore != null">taste_dishes_score = #{tasteDishesScore},</if>
            <if test="attitudeScore != null">attitude_score = #{attitudeScore},</if>
            <if test="tablewareScore != null">tableware_score = #{tablewareScore},</if>
            <if test="typesDishesScore != null">types_dishes_score = #{typesDishesScore},</if>
            <if test="diningScore != null">dining_score = #{diningScore},</if>
            <if test="personnelNum != null">personnel_num = #{personnelNum},</if>
            <if test="serviceDinersNum != null">service_diners_num = #{serviceDinersNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlatGreenSmartById" parameterType="Long">
        delete from large_plat_green_smart where id = #{id}
    </delete>

    <delete id="deletePlatGreenSmartByIds" parameterType="String">
        delete from large_plat_green_smart where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="reallyDeleteByWrapper">
        DELETE FROM large_plat_green_smart ${ew.customSqlSegment}
    </delete>
</mapper>