<?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.ventilation.mapper.StorageFoodbasicinfoMapper">
  <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="house_id" jdbcType="INTEGER" property="houseId" />
    <result column="warehouse_id" jdbcType="INTEGER" property="warehouseId" />
    <result column="record_unite" jdbcType="VARCHAR" property="recordUnite" />
    <result column="keep_unite" jdbcType="VARCHAR" property="keepUnite" />
    <result column="location_num" jdbcType="VARCHAR" property="locationNum" />
    <result column="quality" jdbcType="VARCHAR" property="quality" />
    <result column="sub_type" jdbcType="INTEGER" property="subType" />
    <result column="sub_type_detailed" jdbcType="INTEGER" property="subTypeDetailed" />
    <result column="htype" jdbcType="VARCHAR" property="htype" />
    <result column="number" jdbcType="DOUBLE" property="number" />
    <result column="stand_number" jdbcType="DOUBLE" property="standNumber" />
    <result column="input_year" jdbcType="TIMESTAMP" property="inputYear" />
    <result column="grow_year" jdbcType="INTEGER" property="growYear" />
    <result column="keep_method" jdbcType="VARCHAR" property="keepMethod" />
    <result column="level" jdbcType="VARCHAR" property="level" />
    <result column="weight" jdbcType="VARCHAR" property="weight" />
    <result column="impurity" jdbcType="VARCHAR" property="impurity" />
    <result column="water" jdbcType="VARCHAR" property="water" />
    <result column="unsound" jdbcType="VARCHAR" property="unsound" />
    <result column="recorder" jdbcType="VARCHAR" property="recorder" />
    <result column="house_type" jdbcType="VARCHAR" property="houseType" />
    <result column="design_house_capacity" jdbcType="DECIMAL" property="designHouseCapacity" />
    <result column="valid_house_capacity" jdbcType="VARCHAR" property="validHouseCapacity" />
    <result column="price" jdbcType="VARCHAR" property="price" />
    <result column="place_of_origin" jdbcType="VARCHAR" property="placeOfOrigin" />
    <result column="storage_location" jdbcType="VARCHAR" property="storageLocation" />
    <result column="disperse_capacity" jdbcType="VARCHAR" property="disperseCapacity" />
    <result column="length" jdbcType="DECIMAL" property="length" />
    <result column="width" jdbcType="DECIMAL" property="width" />
    <result column="height" jdbcType="DECIMAL" property="height" />
    <result column="pack_num" jdbcType="VARCHAR" property="packNum" />
    <result column="pack_average_weight" jdbcType="VARCHAR" property="packAverageWeight" />
    <result column="keeper_ids" jdbcType="VARCHAR" property="keeperIds" />
    <result column="gluten_water_count" jdbcType="VARCHAR" property="glutenWaterCount" />
    <result column="eat_score" jdbcType="VARCHAR" property="eatScore" />
    <result column="unit_head" jdbcType="VARCHAR" property="unitHead" />
    <result column="fat_index" jdbcType="VARCHAR" property="fatIndex" />
    <result column="peroxide_value" jdbcType="VARCHAR" property="peroxideValue" />
    <result column="refraction_index" jdbcType="VARCHAR" property="refractionIndex" />
    <result column="residual_solvent" jdbcType="VARCHAR" property="residualSolvent" />
    <result column="filling_time" jdbcType="VARCHAR" property="fillingTime" />
    <result column="line_height" jdbcType="DECIMAL" property="lineHeight" />
    <result column="seal_status" jdbcType="VARCHAR" property="sealStatus" />
    <result column="auth_code" jdbcType="VARCHAR" property="authCode" />
    <result column="org_id" jdbcType="INTEGER" property="orgId" />
    <result column="history_status" jdbcType="INTEGER" property="historyStatus" />
  </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, house_id, warehouse_id, record_unite, keep_unite, location_num, quality, sub_type, 
    sub_type_detailed, htype, number, stand_number, input_year, grow_year, keep_method, 
    level, weight, impurity, water, unsound, recorder, house_type, design_house_capacity, 
    valid_house_capacity, price, place_of_origin, storage_location, disperse_capacity, 
    length, width, height, pack_num, pack_average_weight, keeper_ids, gluten_water_count, 
    eat_score, unit_head, fat_index, peroxide_value, refraction_index, residual_solvent, 
    filling_time, line_height, seal_status, auth_code, org_id, history_status
  </sql>
  <select id="selectByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from storage_foodbasicinfo
    <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.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from storage_foodbasicinfo
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from storage_foodbasicinfo
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfoExample">
    delete from storage_foodbasicinfo
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfo">
    insert into storage_foodbasicinfo (id, house_id, warehouse_id, 
      record_unite, keep_unite, location_num, 
      quality, sub_type, sub_type_detailed, 
      htype, number, stand_number, 
      input_year, grow_year, keep_method, 
      level, weight, impurity, 
      water, unsound, recorder, 
      house_type, design_house_capacity, valid_house_capacity, 
      price, place_of_origin, storage_location, 
      disperse_capacity, length, width, 
      height, pack_num, pack_average_weight, 
      keeper_ids, gluten_water_count, eat_score, 
      unit_head, fat_index, peroxide_value, 
      refraction_index, residual_solvent, filling_time, 
      line_height, seal_status, auth_code, 
      org_id, history_status)
    values (#{id,jdbcType=INTEGER}, #{houseId,jdbcType=INTEGER}, #{warehouseId,jdbcType=INTEGER}, 
      #{recordUnite,jdbcType=VARCHAR}, #{keepUnite,jdbcType=VARCHAR}, #{locationNum,jdbcType=VARCHAR}, 
      #{quality,jdbcType=VARCHAR}, #{subType,jdbcType=INTEGER}, #{subTypeDetailed,jdbcType=INTEGER}, 
      #{htype,jdbcType=VARCHAR}, #{number,jdbcType=DOUBLE}, #{standNumber,jdbcType=DOUBLE}, 
      #{inputYear,jdbcType=TIMESTAMP}, #{growYear,jdbcType=INTEGER}, #{keepMethod,jdbcType=VARCHAR}, 
      #{level,jdbcType=VARCHAR}, #{weight,jdbcType=VARCHAR}, #{impurity,jdbcType=VARCHAR}, 
      #{water,jdbcType=VARCHAR}, #{unsound,jdbcType=VARCHAR}, #{recorder,jdbcType=VARCHAR}, 
      #{houseType,jdbcType=VARCHAR}, #{designHouseCapacity,jdbcType=DECIMAL}, #{validHouseCapacity,jdbcType=VARCHAR}, 
      #{price,jdbcType=VARCHAR}, #{placeOfOrigin,jdbcType=VARCHAR}, #{storageLocation,jdbcType=VARCHAR}, 
      #{disperseCapacity,jdbcType=VARCHAR}, #{length,jdbcType=DECIMAL}, #{width,jdbcType=DECIMAL}, 
      #{height,jdbcType=DECIMAL}, #{packNum,jdbcType=VARCHAR}, #{packAverageWeight,jdbcType=VARCHAR}, 
      #{keeperIds,jdbcType=VARCHAR}, #{glutenWaterCount,jdbcType=VARCHAR}, #{eatScore,jdbcType=VARCHAR}, 
      #{unitHead,jdbcType=VARCHAR}, #{fatIndex,jdbcType=VARCHAR}, #{peroxideValue,jdbcType=VARCHAR}, 
      #{refractionIndex,jdbcType=VARCHAR}, #{residualSolvent,jdbcType=VARCHAR}, #{fillingTime,jdbcType=VARCHAR}, 
      #{lineHeight,jdbcType=DECIMAL}, #{sealStatus,jdbcType=VARCHAR}, #{authCode,jdbcType=VARCHAR}, 
      #{orgId,jdbcType=INTEGER}, #{historyStatus,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfo">
    insert into storage_foodbasicinfo
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="houseId != null">
        house_id,
      </if>
      <if test="warehouseId != null">
        warehouse_id,
      </if>
      <if test="recordUnite != null">
        record_unite,
      </if>
      <if test="keepUnite != null">
        keep_unite,
      </if>
      <if test="locationNum != null">
        location_num,
      </if>
      <if test="quality != null">
        quality,
      </if>
      <if test="subType != null">
        sub_type,
      </if>
      <if test="subTypeDetailed != null">
        sub_type_detailed,
      </if>
      <if test="htype != null">
        htype,
      </if>
      <if test="number != null">
        number,
      </if>
      <if test="standNumber != null">
        stand_number,
      </if>
      <if test="inputYear != null">
        input_year,
      </if>
      <if test="growYear != null">
        grow_year,
      </if>
      <if test="keepMethod != null">
        keep_method,
      </if>
      <if test="level != null">
        level,
      </if>
      <if test="weight != null">
        weight,
      </if>
      <if test="impurity != null">
        impurity,
      </if>
      <if test="water != null">
        water,
      </if>
      <if test="unsound != null">
        unsound,
      </if>
      <if test="recorder != null">
        recorder,
      </if>
      <if test="houseType != null">
        house_type,
      </if>
      <if test="designHouseCapacity != null">
        design_house_capacity,
      </if>
      <if test="validHouseCapacity != null">
        valid_house_capacity,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="placeOfOrigin != null">
        place_of_origin,
      </if>
      <if test="storageLocation != null">
        storage_location,
      </if>
      <if test="disperseCapacity != null">
        disperse_capacity,
      </if>
      <if test="length != null">
        length,
      </if>
      <if test="width != null">
        width,
      </if>
      <if test="height != null">
        height,
      </if>
      <if test="packNum != null">
        pack_num,
      </if>
      <if test="packAverageWeight != null">
        pack_average_weight,
      </if>
      <if test="keeperIds != null">
        keeper_ids,
      </if>
      <if test="glutenWaterCount != null">
        gluten_water_count,
      </if>
      <if test="eatScore != null">
        eat_score,
      </if>
      <if test="unitHead != null">
        unit_head,
      </if>
      <if test="fatIndex != null">
        fat_index,
      </if>
      <if test="peroxideValue != null">
        peroxide_value,
      </if>
      <if test="refractionIndex != null">
        refraction_index,
      </if>
      <if test="residualSolvent != null">
        residual_solvent,
      </if>
      <if test="fillingTime != null">
        filling_time,
      </if>
      <if test="lineHeight != null">
        line_height,
      </if>
      <if test="sealStatus != null">
        seal_status,
      </if>
      <if test="authCode != null">
        auth_code,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
      <if test="historyStatus != null">
        history_status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="houseId != null">
        #{houseId,jdbcType=INTEGER},
      </if>
      <if test="warehouseId != null">
        #{warehouseId,jdbcType=INTEGER},
      </if>
      <if test="recordUnite != null">
        #{recordUnite,jdbcType=VARCHAR},
      </if>
      <if test="keepUnite != null">
        #{keepUnite,jdbcType=VARCHAR},
      </if>
      <if test="locationNum != null">
        #{locationNum,jdbcType=VARCHAR},
      </if>
      <if test="quality != null">
        #{quality,jdbcType=VARCHAR},
      </if>
      <if test="subType != null">
        #{subType,jdbcType=INTEGER},
      </if>
      <if test="subTypeDetailed != null">
        #{subTypeDetailed,jdbcType=INTEGER},
      </if>
      <if test="htype != null">
        #{htype,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        #{number,jdbcType=DOUBLE},
      </if>
      <if test="standNumber != null">
        #{standNumber,jdbcType=DOUBLE},
      </if>
      <if test="inputYear != null">
        #{inputYear,jdbcType=TIMESTAMP},
      </if>
      <if test="growYear != null">
        #{growYear,jdbcType=INTEGER},
      </if>
      <if test="keepMethod != null">
        #{keepMethod,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        #{level,jdbcType=VARCHAR},
      </if>
      <if test="weight != null">
        #{weight,jdbcType=VARCHAR},
      </if>
      <if test="impurity != null">
        #{impurity,jdbcType=VARCHAR},
      </if>
      <if test="water != null">
        #{water,jdbcType=VARCHAR},
      </if>
      <if test="unsound != null">
        #{unsound,jdbcType=VARCHAR},
      </if>
      <if test="recorder != null">
        #{recorder,jdbcType=VARCHAR},
      </if>
      <if test="houseType != null">
        #{houseType,jdbcType=VARCHAR},
      </if>
      <if test="designHouseCapacity != null">
        #{designHouseCapacity,jdbcType=DECIMAL},
      </if>
      <if test="validHouseCapacity != null">
        #{validHouseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        #{price,jdbcType=VARCHAR},
      </if>
      <if test="placeOfOrigin != null">
        #{placeOfOrigin,jdbcType=VARCHAR},
      </if>
      <if test="storageLocation != null">
        #{storageLocation,jdbcType=VARCHAR},
      </if>
      <if test="disperseCapacity != null">
        #{disperseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="length != null">
        #{length,jdbcType=DECIMAL},
      </if>
      <if test="width != null">
        #{width,jdbcType=DECIMAL},
      </if>
      <if test="height != null">
        #{height,jdbcType=DECIMAL},
      </if>
      <if test="packNum != null">
        #{packNum,jdbcType=VARCHAR},
      </if>
      <if test="packAverageWeight != null">
        #{packAverageWeight,jdbcType=VARCHAR},
      </if>
      <if test="keeperIds != null">
        #{keeperIds,jdbcType=VARCHAR},
      </if>
      <if test="glutenWaterCount != null">
        #{glutenWaterCount,jdbcType=VARCHAR},
      </if>
      <if test="eatScore != null">
        #{eatScore,jdbcType=VARCHAR},
      </if>
      <if test="unitHead != null">
        #{unitHead,jdbcType=VARCHAR},
      </if>
      <if test="fatIndex != null">
        #{fatIndex,jdbcType=VARCHAR},
      </if>
      <if test="peroxideValue != null">
        #{peroxideValue,jdbcType=VARCHAR},
      </if>
      <if test="refractionIndex != null">
        #{refractionIndex,jdbcType=VARCHAR},
      </if>
      <if test="residualSolvent != null">
        #{residualSolvent,jdbcType=VARCHAR},
      </if>
      <if test="fillingTime != null">
        #{fillingTime,jdbcType=VARCHAR},
      </if>
      <if test="lineHeight != null">
        #{lineHeight,jdbcType=DECIMAL},
      </if>
      <if test="sealStatus != null">
        #{sealStatus,jdbcType=VARCHAR},
      </if>
      <if test="authCode != null">
        #{authCode,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=INTEGER},
      </if>
      <if test="historyStatus != null">
        #{historyStatus,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfoExample" resultType="java.lang.Integer">
    select count(*) from storage_foodbasicinfo
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update storage_foodbasicinfo
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.houseId != null">
        house_id = #{record.houseId,jdbcType=INTEGER},
      </if>
      <if test="record.warehouseId != null">
        warehouse_id = #{record.warehouseId,jdbcType=INTEGER},
      </if>
      <if test="record.recordUnite != null">
        record_unite = #{record.recordUnite,jdbcType=VARCHAR},
      </if>
      <if test="record.keepUnite != null">
        keep_unite = #{record.keepUnite,jdbcType=VARCHAR},
      </if>
      <if test="record.locationNum != null">
        location_num = #{record.locationNum,jdbcType=VARCHAR},
      </if>
      <if test="record.quality != null">
        quality = #{record.quality,jdbcType=VARCHAR},
      </if>
      <if test="record.subType != null">
        sub_type = #{record.subType,jdbcType=INTEGER},
      </if>
      <if test="record.subTypeDetailed != null">
        sub_type_detailed = #{record.subTypeDetailed,jdbcType=INTEGER},
      </if>
      <if test="record.htype != null">
        htype = #{record.htype,jdbcType=VARCHAR},
      </if>
      <if test="record.number != null">
        number = #{record.number,jdbcType=DOUBLE},
      </if>
      <if test="record.standNumber != null">
        stand_number = #{record.standNumber,jdbcType=DOUBLE},
      </if>
      <if test="record.inputYear != null">
        input_year = #{record.inputYear,jdbcType=TIMESTAMP},
      </if>
      <if test="record.growYear != null">
        grow_year = #{record.growYear,jdbcType=INTEGER},
      </if>
      <if test="record.keepMethod != null">
        keep_method = #{record.keepMethod,jdbcType=VARCHAR},
      </if>
      <if test="record.level != null">
        level = #{record.level,jdbcType=VARCHAR},
      </if>
      <if test="record.weight != null">
        weight = #{record.weight,jdbcType=VARCHAR},
      </if>
      <if test="record.impurity != null">
        impurity = #{record.impurity,jdbcType=VARCHAR},
      </if>
      <if test="record.water != null">
        water = #{record.water,jdbcType=VARCHAR},
      </if>
      <if test="record.unsound != null">
        unsound = #{record.unsound,jdbcType=VARCHAR},
      </if>
      <if test="record.recorder != null">
        recorder = #{record.recorder,jdbcType=VARCHAR},
      </if>
      <if test="record.houseType != null">
        house_type = #{record.houseType,jdbcType=VARCHAR},
      </if>
      <if test="record.designHouseCapacity != null">
        design_house_capacity = #{record.designHouseCapacity,jdbcType=DECIMAL},
      </if>
      <if test="record.validHouseCapacity != null">
        valid_house_capacity = #{record.validHouseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="record.price != null">
        price = #{record.price,jdbcType=VARCHAR},
      </if>
      <if test="record.placeOfOrigin != null">
        place_of_origin = #{record.placeOfOrigin,jdbcType=VARCHAR},
      </if>
      <if test="record.storageLocation != null">
        storage_location = #{record.storageLocation,jdbcType=VARCHAR},
      </if>
      <if test="record.disperseCapacity != null">
        disperse_capacity = #{record.disperseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="record.length != null">
        length = #{record.length,jdbcType=DECIMAL},
      </if>
      <if test="record.width != null">
        width = #{record.width,jdbcType=DECIMAL},
      </if>
      <if test="record.height != null">
        height = #{record.height,jdbcType=DECIMAL},
      </if>
      <if test="record.packNum != null">
        pack_num = #{record.packNum,jdbcType=VARCHAR},
      </if>
      <if test="record.packAverageWeight != null">
        pack_average_weight = #{record.packAverageWeight,jdbcType=VARCHAR},
      </if>
      <if test="record.keeperIds != null">
        keeper_ids = #{record.keeperIds,jdbcType=VARCHAR},
      </if>
      <if test="record.glutenWaterCount != null">
        gluten_water_count = #{record.glutenWaterCount,jdbcType=VARCHAR},
      </if>
      <if test="record.eatScore != null">
        eat_score = #{record.eatScore,jdbcType=VARCHAR},
      </if>
      <if test="record.unitHead != null">
        unit_head = #{record.unitHead,jdbcType=VARCHAR},
      </if>
      <if test="record.fatIndex != null">
        fat_index = #{record.fatIndex,jdbcType=VARCHAR},
      </if>
      <if test="record.peroxideValue != null">
        peroxide_value = #{record.peroxideValue,jdbcType=VARCHAR},
      </if>
      <if test="record.refractionIndex != null">
        refraction_index = #{record.refractionIndex,jdbcType=VARCHAR},
      </if>
      <if test="record.residualSolvent != null">
        residual_solvent = #{record.residualSolvent,jdbcType=VARCHAR},
      </if>
      <if test="record.fillingTime != null">
        filling_time = #{record.fillingTime,jdbcType=VARCHAR},
      </if>
      <if test="record.lineHeight != null">
        line_height = #{record.lineHeight,jdbcType=DECIMAL},
      </if>
      <if test="record.sealStatus != null">
        seal_status = #{record.sealStatus,jdbcType=VARCHAR},
      </if>
      <if test="record.authCode != null">
        auth_code = #{record.authCode,jdbcType=VARCHAR},
      </if>
      <if test="record.orgId != null">
        org_id = #{record.orgId,jdbcType=INTEGER},
      </if>
      <if test="record.historyStatus != null">
        history_status = #{record.historyStatus,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update storage_foodbasicinfo
    set id = #{record.id,jdbcType=INTEGER},
      house_id = #{record.houseId,jdbcType=INTEGER},
      warehouse_id = #{record.warehouseId,jdbcType=INTEGER},
      record_unite = #{record.recordUnite,jdbcType=VARCHAR},
      keep_unite = #{record.keepUnite,jdbcType=VARCHAR},
      location_num = #{record.locationNum,jdbcType=VARCHAR},
      quality = #{record.quality,jdbcType=VARCHAR},
      sub_type = #{record.subType,jdbcType=INTEGER},
      sub_type_detailed = #{record.subTypeDetailed,jdbcType=INTEGER},
      htype = #{record.htype,jdbcType=VARCHAR},
      number = #{record.number,jdbcType=DOUBLE},
      stand_number = #{record.standNumber,jdbcType=DOUBLE},
      input_year = #{record.inputYear,jdbcType=TIMESTAMP},
      grow_year = #{record.growYear,jdbcType=INTEGER},
      keep_method = #{record.keepMethod,jdbcType=VARCHAR},
      level = #{record.level,jdbcType=VARCHAR},
      weight = #{record.weight,jdbcType=VARCHAR},
      impurity = #{record.impurity,jdbcType=VARCHAR},
      water = #{record.water,jdbcType=VARCHAR},
      unsound = #{record.unsound,jdbcType=VARCHAR},
      recorder = #{record.recorder,jdbcType=VARCHAR},
      house_type = #{record.houseType,jdbcType=VARCHAR},
      design_house_capacity = #{record.designHouseCapacity,jdbcType=DECIMAL},
      valid_house_capacity = #{record.validHouseCapacity,jdbcType=VARCHAR},
      price = #{record.price,jdbcType=VARCHAR},
      place_of_origin = #{record.placeOfOrigin,jdbcType=VARCHAR},
      storage_location = #{record.storageLocation,jdbcType=VARCHAR},
      disperse_capacity = #{record.disperseCapacity,jdbcType=VARCHAR},
      length = #{record.length,jdbcType=DECIMAL},
      width = #{record.width,jdbcType=DECIMAL},
      height = #{record.height,jdbcType=DECIMAL},
      pack_num = #{record.packNum,jdbcType=VARCHAR},
      pack_average_weight = #{record.packAverageWeight,jdbcType=VARCHAR},
      keeper_ids = #{record.keeperIds,jdbcType=VARCHAR},
      gluten_water_count = #{record.glutenWaterCount,jdbcType=VARCHAR},
      eat_score = #{record.eatScore,jdbcType=VARCHAR},
      unit_head = #{record.unitHead,jdbcType=VARCHAR},
      fat_index = #{record.fatIndex,jdbcType=VARCHAR},
      peroxide_value = #{record.peroxideValue,jdbcType=VARCHAR},
      refraction_index = #{record.refractionIndex,jdbcType=VARCHAR},
      residual_solvent = #{record.residualSolvent,jdbcType=VARCHAR},
      filling_time = #{record.fillingTime,jdbcType=VARCHAR},
      line_height = #{record.lineHeight,jdbcType=DECIMAL},
      seal_status = #{record.sealStatus,jdbcType=VARCHAR},
      auth_code = #{record.authCode,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=INTEGER},
      history_status = #{record.historyStatus,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfo">
    update storage_foodbasicinfo
    <set>
      <if test="houseId != null">
        house_id = #{houseId,jdbcType=INTEGER},
      </if>
      <if test="warehouseId != null">
        warehouse_id = #{warehouseId,jdbcType=INTEGER},
      </if>
      <if test="recordUnite != null">
        record_unite = #{recordUnite,jdbcType=VARCHAR},
      </if>
      <if test="keepUnite != null">
        keep_unite = #{keepUnite,jdbcType=VARCHAR},
      </if>
      <if test="locationNum != null">
        location_num = #{locationNum,jdbcType=VARCHAR},
      </if>
      <if test="quality != null">
        quality = #{quality,jdbcType=VARCHAR},
      </if>
      <if test="subType != null">
        sub_type = #{subType,jdbcType=INTEGER},
      </if>
      <if test="subTypeDetailed != null">
        sub_type_detailed = #{subTypeDetailed,jdbcType=INTEGER},
      </if>
      <if test="htype != null">
        htype = #{htype,jdbcType=VARCHAR},
      </if>
      <if test="number != null">
        number = #{number,jdbcType=DOUBLE},
      </if>
      <if test="standNumber != null">
        stand_number = #{standNumber,jdbcType=DOUBLE},
      </if>
      <if test="inputYear != null">
        input_year = #{inputYear,jdbcType=TIMESTAMP},
      </if>
      <if test="growYear != null">
        grow_year = #{growYear,jdbcType=INTEGER},
      </if>
      <if test="keepMethod != null">
        keep_method = #{keepMethod,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        level = #{level,jdbcType=VARCHAR},
      </if>
      <if test="weight != null">
        weight = #{weight,jdbcType=VARCHAR},
      </if>
      <if test="impurity != null">
        impurity = #{impurity,jdbcType=VARCHAR},
      </if>
      <if test="water != null">
        water = #{water,jdbcType=VARCHAR},
      </if>
      <if test="unsound != null">
        unsound = #{unsound,jdbcType=VARCHAR},
      </if>
      <if test="recorder != null">
        recorder = #{recorder,jdbcType=VARCHAR},
      </if>
      <if test="houseType != null">
        house_type = #{houseType,jdbcType=VARCHAR},
      </if>
      <if test="designHouseCapacity != null">
        design_house_capacity = #{designHouseCapacity,jdbcType=DECIMAL},
      </if>
      <if test="validHouseCapacity != null">
        valid_house_capacity = #{validHouseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=VARCHAR},
      </if>
      <if test="placeOfOrigin != null">
        place_of_origin = #{placeOfOrigin,jdbcType=VARCHAR},
      </if>
      <if test="storageLocation != null">
        storage_location = #{storageLocation,jdbcType=VARCHAR},
      </if>
      <if test="disperseCapacity != null">
        disperse_capacity = #{disperseCapacity,jdbcType=VARCHAR},
      </if>
      <if test="length != null">
        length = #{length,jdbcType=DECIMAL},
      </if>
      <if test="width != null">
        width = #{width,jdbcType=DECIMAL},
      </if>
      <if test="height != null">
        height = #{height,jdbcType=DECIMAL},
      </if>
      <if test="packNum != null">
        pack_num = #{packNum,jdbcType=VARCHAR},
      </if>
      <if test="packAverageWeight != null">
        pack_average_weight = #{packAverageWeight,jdbcType=VARCHAR},
      </if>
      <if test="keeperIds != null">
        keeper_ids = #{keeperIds,jdbcType=VARCHAR},
      </if>
      <if test="glutenWaterCount != null">
        gluten_water_count = #{glutenWaterCount,jdbcType=VARCHAR},
      </if>
      <if test="eatScore != null">
        eat_score = #{eatScore,jdbcType=VARCHAR},
      </if>
      <if test="unitHead != null">
        unit_head = #{unitHead,jdbcType=VARCHAR},
      </if>
      <if test="fatIndex != null">
        fat_index = #{fatIndex,jdbcType=VARCHAR},
      </if>
      <if test="peroxideValue != null">
        peroxide_value = #{peroxideValue,jdbcType=VARCHAR},
      </if>
      <if test="refractionIndex != null">
        refraction_index = #{refractionIndex,jdbcType=VARCHAR},
      </if>
      <if test="residualSolvent != null">
        residual_solvent = #{residualSolvent,jdbcType=VARCHAR},
      </if>
      <if test="fillingTime != null">
        filling_time = #{fillingTime,jdbcType=VARCHAR},
      </if>
      <if test="lineHeight != null">
        line_height = #{lineHeight,jdbcType=DECIMAL},
      </if>
      <if test="sealStatus != null">
        seal_status = #{sealStatus,jdbcType=VARCHAR},
      </if>
      <if test="authCode != null">
        auth_code = #{authCode,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=INTEGER},
      </if>
      <if test="historyStatus != null">
        history_status = #{historyStatus,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfo">
    update storage_foodbasicinfo
    set house_id = #{houseId,jdbcType=INTEGER},
      warehouse_id = #{warehouseId,jdbcType=INTEGER},
      record_unite = #{recordUnite,jdbcType=VARCHAR},
      keep_unite = #{keepUnite,jdbcType=VARCHAR},
      location_num = #{locationNum,jdbcType=VARCHAR},
      quality = #{quality,jdbcType=VARCHAR},
      sub_type = #{subType,jdbcType=INTEGER},
      sub_type_detailed = #{subTypeDetailed,jdbcType=INTEGER},
      htype = #{htype,jdbcType=VARCHAR},
      number = #{number,jdbcType=DOUBLE},
      stand_number = #{standNumber,jdbcType=DOUBLE},
      input_year = #{inputYear,jdbcType=TIMESTAMP},
      grow_year = #{growYear,jdbcType=INTEGER},
      keep_method = #{keepMethod,jdbcType=VARCHAR},
      level = #{level,jdbcType=VARCHAR},
      weight = #{weight,jdbcType=VARCHAR},
      impurity = #{impurity,jdbcType=VARCHAR},
      water = #{water,jdbcType=VARCHAR},
      unsound = #{unsound,jdbcType=VARCHAR},
      recorder = #{recorder,jdbcType=VARCHAR},
      house_type = #{houseType,jdbcType=VARCHAR},
      design_house_capacity = #{designHouseCapacity,jdbcType=DECIMAL},
      valid_house_capacity = #{validHouseCapacity,jdbcType=VARCHAR},
      price = #{price,jdbcType=VARCHAR},
      place_of_origin = #{placeOfOrigin,jdbcType=VARCHAR},
      storage_location = #{storageLocation,jdbcType=VARCHAR},
      disperse_capacity = #{disperseCapacity,jdbcType=VARCHAR},
      length = #{length,jdbcType=DECIMAL},
      width = #{width,jdbcType=DECIMAL},
      height = #{height,jdbcType=DECIMAL},
      pack_num = #{packNum,jdbcType=VARCHAR},
      pack_average_weight = #{packAverageWeight,jdbcType=VARCHAR},
      keeper_ids = #{keeperIds,jdbcType=VARCHAR},
      gluten_water_count = #{glutenWaterCount,jdbcType=VARCHAR},
      eat_score = #{eatScore,jdbcType=VARCHAR},
      unit_head = #{unitHead,jdbcType=VARCHAR},
      fat_index = #{fatIndex,jdbcType=VARCHAR},
      peroxide_value = #{peroxideValue,jdbcType=VARCHAR},
      refraction_index = #{refractionIndex,jdbcType=VARCHAR},
      residual_solvent = #{residualSolvent,jdbcType=VARCHAR},
      filling_time = #{fillingTime,jdbcType=VARCHAR},
      line_height = #{lineHeight,jdbcType=DECIMAL},
      seal_status = #{sealStatus,jdbcType=VARCHAR},
      auth_code = #{authCode,jdbcType=VARCHAR},
      org_id = #{orgId,jdbcType=INTEGER},
      history_status = #{historyStatus,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>

<select id="getFoodbasicInfoByHouseIdAndWarehouseId" resultMap="BaseResultMap">
    SELECT
        sf.id,
        sf.record_unite,
        sf.filling_time,
        sf.keep_unite,
        sf.price,
        sf.storage_location,
        sf.keep_method,
        sf.disperse_capacity,
        sf.height,
        sf.pack_num,
        sf.pack_average_weight,
        sf.keeper_ids,
        sf.auth_code,
        sf.grow_year,
        sf.place_of_origin,
        <!--  #bs.storehouse_id,-->
        bs.storehouse_code storehouseCode,
        bs.storehouse_type house_type,
        bs.design_capacity design_house_capacity,
        bs.length,
        bs.width,
        bs.storeHouse_name storehouseName,
        bw.warehouse_name wareHouseName,
        <!--bs.depot_name keep_unite,-->
        bw.warehouse_code warehouseCode,
        <!--#bw.warehouse_name,-->
       <!-- #bw.warehouse_id,-->
        temp_sqk.water,
        temp_sqk.impurity,
        temp_sqk.badpart unsound,
        temp_sqk.capacity weight,
        temp_sqk. LEVEL,
        temp_sqk.input_time input_year,
        temp_sqk.gluten_water_count,
        temp_sqk.eat_score,
        temp_sqk.fat_index,
        temp_fcbgz.hwxz quality,
        temp_fcbgz.pz sub_type,
        temp_fcbgz.mxpz sub_type_detailed,
        temp_fcbgz.kcsl number,
        temp_fcbgz.kcsl * 0.001  stand_number,
        temp_fcbgz.hwcd,
        temp_fcbgz.scnf
      FROM
        storage_foodbasicinfo sf
      LEFT JOIN basic_warehouse bw ON bw.storehouse_id = sf.house_id
      AND sf.warehouse_id = bw.warehouse_id
      LEFT JOIN (
        SELECT
            *
        FROM
            storage_qualitycheck sqk
        WHERE 1=1 
        <if test="houseId != null">
        AND sqk.house_id = #{houseId}
        </if>
        <if test="warehouseId != null">
        AND sqk.warehouse_id = #{warehouseId}
        </if>
        AND sqk.type = 1
        AND sqk.history_status = 0
        ORDER BY
            id DESC
        LIMIT 1
      ) temp_sqk ON sf.house_id = temp_sqk.house_id
      AND sf.warehouse_id = temp_sqk.warehouse_id
      LEFT JOIN basic_storehouse bs ON bs.storehouse_id = sf.house_id
      LEFT JOIN (
        SELECT
            *
        FROM
            lsreport_ts.data_kcgl_fcbgz_default fcbgz
        WHERE 1=1 
        <if test="houseId != null">
        AND fcbgz.ch = #{houseId} 
        </if>
        <if test="warehouseId != null">
        AND fcbgz.hwh = #{warehouseId} 
        </if>
        ORDER BY
            rq DESC
        LIMIT 1
      ) temp_fcbgz ON sf.house_id = temp_fcbgz.ch
      AND sf.warehouse_id = temp_fcbgz.hwh
      WHERE 1=1 
      <if test="houseId != null">
      AND sf.house_id = #{houseId} 
      </if>
      <if test="warehouseId != null">
      AND sf.warehouse_id = #{warehouseId} 
      </if>
      AND sf.warehouse_id
      AND sf.history_status = 0
      ORDER BY
        sf.id DESC
      LIMIT 1

</select>


<sql id="ExtBase_Column_List">
     sfo.id, sfo.house_id, sfo.warehouse_id, sfo.record_unite, sfo.keep_unite, sfo.location_num, sfo.quality, sfo.sub_type,
    sfo.sub_type_detailed, sfo.htype, sfo.number, sfo.stand_number, sfo.input_year, sfo.grow_year, sfo.keep_method,
    sfo.level, sfo.weight, sfo.impurity, sfo.water, sfo.unsound, sfo.recorder, sfo.house_type, sfo.design_house_capacity,
    sfo.valid_house_capacity, sfo.price, sfo.place_of_origin, sfo.storage_location, sfo.disperse_capacity,
    sfo.length, sfo.width, sfo.height, sfo.pack_num, sfo.pack_average_weight, sfo.keeper_ids, sfo.gluten_water_count,
    sfo.eat_score, sfo.unit_head, sfo.fat_index, sfo.peroxide_value, sfo.refraction_index, sfo.residual_solvent,
    sfo.filling_time, sfo.line_height, sfo.seal_status, sfo.auth_code, sfo.org_id, sfo.history_status
</sql>

<select id="queryByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.StorageFoodbasicinfoExample" resultMap="BaseResultMap">
    select
    <include refid="ExtBase_Column_List" />,
    bs.storeHouse_name storehouseName,bw.warehouse_name wareHouseName
    FROM storage_foodbasicinfo sfo
    LEFT JOIN basic_storehouse bs on bs.storehouse_id = sfo.house_id
    LEFT JOIN basic_warehouse bw on bw.warehouse_id = sfo.warehouse_id
   <where>
      <if test="houseId != null">
        and sfo.house_id = #{houseId}
      </if>
      <if test="warehouseId != null">
        and sfo.warehouse_id = #{warehouseId}
      </if>
     <if test="historyStatus != null">
       and sfo.history_status = #{historyStatus}
     </if>
   </where>
  order by sfo.id desc
</select>

</mapper>