<?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.gic.haoban.manage.service.dao.mapper.TabHaobanOperationSettingMapper">

    <resultMap type="com.gic.haoban.manage.service.entity.TabHaobanOperationSetting"
               id="TabHaobanOperationSettingMap">
        <result property="settingId" column="setting_id" jdbcType="VARCHAR"/>
        <result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
        <result property="clerkPhoneFlag" column="clerk_phone_flag" jdbcType="INTEGER"/>
        <result property="storeEditFlag" column="store_edit_flag" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <result property="statusFlag" column="status_flag" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
        setting_id, wx_enterprise_id, clerk_phone_flag, store_edit_flag, create_time, update_time, status_flag     </sql>

    <!--新增所有列-->
    <insert id="insert" keyProperty="settingId" useGeneratedKeys="true" parameterType="com.gic.haoban.manage.service.entity.TabHaobanOperationSetting">
        INSERT INTO tab_haoban_operation_setting
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="settingId != null and settingId != ''">
                setting_id,
            </if>
            <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
                wx_enterprise_id,
            </if>
            <if test="clerkPhoneFlag != null">
                clerk_phone_flag,
            </if>
            <if test="storeEditFlag != null">
                store_edit_flag,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="statusFlag != null">
                status_flag,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="settingId != null and settingId != ''">
                #{settingId},
            </if>
            <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
                #{wxEnterpriseId},
            </if>
            <if test="clerkPhoneFlag != null">
                #{clerkPhoneFlag},
            </if>
            <if test="storeEditFlag != null">
                #{storeEditFlag},
            </if>
            <if test="createTime != null">
                #{createTime},
            </if>
            <if test="updateTime != null">
                #{updateTime},
            </if>
            <if test="statusFlag != null">
                #{statusFlag},
            </if>
        </trim>
    </insert>
    <!--通过主键修改数据-->
    <update id="update" parameterType="com.gic.haoban.manage.service.entity.TabHaobanOperationSetting">
        update tab_haoban_operation_setting
        <set>
            <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
                wx_enterprise_id = #{wxEnterpriseId},
            </if>
            <if test="clerkPhoneFlag != null">
                clerk_phone_flag = #{clerkPhoneFlag},
            </if>
            <if test="storeEditFlag != null">
                store_edit_flag = #{storeEditFlag},
            </if>
            <if test="createTime != null">
                create_time = #{createTime},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime},
            </if>
            <if test="statusFlag != null">
                status_flag = #{statusFlag},
            </if>
        </set>
        where setting_id = #{settingId}
    </update>

    <!--查询单个-->
    <select id="queryById" resultMap="TabHaobanOperationSettingMap">
        select
        <include refid="Base_Column_List"/>
        from tab_haoban_operation_setting
        where setting_id = #{settingId}
    </select>

    <!--通过实体作为筛选条件查询-->
    <select id="queryAll" parameterType="com.gic.haoban.manage.service.entity.TabHaobanOperationSetting" resultMap="TabHaobanOperationSettingMap">
        select
        <include refid="Base_Column_List"/>
        from tab_haoban_operation_setting
        <where>
            <if test="settingId != null and settingId != ''">
                and setting_id = #{settingId}
            </if>
            <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
                and wx_enterprise_id = #{wxEnterpriseId}
            </if>
            <if test="clerkPhoneFlag != null">
                and clerk_phone_flag = #{clerkPhoneFlag}
            </if>
            <if test="storeEditFlag != null">
                and store_edit_flag = #{storeEditFlag}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
            <if test="statusFlag != null">
                and status_flag = #{statusFlag}
            </if>
        </where>
    </select>

</mapper>
