<?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="resources/ctariff.CtariffRitemMapper">
  <resultMap id="BaseResultMap" type="com.ag.ctc.domain.pojo.TariffRitem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="TENANCY_ID" jdbcType="VARCHAR" property="tenancyId" />
    <result column="RULE_ID" jdbcType="VARCHAR" property="ruleId" />
    <result column="KEY_NAME" jdbcType="VARCHAR" property="keyName" />
    <result column="OPER_CHAR" jdbcType="VARCHAR" property="operChar" />
    <result column="COMPARE_VAL" jdbcType="VARCHAR" property="compareVal" />
    <result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy" />
    <result column="CREATED_ON" jdbcType="TIMESTAMP" property="createdOn" />
    <result column="UPDATED_BY" jdbcType="VARCHAR" property="updatedBy" />
    <result column="UPDATED_ON" jdbcType="TIMESTAMP" property="updatedOn" />
    <result column="COMPARE_NAME" jdbcType="VARCHAR" property="compareName" />
    <result column="DEL_FLAG" jdbcType="DECIMAL" property="delFlag" />
    <result column="COMNAME1" jdbcType="VARCHAR" property="comname1" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    ID, TENANCY_ID, RULE_ID, KEY_NAME, OPER_CHAR, COMPARE_VAL, CREATED_BY, CREATED_ON, 
    UPDATED_BY, UPDATED_ON, COMPARE_NAME, DEL_FLAG, COMNAME1
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from C_TARIFF_RITEM
    where ID = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from C_TARIFF_RITEM
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.ag.ctc.domain.pojo.TariffRitem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into C_TARIFF_RITEM (ID, TENANCY_ID, RULE_ID, 
      KEY_NAME, OPER_CHAR, COMPARE_VAL, 
      CREATED_BY, CREATED_ON, UPDATED_BY, 
      UPDATED_ON, COMPARE_NAME, DEL_FLAG, 
      COMNAME1)
    values (#{id,jdbcType=VARCHAR}, #{tenancyId,jdbcType=VARCHAR}, #{ruleId,jdbcType=VARCHAR}, 
      #{keyName,jdbcType=VARCHAR}, #{operChar,jdbcType=VARCHAR}, #{compareVal,jdbcType=VARCHAR}, 
      #{createdBy,jdbcType=VARCHAR}, #{createdOn,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, 
      #{updatedOn,jdbcType=TIMESTAMP}, #{compareName,jdbcType=VARCHAR}, #{delFlag,jdbcType=DECIMAL}, 
      #{comname1,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ag.ctc.domain.pojo.TariffRitem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into C_TARIFF_RITEM
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="tenancyId != null">
        TENANCY_ID,
      </if>
      <if test="ruleId != null">
        RULE_ID,
      </if>
      <if test="keyName != null">
        KEY_NAME,
      </if>
      <if test="operChar != null">
        OPER_CHAR,
      </if>
      <if test="compareVal != null">
        COMPARE_VAL,
      </if>
      <if test="createdBy != null">
        CREATED_BY,
      </if>
      <if test="createdOn != null">
        CREATED_ON,
      </if>
      <if test="updatedBy != null">
        UPDATED_BY,
      </if>
      <if test="updatedOn != null">
        UPDATED_ON,
      </if>
      <if test="compareName != null">
        COMPARE_NAME,
      </if>
      <if test="delFlag != null">
        DEL_FLAG,
      </if>
      <if test="comname1 != null">
        COMNAME1,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="tenancyId != null">
        #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="ruleId != null">
        #{ruleId,jdbcType=VARCHAR},
      </if>
      <if test="keyName != null">
        #{keyName,jdbcType=VARCHAR},
      </if>
      <if test="operChar != null">
        #{operChar,jdbcType=VARCHAR},
      </if>
      <if test="compareVal != null">
        #{compareVal,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        #{updatedOn,jdbcType=TIMESTAMP},
      </if>
      <if test="compareName != null">
        #{compareName,jdbcType=VARCHAR},
      </if>
      <if test="delFlag != null">
        #{delFlag,jdbcType=DECIMAL},
      </if>
      <if test="comname1 != null">
        #{comname1,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ag.ctc.domain.pojo.TariffRitem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update C_TARIFF_RITEM
    <set>
      <if test="tenancyId != null">
        TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="ruleId != null">
        RULE_ID = #{ruleId,jdbcType=VARCHAR},
      </if>
      <if test="keyName != null">
        KEY_NAME = #{keyName,jdbcType=VARCHAR},
      </if>
      <if test="operChar != null">
        OPER_CHAR = #{operChar,jdbcType=VARCHAR},
      </if>
      <if test="compareVal != null">
        COMPARE_VAL = #{compareVal,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP},
      </if>
      <if test="compareName != null">
        COMPARE_NAME = #{compareName,jdbcType=VARCHAR},
      </if>
      <if test="delFlag != null">
        DEL_FLAG = #{delFlag,jdbcType=DECIMAL},
      </if>
      <if test="comname1 != null">
        COMNAME1 = #{comname1,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ag.ctc.domain.pojo.TariffRitem">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update C_TARIFF_RITEM
    set TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      RULE_ID = #{ruleId,jdbcType=VARCHAR},
      KEY_NAME = #{keyName,jdbcType=VARCHAR},
      OPER_CHAR = #{operChar,jdbcType=VARCHAR},
      COMPARE_VAL = #{compareVal,jdbcType=VARCHAR},
      CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP},
      COMPARE_NAME = #{compareName,jdbcType=VARCHAR},
      DEL_FLAG = #{delFlag,jdbcType=DECIMAL},
      COMNAME1 = #{comname1,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=VARCHAR}
  </update>

  <select id="selectByruleid" parameterType="java.lang.String" resultMap="BaseResultMap">


    select
    <include refid="Base_Column_List" />
    from C_TARIFF_RITEM
    where rule_ID = #{id,jdbcType=VARCHAR}
  </select>

  <delete id="deleteByRuleId" parameterType="java.lang.String">

    delete from C_TARIFF_RITEM
    where RULE_ID = #{id,jdbcType=VARCHAR}
  </delete>
  <update id="updateDelFlagById" parameterType="java.lang.String">
    update C_TARIFF_RITEM
    set DEL_FLAG = 1
    where ID = #{id,jdbcType=VARCHAR}
  </update>
</mapper>