<?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.emr.dao.Archive_Detail_PictureMapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.Archive_Detail_Picture" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="parent_id" property="parentId" jdbcType="VARCHAR" />
    <result column="min_picture" property="minPicture" jdbcType="VARCHAR" />
    <result column="max_picture" property="maxPicture" jdbcType="VARCHAR" />
    <result column="picture_number" property="pictureNumber" jdbcType="INTEGER" />
    <result column="effective" property="effective" jdbcType="INTEGER" />
    <result column="creater" property="creater" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="VARCHAR" />
    <result column="updater" property="updater" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="VARCHAR" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, parent_id, min_picture, max_picture, picture_number, effective, creater, create_time, 
    updater, update_time, remark
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from archive_detail_picture
    where id = #{id,jdbcType=INTEGER}
    ORDER BY picture_number
  </select>
  <select id="selectByCol" resultMap="BaseResultMap" parameterType="com.emr.entity.Archive_Detail_Picture" >
    select
    <include refid="Base_Column_List" />
    from archive_detail_picture
    where 1=1
    <if test="parentId != null" >
      and parent_id = #{parentId,jdbcType=VARCHAR}
    </if>
    <if test="minPicture != null" >
      and min_picture = #{minPicture,jdbcType=VARCHAR}
    </if>
    <if test="maxPicture != null" >
      and max_picture = #{maxPicture,jdbcType=VARCHAR}
    </if>
    <if test="pictureNumber != null" >
      and picture_number = #{pictureNumber,jdbcType=INTEGER}
    </if>
    <if test="effective != null" >
      and effective = #{effective,jdbcType=INTEGER}
    </if>
    <if test="creater != null" >
      and creater = #{creater,jdbcType=VARCHAR}
    </if>
    <if test="createTime != null" >
      and create_time = #{createTime,jdbcType=VARCHAR}
    </if>
    <if test="updater != null" >
      and updater = #{updater,jdbcType=VARCHAR}
    </if>
    <if test="updateTime != null" >
      and update_time = #{updateTime,jdbcType=VARCHAR}
    </if>
    <if test="remark != null" >
      and remark = #{remark,jdbcType=VARCHAR}
    </if>
    ORDER BY picture_number
  </select>
  <delete id="deleteByCol" parameterType="com.emr.entity.Archive_Detail_Picture" >
    delete from archive_detail_picture
    where 1=1
    <if test="id != null" >
       and id=#{id,jdbcType=INTEGER}
    </if>
    <if test="parentId != null and parentId!= ''" >
      and parent_id=#{parentId,jdbcType=VARCHAR}
    </if>
    <if test="maxPicture != null and maxPicture!= ''" >
      and max_picture like #{maxPicture,jdbcType=VARCHAR}+'%'
    </if>
  </delete>
  <insert id="insert" parameterType="com.emr.entity.Archive_Detail_Picture" >
    insert into archive_detail_picture (id, parent_id, min_picture, 
      max_picture, picture_number, effective, 
      creater, create_time, updater, 
      update_time, remark)
    values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=VARCHAR}, #{minPicture,jdbcType=VARCHAR}, 
      #{maxPicture,jdbcType=VARCHAR}, #{pictureNumber,jdbcType=INTEGER}, #{effective,jdbcType=INTEGER}, 
      #{creater,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{updater,jdbcType=VARCHAR}, 
      #{updateTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.Archive_Detail_Picture" >
    insert into archive_detail_picture
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="parentId != null" >
        parent_id,
      </if>
      <if test="minPicture != null" >
        min_picture,
      </if>
      <if test="maxPicture != null" >
        max_picture,
      </if>
      <if test="pictureNumber != null" >
        picture_number,
      </if>
      <if test="effective != null" >
        effective,
      </if>
      <if test="creater != null" >
        creater,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updater != null" >
        updater,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="remark != null" >
        remark,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="parentId != null" >
        #{parentId,jdbcType=VARCHAR},
      </if>
      <if test="minPicture != null" >
        #{minPicture,jdbcType=VARCHAR},
      </if>
      <if test="maxPicture != null" >
        #{maxPicture,jdbcType=VARCHAR},
      </if>
      <if test="pictureNumber != null" >
        #{pictureNumber,jdbcType=INTEGER},
      </if>
      <if test="effective != null" >
        #{effective,jdbcType=INTEGER},
      </if>
      <if test="creater != null" >
        #{creater,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="updater != null" >
        #{updater,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=VARCHAR},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.Archive_Detail_Picture" >
    update archive_detail_picture
    <set >
      <if test="parentId != null" >
        parent_id = #{parentId,jdbcType=VARCHAR},
      </if>
      <if test="minPicture != null" >
        min_picture = #{minPicture,jdbcType=VARCHAR},
      </if>
      <if test="maxPicture != null" >
        max_picture = #{maxPicture,jdbcType=VARCHAR},
      </if>
      <if test="pictureNumber != null" >
        picture_number = #{pictureNumber,jdbcType=INTEGER},
      </if>
      <if test="effective != null" >
        effective = #{effective,jdbcType=INTEGER},
      </if>
      <if test="creater != null" >
        creater = #{creater,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="updater != null" >
        updater = #{updater,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=VARCHAR},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.emr.entity.Archive_Detail_Picture" >
    update archive_detail_picture
    set parent_id = #{parentId,jdbcType=VARCHAR},
      min_picture = #{minPicture,jdbcType=VARCHAR},
      max_picture = #{maxPicture,jdbcType=VARCHAR},
      picture_number = #{pictureNumber,jdbcType=INTEGER},
      effective = #{effective,jdbcType=INTEGER},
      creater = #{creater,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR},
      updater = #{updater,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>