<?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="pwc.taxtech.atms.dao.KeyValueConfigMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entitiy.KeyValueConfig">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="VARCHAR" property="ID" />
    <result column="KeyCode" jdbcType="VARCHAR" property="keyCode" />
    <result column="Name" jdbcType="VARCHAR" property="name" />
    <result column="KeyValueType" jdbcType="INTEGER" property="keyValueType" />
    <result column="Formula" jdbcType="VARCHAR" property="formula" />
    <result column="IsConstant" jdbcType="INTEGER" property="isConstant" />
    <result column="CalculateStatus" jdbcType="INTEGER" property="calculateStatus" />
    <result column="ResultType" jdbcType="INTEGER" property="resultType" />
    <result column="ServiceTypeIDs" jdbcType="VARCHAR" property="serviceTypeIDs" />
    <result column="IndustryIDs" jdbcType="VARCHAR" property="industryIDs" />
    <result column="Description" jdbcType="VARCHAR" property="description" />
    <result column="Creator" jdbcType="VARCHAR" property="creator" />
    <result column="CreateTime" jdbcType="TIMESTAMP" property="createTime" />
    <result column="Updator" jdbcType="VARCHAR" property="updator" />
    <result column="UpdateTime" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="DataSource" jdbcType="VARCHAR" property="dataSource" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    ID, KeyCode, Name, KeyValueType, Formula, IsConstant, CalculateStatus, ResultType, 
    ServiceTypeIDs, IndustryIDs, Description, Creator, CreateTime, Updator, UpdateTime, 
    DataSource
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfigExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from KeyValueConfig
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from KeyValueConfig
    where ID = #{ID,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from KeyValueConfig
    where ID = #{ID,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfigExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from KeyValueConfig
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfig">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into KeyValueConfig (ID, KeyCode, Name, 
      KeyValueType, Formula, IsConstant, 
      CalculateStatus, ResultType, ServiceTypeIDs, 
      IndustryIDs, Description, Creator, 
      CreateTime, Updator, UpdateTime, 
      DataSource)
    values (#{ID,jdbcType=VARCHAR}, #{keyCode,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{keyValueType,jdbcType=INTEGER}, #{formula,jdbcType=VARCHAR}, #{isConstant,jdbcType=INTEGER}, 
      #{calculateStatus,jdbcType=INTEGER}, #{resultType,jdbcType=INTEGER}, #{serviceTypeIDs,jdbcType=VARCHAR}, 
      #{industryIDs,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updator,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{dataSource,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfig">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into KeyValueConfig
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="ID != null">
        ID,
      </if>
      <if test="keyCode != null">
        KeyCode,
      </if>
      <if test="name != null">
        Name,
      </if>
      <if test="keyValueType != null">
        KeyValueType,
      </if>
      <if test="formula != null">
        Formula,
      </if>
      <if test="isConstant != null">
        IsConstant,
      </if>
      <if test="calculateStatus != null">
        CalculateStatus,
      </if>
      <if test="resultType != null">
        ResultType,
      </if>
      <if test="serviceTypeIDs != null">
        ServiceTypeIDs,
      </if>
      <if test="industryIDs != null">
        IndustryIDs,
      </if>
      <if test="description != null">
        Description,
      </if>
      <if test="creator != null">
        Creator,
      </if>
      <if test="createTime != null">
        CreateTime,
      </if>
      <if test="updator != null">
        Updator,
      </if>
      <if test="updateTime != null">
        UpdateTime,
      </if>
      <if test="dataSource != null">
        DataSource,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="ID != null">
        #{ID,jdbcType=VARCHAR},
      </if>
      <if test="keyCode != null">
        #{keyCode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="keyValueType != null">
        #{keyValueType,jdbcType=INTEGER},
      </if>
      <if test="formula != null">
        #{formula,jdbcType=VARCHAR},
      </if>
      <if test="isConstant != null">
        #{isConstant,jdbcType=INTEGER},
      </if>
      <if test="calculateStatus != null">
        #{calculateStatus,jdbcType=INTEGER},
      </if>
      <if test="resultType != null">
        #{resultType,jdbcType=INTEGER},
      </if>
      <if test="serviceTypeIDs != null">
        #{serviceTypeIDs,jdbcType=VARCHAR},
      </if>
      <if test="industryIDs != null">
        #{industryIDs,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="creator != null">
        #{creator,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updator != null">
        #{updator,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dataSource != null">
        #{dataSource,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfigExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from KeyValueConfig
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update KeyValueConfig
    <set>
      <if test="record.ID != null">
        ID = #{record.ID,jdbcType=VARCHAR},
      </if>
      <if test="record.keyCode != null">
        KeyCode = #{record.keyCode,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        Name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.keyValueType != null">
        KeyValueType = #{record.keyValueType,jdbcType=INTEGER},
      </if>
      <if test="record.formula != null">
        Formula = #{record.formula,jdbcType=VARCHAR},
      </if>
      <if test="record.isConstant != null">
        IsConstant = #{record.isConstant,jdbcType=INTEGER},
      </if>
      <if test="record.calculateStatus != null">
        CalculateStatus = #{record.calculateStatus,jdbcType=INTEGER},
      </if>
      <if test="record.resultType != null">
        ResultType = #{record.resultType,jdbcType=INTEGER},
      </if>
      <if test="record.serviceTypeIDs != null">
        ServiceTypeIDs = #{record.serviceTypeIDs,jdbcType=VARCHAR},
      </if>
      <if test="record.industryIDs != null">
        IndustryIDs = #{record.industryIDs,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        Description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.creator != null">
        Creator = #{record.creator,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        CreateTime = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updator != null">
        Updator = #{record.updator,jdbcType=VARCHAR},
      </if>
      <if test="record.updateTime != null">
        UpdateTime = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.dataSource != null">
        DataSource = #{record.dataSource,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update KeyValueConfig
    set ID = #{record.ID,jdbcType=VARCHAR},
      KeyCode = #{record.keyCode,jdbcType=VARCHAR},
      Name = #{record.name,jdbcType=VARCHAR},
      KeyValueType = #{record.keyValueType,jdbcType=INTEGER},
      Formula = #{record.formula,jdbcType=VARCHAR},
      IsConstant = #{record.isConstant,jdbcType=INTEGER},
      CalculateStatus = #{record.calculateStatus,jdbcType=INTEGER},
      ResultType = #{record.resultType,jdbcType=INTEGER},
      ServiceTypeIDs = #{record.serviceTypeIDs,jdbcType=VARCHAR},
      IndustryIDs = #{record.industryIDs,jdbcType=VARCHAR},
      Description = #{record.description,jdbcType=VARCHAR},
      Creator = #{record.creator,jdbcType=VARCHAR},
      CreateTime = #{record.createTime,jdbcType=TIMESTAMP},
      Updator = #{record.updator,jdbcType=VARCHAR},
      UpdateTime = #{record.updateTime,jdbcType=TIMESTAMP},
      DataSource = #{record.dataSource,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfig">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update KeyValueConfig
    <set>
      <if test="keyCode != null">
        KeyCode = #{keyCode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        Name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="keyValueType != null">
        KeyValueType = #{keyValueType,jdbcType=INTEGER},
      </if>
      <if test="formula != null">
        Formula = #{formula,jdbcType=VARCHAR},
      </if>
      <if test="isConstant != null">
        IsConstant = #{isConstant,jdbcType=INTEGER},
      </if>
      <if test="calculateStatus != null">
        CalculateStatus = #{calculateStatus,jdbcType=INTEGER},
      </if>
      <if test="resultType != null">
        ResultType = #{resultType,jdbcType=INTEGER},
      </if>
      <if test="serviceTypeIDs != null">
        ServiceTypeIDs = #{serviceTypeIDs,jdbcType=VARCHAR},
      </if>
      <if test="industryIDs != null">
        IndustryIDs = #{industryIDs,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        Description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="creator != null">
        Creator = #{creator,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        CreateTime = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updator != null">
        Updator = #{updator,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        UpdateTime = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="dataSource != null">
        DataSource = #{dataSource,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{ID,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfig">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update KeyValueConfig
    set KeyCode = #{keyCode,jdbcType=VARCHAR},
      Name = #{name,jdbcType=VARCHAR},
      KeyValueType = #{keyValueType,jdbcType=INTEGER},
      Formula = #{formula,jdbcType=VARCHAR},
      IsConstant = #{isConstant,jdbcType=INTEGER},
      CalculateStatus = #{calculateStatus,jdbcType=INTEGER},
      ResultType = #{resultType,jdbcType=INTEGER},
      ServiceTypeIDs = #{serviceTypeIDs,jdbcType=VARCHAR},
      IndustryIDs = #{industryIDs,jdbcType=VARCHAR},
      Description = #{description,jdbcType=VARCHAR},
      Creator = #{creator,jdbcType=VARCHAR},
      CreateTime = #{createTime,jdbcType=TIMESTAMP},
      Updator = #{updator,jdbcType=VARCHAR},
      UpdateTime = #{updateTime,jdbcType=TIMESTAMP},
      DataSource = #{dataSource,jdbcType=VARCHAR}
    where ID = #{ID,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entitiy.KeyValueConfigExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from KeyValueConfig
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
	<select id="selectKeyValueConfigsByOrderByCreateTime" resultMap="BaseResultMap">
		SELECT KeyValueConfig.ID,
		KeyValueConfig.KeyCode,
		KeyValueConfig.Name,
		KeyValueConfig.KeyValueType,
		KeyValueConfig.Formula,
		KeyValueConfig.IsConstant,
		KeyValueConfig.CalculateStatus,
		KeyValueConfig.ResultType,
		KeyValueConfig.ServiceTypeIDs,
		KeyValueConfig.IndustryIDs,
		KeyValueConfig.Description,
		KeyValueConfig.Creator,
		KeyValueConfig.CreateTime,
		KeyValueConfig.Updator,
		KeyValueConfig.UpdateTime,
		KeyValueConfig.DataSource
		FROM tax_admin.KeyValueConfig order by KeyValueConfig.createtime
	</select>
</mapper>