<?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.CdAttachmentMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.base.entity.CdAttachment" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="business_id" property="businessId" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="VARCHAR" />
    <result column="file_name" property="fileName" jdbcType="VARCHAR" />
    <result column="file_extend" property="fileExtend" jdbcType="VARCHAR" />
    <result column="file_path" property="filePath" jdbcType="VARCHAR" />
    <result column="upload_date" property="uploadDate" jdbcType="TIMESTAMP" />
    <result column="upload_user" property="uploadUser" 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, business_id, type, file_name, file_extend, file_path, upload_date, upload_user
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.base.entity.CdAttachmentExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from cd_attachment
    <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.CdAttachmentExample" >
    delete from cd_attachment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.base.entity.CdAttachment" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into cd_attachment
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="businessId != null" >
        business_id,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="fileName != null" >
        file_name,
      </if>
      <if test="fileExtend != null" >
        file_extend,
      </if>
      <if test="filePath != null" >
        file_path,
      </if>
      <if test="uploadDate != null" >
        upload_date,
      </if>
      <if test="uploadUser != null" >
        upload_user,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="businessId != null" >
        #{businessId,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null" >
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="fileExtend != null" >
        #{fileExtend,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null" >
        #{filePath,jdbcType=VARCHAR},
      </if>
      <if test="uploadDate != null" >
        #{uploadDate,jdbcType=TIMESTAMP},
      </if>
      <if test="uploadUser != null" >
        #{uploadUser,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.base.entity.CdAttachmentExample" resultType="java.lang.Integer" >
    select count(*) from cd_attachment
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update cd_attachment
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.businessId != null" >
        business_id = #{record.businessId,jdbcType=VARCHAR},
      </if>
      <if test="record.type != null" >
        type = #{record.type,jdbcType=VARCHAR},
      </if>
      <if test="record.fileName != null" >
        file_name = #{record.fileName,jdbcType=VARCHAR},
      </if>
      <if test="record.fileExtend != null" >
        file_extend = #{record.fileExtend,jdbcType=VARCHAR},
      </if>
      <if test="record.filePath != null" >
        file_path = #{record.filePath,jdbcType=VARCHAR},
      </if>
      <if test="record.uploadDate != null" >
        upload_date = #{record.uploadDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.uploadUser != null" >
        upload_user = #{record.uploadUser,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>