<?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.xmomen.module.base.entity.mapper.CdContractMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.base.entity.CdContract" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="CONTRACT_CODE" property="contractCode" jdbcType="VARCHAR" />
    <result column="CONTRACT_NAME" property="contractName" jdbcType="VARCHAR" />
    <result column="CD_MEMBER_ID" property="cdMemberId" jdbcType="INTEGER" />
    <result column="CD_COMPANY_ID" property="cdCompanyId" jdbcType="INTEGER" />
    <result column="SCOPE" property="scope" jdbcType="INTEGER" />
    <result column="CONTRACT_PRICE" property="contractPrice" jdbcType="DECIMAL" />
    <result column="BEGIN_TIME" property="beginTime" jdbcType="TIMESTAMP" />
    <result column="END_TIME" property="endTime" jdbcType="TIMESTAMP" />
    <result column="IS_DEL" property="isDel" jdbcType="INTEGER" />
    <result column="IS_AUDITOR" property="isAuditor" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    ID, CONTRACT_CODE, CONTRACT_NAME, CD_MEMBER_ID, CD_COMPANY_ID, SCOPE, CONTRACT_PRICE, 
    BEGIN_TIME, END_TIME, IS_DEL, IS_AUDITOR
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.base.entity.CdContractExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cd_contract
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.xmomen.module.base.entity.CdContractExample" >
    delete from cd_contract
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.base.entity.CdContract" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into cd_contract
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="contractCode != null" >
        CONTRACT_CODE,
      </if>
      <if test="contractName != null" >
        CONTRACT_NAME,
      </if>
      <if test="cdMemberId != null" >
        CD_MEMBER_ID,
      </if>
      <if test="cdCompanyId != null" >
        CD_COMPANY_ID,
      </if>
      <if test="scope != null" >
        SCOPE,
      </if>
      <if test="contractPrice != null" >
        CONTRACT_PRICE,
      </if>
      <if test="beginTime != null" >
        BEGIN_TIME,
      </if>
      <if test="endTime != null" >
        END_TIME,
      </if>
      <if test="isDel != null" >
        IS_DEL,
      </if>
      <if test="isAuditor != null" >
        IS_AUDITOR,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="contractCode != null" >
        #{contractCode,jdbcType=VARCHAR},
      </if>
      <if test="contractName != null" >
        #{contractName,jdbcType=VARCHAR},
      </if>
      <if test="cdMemberId != null" >
        #{cdMemberId,jdbcType=INTEGER},
      </if>
      <if test="cdCompanyId != null" >
        #{cdCompanyId,jdbcType=INTEGER},
      </if>
      <if test="scope != null" >
        #{scope,jdbcType=INTEGER},
      </if>
      <if test="contractPrice != null" >
        #{contractPrice,jdbcType=DECIMAL},
      </if>
      <if test="beginTime != null" >
        #{beginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null" >
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isDel != null" >
        #{isDel,jdbcType=INTEGER},
      </if>
      <if test="isAuditor != null" >
        #{isAuditor,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.base.entity.CdContractExample" resultType="java.lang.Integer" >
    select count(*) from cd_contract
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update cd_contract
    <set >
      <if test="record.id != null" >
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.contractCode != null" >
        CONTRACT_CODE = #{record.contractCode,jdbcType=VARCHAR},
      </if>
      <if test="record.contractName != null" >
        CONTRACT_NAME = #{record.contractName,jdbcType=VARCHAR},
      </if>
      <if test="record.cdMemberId != null" >
        CD_MEMBER_ID = #{record.cdMemberId,jdbcType=INTEGER},
      </if>
      <if test="record.cdCompanyId != null" >
        CD_COMPANY_ID = #{record.cdCompanyId,jdbcType=INTEGER},
      </if>
      <if test="record.scope != null" >
        SCOPE = #{record.scope,jdbcType=INTEGER},
      </if>
      <if test="record.contractPrice != null" >
        CONTRACT_PRICE = #{record.contractPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.beginTime != null" >
        BEGIN_TIME = #{record.beginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.endTime != null" >
        END_TIME = #{record.endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isDel != null" >
        IS_DEL = #{record.isDel,jdbcType=INTEGER},
      </if>
      <if test="record.isAuditor != null" >
        IS_AUDITOR = #{record.isAuditor,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>