<?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.TabHaobanAuditSettingMapper" >
  <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanAuditSetting" >
    <id column="setting_id" property="settingId" jdbcType="VARCHAR" />
    <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
    <result column="audit_flag" property="auditFlag" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
    <result column="clerk_change_flag" property="clerkChangeFlag" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    setting_id, wx_enterprise_id, audit_flag, create_time, update_time, status_flag, 
    clerk_change_flag
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from tab_haoban_audit_setting
    where setting_id = #{settingId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from tab_haoban_audit_setting
    where setting_id = #{settingId,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAuditSetting" >
    insert into tab_haoban_audit_setting (setting_id, wx_enterprise_id, audit_flag, 
      create_time, update_time, status_flag, 
      clerk_change_flag)
    values (#{settingId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{auditFlag,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, 
      #{clerkChangeFlag,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAuditSetting" >
    insert into tab_haoban_audit_setting
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="settingId != null" >
        setting_id,
      </if>
      <if test="wxEnterpriseId != null" >
        wx_enterprise_id,
      </if>
      <if test="auditFlag != null" >
        audit_flag,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="statusFlag != null" >
        status_flag,
      </if>
      <if test="clerkChangeFlag != null" >
        clerk_change_flag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="settingId != null" >
        #{settingId,jdbcType=VARCHAR},
      </if>
      <if test="wxEnterpriseId != null" >
        #{wxEnterpriseId,jdbcType=VARCHAR},
      </if>
      <if test="auditFlag != null" >
        #{auditFlag,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="statusFlag != null" >
        #{statusFlag,jdbcType=INTEGER},
      </if>
      <if test="clerkChangeFlag != null" >
        #{clerkChangeFlag,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAuditSetting" >
    update tab_haoban_audit_setting
    <set >
      <if test="wxEnterpriseId != null" >
        wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
      </if>
      <if test="auditFlag != null" >
        audit_flag = #{auditFlag,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="statusFlag != null" >
        status_flag = #{statusFlag,jdbcType=INTEGER},
      </if>
      <if test="clerkChangeFlag != null" >
        clerk_change_flag = #{clerkChangeFlag,jdbcType=INTEGER},
      </if>
    </set>
    where setting_id = #{settingId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAuditSetting" >
    update tab_haoban_audit_setting
    set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
      audit_flag = #{auditFlag,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      status_flag = #{statusFlag,jdbcType=INTEGER},
      clerk_change_flag = #{clerkChangeFlag,jdbcType=INTEGER}
    where setting_id = #{settingId,jdbcType=VARCHAR}
  </update>
  
        <select id="findSetting" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from tab_haoban_audit_setting
    where  wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
    	and status_flag = 1
  </select>
</mapper>