<?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.ruoyi.system.mapper.visit.dr.VisitDrCheckHistoryAttachMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttach">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="check_id" jdbcType="VARCHAR" property="checkId" />
    <result column="file_name" jdbcType="VARCHAR" property="fileName" />
    <result column="file_path" jdbcType="VARCHAR" property="filePath" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="is_valid" jdbcType="VARCHAR" property="isValid" />
    <result column="extfield_one" jdbcType="VARCHAR" property="extfieldOne" />
    <result column="extfield_two" jdbcType="VARCHAR" property="extfieldTwo" />
    <result column="extfield_three" jdbcType="VARCHAR" property="extfieldThree" />
    <result column="extfield_four" jdbcType="VARCHAR" property="extfieldFour" />
    <result column="extfield_five" jdbcType="VARCHAR" property="extfieldFive" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, check_id, file_name, file_path, create_time, is_valid, extfield_one, extfield_two, 
    extfield_three, extfield_four, extfield_five
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttachExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from visit_dr_check_history_attach
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from visit_dr_check_history_attach
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from visit_dr_check_history_attach
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttachExample">
    delete from visit_dr_check_history_attach
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttach">
    insert into visit_dr_check_history_attach (id, check_id, file_name,
      file_path, create_time, is_valid, 
      extfield_one, extfield_two, extfield_three, 
      extfield_four, extfield_five)
    values (#{id,jdbcType=VARCHAR}, #{checkId,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, 
      #{filePath,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{isValid,jdbcType=VARCHAR}, 
      #{extfieldOne,jdbcType=VARCHAR}, #{extfieldTwo,jdbcType=VARCHAR}, #{extfieldThree,jdbcType=VARCHAR}, 
      #{extfieldFour,jdbcType=VARCHAR}, #{extfieldFive,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttach">
    insert into visit_dr_check_history_attach
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="checkId != null">
        check_id,
      </if>
      <if test="fileName != null">
        file_name,
      </if>
      <if test="filePath != null">
        file_path,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="isValid != null">
        is_valid,
      </if>
      <if test="extfieldOne != null">
        extfield_one,
      </if>
      <if test="extfieldTwo != null">
        extfield_two,
      </if>
      <if test="extfieldThree != null">
        extfield_three,
      </if>
      <if test="extfieldFour != null">
        extfield_four,
      </if>
      <if test="extfieldFive != null">
        extfield_five,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="checkId != null">
        #{checkId,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        #{filePath,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="extfieldOne != null">
        #{extfieldOne,jdbcType=VARCHAR},
      </if>
      <if test="extfieldTwo != null">
        #{extfieldTwo,jdbcType=VARCHAR},
      </if>
      <if test="extfieldThree != null">
        #{extfieldThree,jdbcType=VARCHAR},
      </if>
      <if test="extfieldFour != null">
        #{extfieldFour,jdbcType=VARCHAR},
      </if>
      <if test="extfieldFive != null">
        #{extfieldFive,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttachExample" resultType="java.lang.Long">
    select count(*) from visit_dr_check_history_attach
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update visit_dr_check_history_attach
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.checkId != null">
        check_id = #{record.checkId,jdbcType=VARCHAR},
      </if>
      <if test="record.fileName != null">
        file_name = #{record.fileName,jdbcType=VARCHAR},
      </if>
      <if test="record.filePath != null">
        file_path = #{record.filePath,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=VARCHAR},
      </if>
      <if test="record.isValid != null">
        is_valid = #{record.isValid,jdbcType=VARCHAR},
      </if>
      <if test="record.extfieldOne != null">
        extfield_one = #{record.extfieldOne,jdbcType=VARCHAR},
      </if>
      <if test="record.extfieldTwo != null">
        extfield_two = #{record.extfieldTwo,jdbcType=VARCHAR},
      </if>
      <if test="record.extfieldThree != null">
        extfield_three = #{record.extfieldThree,jdbcType=VARCHAR},
      </if>
      <if test="record.extfieldFour != null">
        extfield_four = #{record.extfieldFour,jdbcType=VARCHAR},
      </if>
      <if test="record.extfieldFive != null">
        extfield_five = #{record.extfieldFive,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update visit_dr_check_history_attach
    set id = #{record.id,jdbcType=VARCHAR},
      check_id = #{record.checkId,jdbcType=VARCHAR},
      file_name = #{record.fileName,jdbcType=VARCHAR},
      file_path = #{record.filePath,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=VARCHAR},
      is_valid = #{record.isValid,jdbcType=VARCHAR},
      extfield_one = #{record.extfieldOne,jdbcType=VARCHAR},
      extfield_two = #{record.extfieldTwo,jdbcType=VARCHAR},
      extfield_three = #{record.extfieldThree,jdbcType=VARCHAR},
      extfield_four = #{record.extfieldFour,jdbcType=VARCHAR},
      extfield_five = #{record.extfieldFive,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttach">
    update visit_dr_check_history_attach
    <set>
      <if test="checkId != null">
        check_id = #{checkId,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        file_name = #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="filePath != null">
        file_path = #{filePath,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        is_valid = #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="extfieldOne != null">
        extfield_one = #{extfieldOne,jdbcType=VARCHAR},
      </if>
      <if test="extfieldTwo != null">
        extfield_two = #{extfieldTwo,jdbcType=VARCHAR},
      </if>
      <if test="extfieldThree != null">
        extfield_three = #{extfieldThree,jdbcType=VARCHAR},
      </if>
      <if test="extfieldFour != null">
        extfield_four = #{extfieldFour,jdbcType=VARCHAR},
      </if>
      <if test="extfieldFive != null">
        extfield_five = #{extfieldFive,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCheckHistoryAttach">
    update visit_dr_check_history_attach
    set check_id = #{checkId,jdbcType=VARCHAR},
      file_name = #{fileName,jdbcType=VARCHAR},
      file_path = #{filePath,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR},
      is_valid = #{isValid,jdbcType=VARCHAR},
      extfield_one = #{extfieldOne,jdbcType=VARCHAR},
      extfield_two = #{extfieldTwo,jdbcType=VARCHAR},
      extfield_three = #{extfieldThree,jdbcType=VARCHAR},
      extfield_four = #{extfieldFour,jdbcType=VARCHAR},
      extfield_five = #{extfieldFive,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>