<?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.VisitDrCompanyDataPoolMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.visit.dr.VisitDrCompanyDataPool">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="rule_id" jdbcType="VARCHAR" property="ruleId" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
    <result column="company_name" jdbcType="VARCHAR" property="companyName" />
    <result column="random_field" jdbcType="INTEGER" property="randomField" />
    <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, rule_id, company_id, company_name, random_field, extfield_one, extfield_two, 
    extfield_three, extfield_four, extfield_five
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCompanyDataPoolExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from visit_dr_company_data_pool
    <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_company_data_pool
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from visit_dr_company_data_pool
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCompanyDataPoolExample">
    delete from visit_dr_company_data_pool
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.visit.dr.VisitDrCompanyDataPool">
    insert into visit_dr_company_data_pool (id, rule_id, company_id,
      company_name, random_field, extfield_one, 
      extfield_two, extfield_three, extfield_four, 
      extfield_five)
    values (#{id,jdbcType=VARCHAR}, #{ruleId,jdbcType=VARCHAR}, #{companyId,jdbcType=VARCHAR}, 
      #{companyName,jdbcType=VARCHAR}, #{randomField,jdbcType=INTEGER}, #{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.VisitDrCompanyDataPool">
    insert into visit_dr_company_data_pool
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="ruleId != null">
        rule_id,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="companyName != null">
        company_name,
      </if>
      <if test="randomField != null">
        random_field,
      </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="ruleId != null">
        #{ruleId,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyName != null">
        #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="randomField != null">
        #{randomField,jdbcType=INTEGER},
      </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.VisitDrCompanyDataPoolExample" resultType="java.lang.Long">
    select count(*) from visit_dr_company_data_pool
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update visit_dr_company_data_pool
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.ruleId != null">
        rule_id = #{record.ruleId,jdbcType=VARCHAR},
      </if>
      <if test="record.companyId != null">
        company_id = #{record.companyId,jdbcType=VARCHAR},
      </if>
      <if test="record.companyName != null">
        company_name = #{record.companyName,jdbcType=VARCHAR},
      </if>
      <if test="record.randomField != null">
        random_field = #{record.randomField,jdbcType=INTEGER},
      </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_company_data_pool
    set id = #{record.id,jdbcType=VARCHAR},
      rule_id = #{record.ruleId,jdbcType=VARCHAR},
      company_id = #{record.companyId,jdbcType=VARCHAR},
      company_name = #{record.companyName,jdbcType=VARCHAR},
      random_field = #{record.randomField,jdbcType=INTEGER},
      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.VisitDrCompanyDataPool">
    update visit_dr_company_data_pool
    <set>
      <if test="ruleId != null">
        rule_id = #{ruleId,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="companyName != null">
        company_name = #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="randomField != null">
        random_field = #{randomField,jdbcType=INTEGER},
      </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.VisitDrCompanyDataPool">
    update visit_dr_company_data_pool
    set rule_id = #{ruleId,jdbcType=VARCHAR},
      company_id = #{companyId,jdbcType=VARCHAR},
      company_name = #{companyName,jdbcType=VARCHAR},
      random_field = #{randomField,jdbcType=INTEGER},
      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>
  <delete id="deleteAllDataByRuleId" parameterType="java.lang.String">
    delete from visit_dr_company_data_pool
    where rule_id = #{ruleId,jdbcType=VARCHAR}
  </delete>
  <select id="selectDataByRuleId" parameterType="java.lang.String" resultMap="BaseResultMap">
    select *  from visit_dr_company_data_pool
    where rule_id=#{ruleId,jdbcType=VARCHAR}
  </select>
</mapper>