<?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.CdMemberMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.base.entity.CdMember" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="NAME" property="name" jdbcType="VARCHAR" />
    <result column="PASSWORD" property="password" jdbcType="VARCHAR" />
    <result column="PHONE_NUMBER" property="phoneNumber" jdbcType="VARCHAR" />
    <result column="ADDRESS" property="address" jdbcType="VARCHAR" />
    <result column="CD_COMPANY_ID" property="cdCompanyId" jdbcType="INTEGER" />
    <result column="CD_USER_ID" property="cdUserId" jdbcType="INTEGER" />
    <result column="SPARE_NAME" property="spareName" jdbcType="VARCHAR" />
    <result column="SPARE_NAME2" property="spareName2" jdbcType="VARCHAR" />
    <result column="SPARE_TEL" property="spareTel" jdbcType="VARCHAR" />
    <result column="SPARE_TEL2" property="spareTel2" jdbcType="VARCHAR" />
    <result column="TEL_NUMBER" property="telNumber" jdbcType="VARCHAR" />
    <result column="OFFICE_TEL" property="officeTel" jdbcType="VARCHAR" />
    <result column="SPARE_ADDRESS" property="spareAddress" jdbcType="VARCHAR" />
    <result column="SPARE_ADDRESS2" property="spareAddress2" jdbcType="VARCHAR" />
    <result column="FLAG" property="flag" jdbcType="VARCHAR" />
    <result column="MEMBER_TYPE" property="memberType" jdbcType="INTEGER" />
    <result column="email" property="email" jdbcType="VARCHAR" />
  </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, NAME, PASSWORD, PHONE_NUMBER, ADDRESS, CD_COMPANY_ID, CD_USER_ID, SPARE_NAME, 
    SPARE_NAME2, SPARE_TEL, SPARE_TEL2, TEL_NUMBER, OFFICE_TEL, SPARE_ADDRESS, SPARE_ADDRESS2, 
    FLAG, MEMBER_TYPE, email
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.base.entity.CdMemberExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cd_member
    <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.CdMemberExample" >
    delete from cd_member
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.base.entity.CdMember" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into cd_member
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="name != null" >
        NAME,
      </if>
      <if test="password != null" >
        PASSWORD,
      </if>
      <if test="phoneNumber != null" >
        PHONE_NUMBER,
      </if>
      <if test="address != null" >
        ADDRESS,
      </if>
      <if test="cdCompanyId != null" >
        CD_COMPANY_ID,
      </if>
      <if test="cdUserId != null" >
        CD_USER_ID,
      </if>
      <if test="spareName != null" >
        SPARE_NAME,
      </if>
      <if test="spareName2 != null" >
        SPARE_NAME2,
      </if>
      <if test="spareTel != null" >
        SPARE_TEL,
      </if>
      <if test="spareTel2 != null" >
        SPARE_TEL2,
      </if>
      <if test="telNumber != null" >
        TEL_NUMBER,
      </if>
      <if test="officeTel != null" >
        OFFICE_TEL,
      </if>
      <if test="spareAddress != null" >
        SPARE_ADDRESS,
      </if>
      <if test="spareAddress2 != null" >
        SPARE_ADDRESS2,
      </if>
      <if test="flag != null" >
        FLAG,
      </if>
      <if test="memberType != null" >
        MEMBER_TYPE,
      </if>
      <if test="email != null" >
        email,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="phoneNumber != null" >
        #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="cdCompanyId != null" >
        #{cdCompanyId,jdbcType=INTEGER},
      </if>
      <if test="cdUserId != null" >
        #{cdUserId,jdbcType=INTEGER},
      </if>
      <if test="spareName != null" >
        #{spareName,jdbcType=VARCHAR},
      </if>
      <if test="spareName2 != null" >
        #{spareName2,jdbcType=VARCHAR},
      </if>
      <if test="spareTel != null" >
        #{spareTel,jdbcType=VARCHAR},
      </if>
      <if test="spareTel2 != null" >
        #{spareTel2,jdbcType=VARCHAR},
      </if>
      <if test="telNumber != null" >
        #{telNumber,jdbcType=VARCHAR},
      </if>
      <if test="officeTel != null" >
        #{officeTel,jdbcType=VARCHAR},
      </if>
      <if test="spareAddress != null" >
        #{spareAddress,jdbcType=VARCHAR},
      </if>
      <if test="spareAddress2 != null" >
        #{spareAddress2,jdbcType=VARCHAR},
      </if>
      <if test="flag != null" >
        #{flag,jdbcType=VARCHAR},
      </if>
      <if test="memberType != null" >
        #{memberType,jdbcType=INTEGER},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.base.entity.CdMemberExample" resultType="java.lang.Integer" >
    select count(*) from cd_member
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update cd_member
    <set >
      <if test="record.id != null" >
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.name != null" >
        NAME = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null" >
        PASSWORD = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.phoneNumber != null" >
        PHONE_NUMBER = #{record.phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.address != null" >
        ADDRESS = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.cdCompanyId != null" >
        CD_COMPANY_ID = #{record.cdCompanyId,jdbcType=INTEGER},
      </if>
      <if test="record.cdUserId != null" >
        CD_USER_ID = #{record.cdUserId,jdbcType=INTEGER},
      </if>
      <if test="record.spareName != null" >
        SPARE_NAME = #{record.spareName,jdbcType=VARCHAR},
      </if>
      <if test="record.spareName2 != null" >
        SPARE_NAME2 = #{record.spareName2,jdbcType=VARCHAR},
      </if>
      <if test="record.spareTel != null" >
        SPARE_TEL = #{record.spareTel,jdbcType=VARCHAR},
      </if>
      <if test="record.spareTel2 != null" >
        SPARE_TEL2 = #{record.spareTel2,jdbcType=VARCHAR},
      </if>
      <if test="record.telNumber != null" >
        TEL_NUMBER = #{record.telNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.officeTel != null" >
        OFFICE_TEL = #{record.officeTel,jdbcType=VARCHAR},
      </if>
      <if test="record.spareAddress != null" >
        SPARE_ADDRESS = #{record.spareAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.spareAddress2 != null" >
        SPARE_ADDRESS2 = #{record.spareAddress2,jdbcType=VARCHAR},
      </if>
      <if test="record.flag != null" >
        FLAG = #{record.flag,jdbcType=VARCHAR},
      </if>
      <if test="record.memberType != null" >
        MEMBER_TYPE = #{record.memberType,jdbcType=INTEGER},
      </if>
      <if test="record.email != null" >
        email = #{record.email,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>