<?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.chinaitop.depot.intelligent.fumigation.mapper.TFumigationPesticideMapper" >
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticide" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="fumigation_id" property="fumigationId" jdbcType="VARCHAR" />
    <result column="major_insect_pests" property="majorInsectPests" jdbcType="INTEGER" />
    <result column="insect_density" property="insectDensity" jdbcType="VARCHAR" />
    <result column="occurrence_place" property="occurrencePlace" jdbcType="VARCHAR" />
    <result column="insect_product_time" property="insectProductTime" jdbcType="TIMESTAMP" />
    <result column="drug_name" property="drugName" jdbcType="INTEGER" />
    <result column="drug_purity" property="drugPurity" jdbcType="VARCHAR" />
    <result column="use_drug_type" property="useDrugType" jdbcType="VARCHAR" />
    <result column="plann_drug_start_time" property="plannDrugStartTime" jdbcType="TIMESTAMP" />
    <result column="plann_drug_use_up_time" property="plannDrugUseUpTime" jdbcType="TIMESTAMP" />
    <result column="plann_drug_count" property="plannDrugCount" jdbcType="VARCHAR" />
    <result column="seal_type" property="sealType" jdbcType="VARCHAR" />
    <result column="setting_concentration" property="settingConcentration" jdbcType="VARCHAR" />
    <result column="concentration_check_type" property="concentrationCheckType" jdbcType="VARCHAR" />
    <result column="bulk_gas_type" property="bulkGasType" jdbcType="VARCHAR" />
    <result column="drug_user_number" property="drugUserNumber" jdbcType="INTEGER" />
    <result column="pesticide_operator" property="pesticideOperator" jdbcType="VARCHAR" />
    <result column="creater" property="creater" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="state" property="state" jdbcType="INTEGER" />
    <result column="approve_people" property="approvePeople" jdbcType="VARCHAR" />
    <result column="approve_department" property="approveDepartment" jdbcType="VARCHAR" />
    <result column="approve_note" property="approveNote" jdbcType="VARCHAR" />
    <result column="approve_time" property="approveTime" jdbcType="TIMESTAMP" />
    <result column="org_id" property="orgId" jdbcType="VARCHAR" />
    <result column="syryzzqk" property="syryzzqk" jdbcType="VARCHAR" />
    <result column="syzzsh" property="syzzsh" jdbcType="VARCHAR" />
    <result column="jx" property="jx" jdbcType="VARCHAR" />
    <result column="lddwyyl" property="lddwyyl" jdbcType="DECIMAL" />
    <result column="kjdwyyl" property="kjdwyyl" jdbcType="DECIMAL" />
    <result column="syff" property="syff" jdbcType="VARCHAR" />
    <result column="fzsycs" property="fzsycs" jdbcType="VARCHAR" />
    <result column="delete_state" property="deleteState" jdbcType="VARCHAR" />
    <result column="updatetime" property="updatetime" jdbcType="TIMESTAMP" />
  </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, fumigation_id, major_insect_pests, insect_density, occurrence_place, insect_product_time, 
    drug_name, drug_purity, use_drug_type, plann_drug_start_time, plann_drug_use_up_time, 
    plann_drug_count, seal_type, setting_concentration, concentration_check_type, bulk_gas_type, 
    drug_user_number, pesticide_operator, creater, create_time, update_time, state, approve_people, 
    approve_department, approve_note, approve_time, org_id, syryzzqk, syzzsh, jx, lddwyyl, 
    kjdwyyl, syff, fzsycs, delete_state, updatetime
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticideExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_fumigation_pesticide
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from t_fumigation_pesticide
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_fumigation_pesticide
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticideExample" >
    delete from t_fumigation_pesticide
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticide" >
    insert into t_fumigation_pesticide (id, fumigation_id, major_insect_pests, 
      insect_density, occurrence_place, insect_product_time, 
      drug_name, drug_purity, use_drug_type, 
      plann_drug_start_time, plann_drug_use_up_time, 
      plann_drug_count, seal_type, setting_concentration, 
      concentration_check_type, bulk_gas_type, drug_user_number, 
      pesticide_operator, creater, create_time, 
      update_time, state, approve_people, 
      approve_department, approve_note, approve_time, 
      org_id, syryzzqk, syzzsh, 
      jx, lddwyyl, kjdwyyl, 
      syff, fzsycs, delete_state, 
      updatetime)
    values (#{id,jdbcType=VARCHAR}, #{fumigationId,jdbcType=VARCHAR}, #{majorInsectPests,jdbcType=INTEGER}, 
      #{insectDensity,jdbcType=VARCHAR}, #{occurrencePlace,jdbcType=VARCHAR}, #{insectProductTime,jdbcType=TIMESTAMP}, 
      #{drugName,jdbcType=INTEGER}, #{drugPurity,jdbcType=VARCHAR}, #{useDrugType,jdbcType=VARCHAR}, 
      #{plannDrugStartTime,jdbcType=TIMESTAMP}, #{plannDrugUseUpTime,jdbcType=TIMESTAMP}, 
      #{plannDrugCount,jdbcType=VARCHAR}, #{sealType,jdbcType=VARCHAR}, #{settingConcentration,jdbcType=VARCHAR}, 
      #{concentrationCheckType,jdbcType=VARCHAR}, #{bulkGasType,jdbcType=VARCHAR}, #{drugUserNumber,jdbcType=INTEGER}, 
      #{pesticideOperator,jdbcType=VARCHAR}, #{creater,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}, #{approvePeople,jdbcType=VARCHAR}, 
      #{approveDepartment,jdbcType=VARCHAR}, #{approveNote,jdbcType=VARCHAR}, #{approveTime,jdbcType=TIMESTAMP}, 
      #{orgId,jdbcType=VARCHAR}, #{syryzzqk,jdbcType=VARCHAR}, #{syzzsh,jdbcType=VARCHAR}, 
      #{jx,jdbcType=VARCHAR}, #{lddwyyl,jdbcType=DECIMAL}, #{kjdwyyl,jdbcType=DECIMAL}, 
      #{syff,jdbcType=VARCHAR}, #{fzsycs,jdbcType=VARCHAR}, #{deleteState,jdbcType=VARCHAR}, 
      #{updatetime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticide" >
    insert into t_fumigation_pesticide
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="fumigationId != null" >
        fumigation_id,
      </if>
      <if test="majorInsectPests != null" >
        major_insect_pests,
      </if>
      <if test="insectDensity != null" >
        insect_density,
      </if>
      <if test="occurrencePlace != null" >
        occurrence_place,
      </if>
      <if test="insectProductTime != null" >
        insect_product_time,
      </if>
      <if test="drugName != null" >
        drug_name,
      </if>
      <if test="drugPurity != null" >
        drug_purity,
      </if>
      <if test="useDrugType != null" >
        use_drug_type,
      </if>
      <if test="plannDrugStartTime != null" >
        plann_drug_start_time,
      </if>
      <if test="plannDrugUseUpTime != null" >
        plann_drug_use_up_time,
      </if>
      <if test="plannDrugCount != null" >
        plann_drug_count,
      </if>
      <if test="sealType != null" >
        seal_type,
      </if>
      <if test="settingConcentration != null" >
        setting_concentration,
      </if>
      <if test="concentrationCheckType != null" >
        concentration_check_type,
      </if>
      <if test="bulkGasType != null" >
        bulk_gas_type,
      </if>
      <if test="drugUserNumber != null" >
        drug_user_number,
      </if>
      <if test="pesticideOperator != null" >
        pesticide_operator,
      </if>
      <if test="creater != null" >
        creater,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="state != null" >
        state,
      </if>
      <if test="approvePeople != null" >
        approve_people,
      </if>
      <if test="approveDepartment != null" >
        approve_department,
      </if>
      <if test="approveNote != null" >
        approve_note,
      </if>
      <if test="approveTime != null" >
        approve_time,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
      <if test="syryzzqk != null" >
        syryzzqk,
      </if>
      <if test="syzzsh != null" >
        syzzsh,
      </if>
      <if test="jx != null" >
        jx,
      </if>
      <if test="lddwyyl != null" >
        lddwyyl,
      </if>
      <if test="kjdwyyl != null" >
        kjdwyyl,
      </if>
      <if test="syff != null" >
        syff,
      </if>
      <if test="fzsycs != null" >
        fzsycs,
      </if>
      <if test="deleteState != null" >
        delete_state,
      </if>
      <if test="updatetime != null" >
        updatetime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="fumigationId != null" >
        #{fumigationId,jdbcType=VARCHAR},
      </if>
      <if test="majorInsectPests != null" >
        #{majorInsectPests,jdbcType=INTEGER},
      </if>
      <if test="insectDensity != null" >
        #{insectDensity,jdbcType=VARCHAR},
      </if>
      <if test="occurrencePlace != null" >
        #{occurrencePlace,jdbcType=VARCHAR},
      </if>
      <if test="insectProductTime != null" >
        #{insectProductTime,jdbcType=TIMESTAMP},
      </if>
      <if test="drugName != null" >
        #{drugName,jdbcType=INTEGER},
      </if>
      <if test="drugPurity != null" >
        #{drugPurity,jdbcType=VARCHAR},
      </if>
      <if test="useDrugType != null" >
        #{useDrugType,jdbcType=VARCHAR},
      </if>
      <if test="plannDrugStartTime != null" >
        #{plannDrugStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="plannDrugUseUpTime != null" >
        #{plannDrugUseUpTime,jdbcType=TIMESTAMP},
      </if>
      <if test="plannDrugCount != null" >
        #{plannDrugCount,jdbcType=VARCHAR},
      </if>
      <if test="sealType != null" >
        #{sealType,jdbcType=VARCHAR},
      </if>
      <if test="settingConcentration != null" >
        #{settingConcentration,jdbcType=VARCHAR},
      </if>
      <if test="concentrationCheckType != null" >
        #{concentrationCheckType,jdbcType=VARCHAR},
      </if>
      <if test="bulkGasType != null" >
        #{bulkGasType,jdbcType=VARCHAR},
      </if>
      <if test="drugUserNumber != null" >
        #{drugUserNumber,jdbcType=INTEGER},
      </if>
      <if test="pesticideOperator != null" >
        #{pesticideOperator,jdbcType=VARCHAR},
      </if>
      <if test="creater != null" >
        #{creater,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="state != null" >
        #{state,jdbcType=INTEGER},
      </if>
      <if test="approvePeople != null" >
        #{approvePeople,jdbcType=VARCHAR},
      </if>
      <if test="approveDepartment != null" >
        #{approveDepartment,jdbcType=VARCHAR},
      </if>
      <if test="approveNote != null" >
        #{approveNote,jdbcType=VARCHAR},
      </if>
      <if test="approveTime != null" >
        #{approveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orgId != null" >
        #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="syryzzqk != null" >
        #{syryzzqk,jdbcType=VARCHAR},
      </if>
      <if test="syzzsh != null" >
        #{syzzsh,jdbcType=VARCHAR},
      </if>
      <if test="jx != null" >
        #{jx,jdbcType=VARCHAR},
      </if>
      <if test="lddwyyl != null" >
        #{lddwyyl,jdbcType=DECIMAL},
      </if>
      <if test="kjdwyyl != null" >
        #{kjdwyyl,jdbcType=DECIMAL},
      </if>
      <if test="syff != null" >
        #{syff,jdbcType=VARCHAR},
      </if>
      <if test="fzsycs != null" >
        #{fzsycs,jdbcType=VARCHAR},
      </if>
      <if test="deleteState != null" >
        #{deleteState,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticideExample" resultType="java.lang.Integer" >
    select count(*) from t_fumigation_pesticide
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_fumigation_pesticide
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.fumigationId != null" >
        fumigation_id = #{record.fumigationId,jdbcType=VARCHAR},
      </if>
      <if test="record.majorInsectPests != null" >
        major_insect_pests = #{record.majorInsectPests,jdbcType=INTEGER},
      </if>
      <if test="record.insectDensity != null" >
        insect_density = #{record.insectDensity,jdbcType=VARCHAR},
      </if>
      <if test="record.occurrencePlace != null" >
        occurrence_place = #{record.occurrencePlace,jdbcType=VARCHAR},
      </if>
      <if test="record.insectProductTime != null" >
        insect_product_time = #{record.insectProductTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.drugName != null" >
        drug_name = #{record.drugName,jdbcType=INTEGER},
      </if>
      <if test="record.drugPurity != null" >
        drug_purity = #{record.drugPurity,jdbcType=VARCHAR},
      </if>
      <if test="record.useDrugType != null" >
        use_drug_type = #{record.useDrugType,jdbcType=VARCHAR},
      </if>
      <if test="record.plannDrugStartTime != null" >
        plann_drug_start_time = #{record.plannDrugStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.plannDrugUseUpTime != null" >
        plann_drug_use_up_time = #{record.plannDrugUseUpTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.plannDrugCount != null" >
        plann_drug_count = #{record.plannDrugCount,jdbcType=VARCHAR},
      </if>
      <if test="record.sealType != null" >
        seal_type = #{record.sealType,jdbcType=VARCHAR},
      </if>
      <if test="record.settingConcentration != null" >
        setting_concentration = #{record.settingConcentration,jdbcType=VARCHAR},
      </if>
      <if test="record.concentrationCheckType != null" >
        concentration_check_type = #{record.concentrationCheckType,jdbcType=VARCHAR},
      </if>
      <if test="record.bulkGasType != null" >
        bulk_gas_type = #{record.bulkGasType,jdbcType=VARCHAR},
      </if>
      <if test="record.drugUserNumber != null" >
        drug_user_number = #{record.drugUserNumber,jdbcType=INTEGER},
      </if>
      <if test="record.pesticideOperator != null" >
        pesticide_operator = #{record.pesticideOperator,jdbcType=VARCHAR},
      </if>
      <if test="record.creater != null" >
        creater = #{record.creater,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null" >
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.state != null" >
        state = #{record.state,jdbcType=INTEGER},
      </if>
      <if test="record.approvePeople != null" >
        approve_people = #{record.approvePeople,jdbcType=VARCHAR},
      </if>
      <if test="record.approveDepartment != null" >
        approve_department = #{record.approveDepartment,jdbcType=VARCHAR},
      </if>
      <if test="record.approveNote != null" >
        approve_note = #{record.approveNote,jdbcType=VARCHAR},
      </if>
      <if test="record.approveTime != null" >
        approve_time = #{record.approveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.orgId != null" >
        org_id = #{record.orgId,jdbcType=VARCHAR},
      </if>
      <if test="record.syryzzqk != null" >
        syryzzqk = #{record.syryzzqk,jdbcType=VARCHAR},
      </if>
      <if test="record.syzzsh != null" >
        syzzsh = #{record.syzzsh,jdbcType=VARCHAR},
      </if>
      <if test="record.jx != null" >
        jx = #{record.jx,jdbcType=VARCHAR},
      </if>
      <if test="record.lddwyyl != null" >
        lddwyyl = #{record.lddwyyl,jdbcType=DECIMAL},
      </if>
      <if test="record.kjdwyyl != null" >
        kjdwyyl = #{record.kjdwyyl,jdbcType=DECIMAL},
      </if>
      <if test="record.syff != null" >
        syff = #{record.syff,jdbcType=VARCHAR},
      </if>
      <if test="record.fzsycs != null" >
        fzsycs = #{record.fzsycs,jdbcType=VARCHAR},
      </if>
      <if test="record.deleteState != null" >
        delete_state = #{record.deleteState,jdbcType=VARCHAR},
      </if>
      <if test="record.updatetime != null" >
        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_fumigation_pesticide
    set id = #{record.id,jdbcType=VARCHAR},
      fumigation_id = #{record.fumigationId,jdbcType=VARCHAR},
      major_insect_pests = #{record.majorInsectPests,jdbcType=INTEGER},
      insect_density = #{record.insectDensity,jdbcType=VARCHAR},
      occurrence_place = #{record.occurrencePlace,jdbcType=VARCHAR},
      insect_product_time = #{record.insectProductTime,jdbcType=TIMESTAMP},
      drug_name = #{record.drugName,jdbcType=INTEGER},
      drug_purity = #{record.drugPurity,jdbcType=VARCHAR},
      use_drug_type = #{record.useDrugType,jdbcType=VARCHAR},
      plann_drug_start_time = #{record.plannDrugStartTime,jdbcType=TIMESTAMP},
      plann_drug_use_up_time = #{record.plannDrugUseUpTime,jdbcType=TIMESTAMP},
      plann_drug_count = #{record.plannDrugCount,jdbcType=VARCHAR},
      seal_type = #{record.sealType,jdbcType=VARCHAR},
      setting_concentration = #{record.settingConcentration,jdbcType=VARCHAR},
      concentration_check_type = #{record.concentrationCheckType,jdbcType=VARCHAR},
      bulk_gas_type = #{record.bulkGasType,jdbcType=VARCHAR},
      drug_user_number = #{record.drugUserNumber,jdbcType=INTEGER},
      pesticide_operator = #{record.pesticideOperator,jdbcType=VARCHAR},
      creater = #{record.creater,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      state = #{record.state,jdbcType=INTEGER},
      approve_people = #{record.approvePeople,jdbcType=VARCHAR},
      approve_department = #{record.approveDepartment,jdbcType=VARCHAR},
      approve_note = #{record.approveNote,jdbcType=VARCHAR},
      approve_time = #{record.approveTime,jdbcType=TIMESTAMP},
      org_id = #{record.orgId,jdbcType=VARCHAR},
      syryzzqk = #{record.syryzzqk,jdbcType=VARCHAR},
      syzzsh = #{record.syzzsh,jdbcType=VARCHAR},
      jx = #{record.jx,jdbcType=VARCHAR},
      lddwyyl = #{record.lddwyyl,jdbcType=DECIMAL},
      kjdwyyl = #{record.kjdwyyl,jdbcType=DECIMAL},
      syff = #{record.syff,jdbcType=VARCHAR},
      fzsycs = #{record.fzsycs,jdbcType=VARCHAR},
      delete_state = #{record.deleteState,jdbcType=VARCHAR},
      updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticide" >
    update t_fumigation_pesticide
    <set >
      <if test="fumigationId != null" >
        fumigation_id = #{fumigationId,jdbcType=VARCHAR},
      </if>
      <if test="majorInsectPests != null" >
        major_insect_pests = #{majorInsectPests,jdbcType=INTEGER},
      </if>
      <if test="insectDensity != null" >
        insect_density = #{insectDensity,jdbcType=VARCHAR},
      </if>
      <if test="occurrencePlace != null" >
        occurrence_place = #{occurrencePlace,jdbcType=VARCHAR},
      </if>
      <if test="insectProductTime != null" >
        insect_product_time = #{insectProductTime,jdbcType=TIMESTAMP},
      </if>
      <if test="drugName != null" >
        drug_name = #{drugName,jdbcType=INTEGER},
      </if>
      <if test="drugPurity != null" >
        drug_purity = #{drugPurity,jdbcType=VARCHAR},
      </if>
      <if test="useDrugType != null" >
        use_drug_type = #{useDrugType,jdbcType=VARCHAR},
      </if>
      <if test="plannDrugStartTime != null" >
        plann_drug_start_time = #{plannDrugStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="plannDrugUseUpTime != null" >
        plann_drug_use_up_time = #{plannDrugUseUpTime,jdbcType=TIMESTAMP},
      </if>
      <if test="plannDrugCount != null" >
        plann_drug_count = #{plannDrugCount,jdbcType=VARCHAR},
      </if>
      <if test="sealType != null" >
        seal_type = #{sealType,jdbcType=VARCHAR},
      </if>
      <if test="settingConcentration != null" >
        setting_concentration = #{settingConcentration,jdbcType=VARCHAR},
      </if>
      <if test="concentrationCheckType != null" >
        concentration_check_type = #{concentrationCheckType,jdbcType=VARCHAR},
      </if>
      <if test="bulkGasType != null" >
        bulk_gas_type = #{bulkGasType,jdbcType=VARCHAR},
      </if>
      <if test="drugUserNumber != null" >
        drug_user_number = #{drugUserNumber,jdbcType=INTEGER},
      </if>
      <if test="pesticideOperator != null" >
        pesticide_operator = #{pesticideOperator,jdbcType=VARCHAR},
      </if>
      <if test="creater != null" >
        creater = #{creater,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="state != null" >
        state = #{state,jdbcType=INTEGER},
      </if>
      <if test="approvePeople != null" >
        approve_people = #{approvePeople,jdbcType=VARCHAR},
      </if>
      <if test="approveDepartment != null" >
        approve_department = #{approveDepartment,jdbcType=VARCHAR},
      </if>
      <if test="approveNote != null" >
        approve_note = #{approveNote,jdbcType=VARCHAR},
      </if>
      <if test="approveTime != null" >
        approve_time = #{approveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orgId != null" >
        org_id = #{orgId,jdbcType=VARCHAR},
      </if>
      <if test="syryzzqk != null" >
        syryzzqk = #{syryzzqk,jdbcType=VARCHAR},
      </if>
      <if test="syzzsh != null" >
        syzzsh = #{syzzsh,jdbcType=VARCHAR},
      </if>
      <if test="jx != null" >
        jx = #{jx,jdbcType=VARCHAR},
      </if>
      <if test="lddwyyl != null" >
        lddwyyl = #{lddwyyl,jdbcType=DECIMAL},
      </if>
      <if test="kjdwyyl != null" >
        kjdwyyl = #{kjdwyyl,jdbcType=DECIMAL},
      </if>
      <if test="syff != null" >
        syff = #{syff,jdbcType=VARCHAR},
      </if>
      <if test="fzsycs != null" >
        fzsycs = #{fzsycs,jdbcType=VARCHAR},
      </if>
      <if test="deleteState != null" >
        delete_state = #{deleteState,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        updatetime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.fumigation.model.TFumigationPesticide" >
    update t_fumigation_pesticide
    set fumigation_id = #{fumigationId,jdbcType=VARCHAR},
      major_insect_pests = #{majorInsectPests,jdbcType=INTEGER},
      insect_density = #{insectDensity,jdbcType=VARCHAR},
      occurrence_place = #{occurrencePlace,jdbcType=VARCHAR},
      insect_product_time = #{insectProductTime,jdbcType=TIMESTAMP},
      drug_name = #{drugName,jdbcType=INTEGER},
      drug_purity = #{drugPurity,jdbcType=VARCHAR},
      use_drug_type = #{useDrugType,jdbcType=VARCHAR},
      plann_drug_start_time = #{plannDrugStartTime,jdbcType=TIMESTAMP},
      plann_drug_use_up_time = #{plannDrugUseUpTime,jdbcType=TIMESTAMP},
      plann_drug_count = #{plannDrugCount,jdbcType=VARCHAR},
      seal_type = #{sealType,jdbcType=VARCHAR},
      setting_concentration = #{settingConcentration,jdbcType=VARCHAR},
      concentration_check_type = #{concentrationCheckType,jdbcType=VARCHAR},
      bulk_gas_type = #{bulkGasType,jdbcType=VARCHAR},
      drug_user_number = #{drugUserNumber,jdbcType=INTEGER},
      pesticide_operator = #{pesticideOperator,jdbcType=VARCHAR},
      creater = #{creater,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      state = #{state,jdbcType=INTEGER},
      approve_people = #{approvePeople,jdbcType=VARCHAR},
      approve_department = #{approveDepartment,jdbcType=VARCHAR},
      approve_note = #{approveNote,jdbcType=VARCHAR},
      approve_time = #{approveTime,jdbcType=TIMESTAMP},
      org_id = #{orgId,jdbcType=VARCHAR},
      syryzzqk = #{syryzzqk,jdbcType=VARCHAR},
      syzzsh = #{syzzsh,jdbcType=VARCHAR},
      jx = #{jx,jdbcType=VARCHAR},
      lddwyyl = #{lddwyyl,jdbcType=DECIMAL},
      kjdwyyl = #{kjdwyyl,jdbcType=DECIMAL},
      syff = #{syff,jdbcType=VARCHAR},
      fzsycs = #{fzsycs,jdbcType=VARCHAR},
      delete_state = #{deleteState,jdbcType=VARCHAR},
      updatetime = #{updatetime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="getPesticidePlanList" parameterType="java.util.Map" resultType="java.util.HashMap">
    SELECT
    pes.id,
    plan.id fuigationId,
    plan.house_id houseId,
    pes.major_insect_pests majorInsectPests,
    pes.drug_name drugName,
    pes.use_drug_type useDrugType,
    pes.create_time createTime,
    pes.state
    FROM
    t_fumigation_pesticide pes
    LEFT JOIN t_fumigation_plan plan ON pes.fumigation_id = plan.id
    WHERE pes.delete_state = 1 AND plan.org_id = #{orgId,jdbcType=INTEGER}
    <if test="houseId != null" >
      AND plan.house_id = #{houseId,jdbcType=INTEGER}
    </if>
  </select>
  <select id="getPesticidePlanLists" parameterType="java.util.Map" resultType="java.util.HashMap">
    SELECT
    pes.id,
    plan.id fuigationId,
    plan.house_id houseId,
    pes.major_insect_pests majorInsectPests,
    pes.drug_name drugName,
    pes.use_drug_type useDrugType,
    approval.create_time createTime,
    pes.state, approval.id auditId,
    approval.result result,
    approval.task_id taskId,
    approval.task_name taskName,
    approval.operator operator
    FROM
    t_fumigation_pesticide pes
    LEFT JOIN t_fumigation_plan plan ON pes.fumigation_id = plan.id
    LEFT JOIN business_approval approval ON pes.id = approval.task_id
    WHERE plan.org_id = #{orgId,jdbcType=INTEGER}
    AND (pes.state = 2 OR pes.state = 3)
    <if test="userId != null" >
      AND approval.operator = #{userId}
    </if>
    <if test="houseId != null" >
      AND plan.house_id = #{houseId,jdbcType=INTEGER}
    </if>
  </select>
</mapper>