<?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.steerinfo.TimedTask.lgwgt.mapper.LgWgtMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.TimedTask.lgwgt.model.LgWgt">
    <id column="SEQ" jdbcType="DECIMAL" property="seq" />
    <result column="IN_TIME" jdbcType="VARCHAR" property="inTime" />
    <result column="WGT" jdbcType="DECIMAL" property="wgt" />
    <result column="GX_NO" jdbcType="DECIMAL" property="gxNo" />
    <result column="STATUS" jdbcType="DECIMAL" property="status" />
    <result column="UP_TIME" jdbcType="VARCHAR" property="upTime" />
    <result column="GET_TIME" jdbcType="TIMESTAMP" property="getTime" />
    <result column="SMP_LOT" jdbcType="VARCHAR" property="smpLot" />
    <result column="BC" jdbcType="VARCHAR" property="bc" />
    <result column="BZ" jdbcType="VARCHAR" property="bz" />
    <result column="GG" jdbcType="VARCHAR" property="gg" />
    <result column="GZ" jdbcType="VARCHAR" property="gz" />
    <result column="LLZL" jdbcType="DECIMAL" property="llzl" />
    <result column="ST_FLAG" jdbcType="VARCHAR" property="stFlag" />
  </resultMap>
  <sql id="columns">
    SEQ, IN_TIME, WGT, GX_NO, STATUS, UP_TIME, GET_TIME, SMP_LOT, BC, BZ, GG, GZ, LLZL, 
    ST_FLAG
  </sql>
  <sql id="columns_alias">
    t.SEQ, t.IN_TIME, t.WGT, t.GX_NO, t.STATUS, t.UP_TIME, t.GET_TIME, t.SMP_LOT, t.BC, 
    t.BZ, t.GG, t.GZ, t.LLZL, t.ST_FLAG
  </sql>
  <sql id="select">
    SELECT <include refid="columns" /> FROM jgweight_user.lg_wgt
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias" /> FROM jgweight_user.lg_wgt t
  </sql>
  <sql id="where">
    <where> 
      <if test="seq != null">
        and SEQ = #{seq}
      </if>
      <if test="inTime != null and inTime != ''">
        and IN_TIME = #{inTime}
      </if>
      <if test="wgt != null">
        and WGT = #{wgt}
      </if>
      <if test="gxNo != null">
        and GX_NO = #{gxNo}
      </if>
      <if test="status != null">
        and STATUS = #{status}
      </if>
      <if test="upTime != null and upTime != ''">
        and UP_TIME = #{upTime}
      </if>
      <if test="getTime != null">
        and TO_CHAR(GET_TIME,'yyyy-MM-dd') = #{getTime}
      </if>
      <if test="smpLot != null and smpLot != ''">
        and SMP_LOT = #{smpLot}
      </if>
      <if test="bc != null and bc != ''">
        and BC = #{bc}
      </if>
      <if test="bz != null and bz != ''">
        and BZ = #{bz}
      </if>
      <if test="gg != null and gg != ''">
        and GG = #{gg}
      </if>
      <if test="gz != null and gz != ''">
        and GZ = #{gz}
      </if>
      <if test="llzl != null">
        and LLZL = #{llzl}
      </if>
      <if test="stFlag != null and stFlag != ''">
        and ST_FLAG = #{stFlag}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="seq != null">
        and SEQ = #{seq}
      </if>
      <if test="inTime != null and inTime != ''">
        and IN_TIME LIKE '%${inTime}%'
      </if>
      <if test="wgt != null">
        and WGT = #{wgt}
      </if>
      <if test="gxNo != null">
        and GX_NO = #{gxNo}
      </if>
      <if test="status != null">
        and STATUS = #{status}
      </if>
      <if test="upTime != null and upTime != ''">
        and UP_TIME LIKE '%${upTime}%'
      </if>
      <if test="getTime != null">
        and TO_CHAR(GET_TIME,'yyyy-MM-dd') = #{getTime}
      </if>
      <if test="smpLot != null and smpLot != ''">
        and SMP_LOT LIKE '%${smpLot}%'
      </if>
      <if test="bc != null and bc != ''">
        and BC LIKE '%${bc}%'
      </if>
      <if test="bz != null and bz != ''">
        and BZ LIKE '%${bz}%'
      </if>
      <if test="gg != null and gg != ''">
        and GG LIKE '%${gg}%'
      </if>
      <if test="gz != null and gz != ''">
        and GZ LIKE '%${gz}%'
      </if>
      <if test="llzl != null">
        and LLZL = #{llzl}
      </if>
      <if test="stFlag != null and stFlag != ''">
        and ST_FLAG LIKE '%${stFlag}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from jgweight_user.lg_wgt
    where SEQ = #{seq,jdbcType=DECIMAL}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from jgweight_user.lg_wgt
    where 1!=1 
      <if test="inTime != null and inTime != ''">
        or IN_TIME = #{inTime}
      </if>
      <if test="wgt != null">
        or WGT = #{wgt}
      </if>
      <if test="gxNo != null">
        or GX_NO = #{gxNo}
      </if>
      <if test="status != null">
        or STATUS = #{status}
      </if>
      <if test="upTime != null and upTime != ''">
        or UP_TIME = #{upTime}
      </if>
      <if test="getTime != null">
        or TO_CHAR(GET_TIME,'yyyy-MM-dd') = '#{getTime}'
      </if>
      <if test="smpLot != null and smpLot != ''">
        or SMP_LOT = #{smpLot}
      </if>
      <if test="bc != null and bc != ''">
        or BC = #{bc}
      </if>
      <if test="bz != null and bz != ''">
        or BZ = #{bz}
      </if>
      <if test="gg != null and gg != ''">
        or GG = #{gg}
      </if>
      <if test="gz != null and gz != ''">
        or GZ = #{gz}
      </if>
      <if test="llzl != null">
        or LLZL = #{llzl}
      </if>
      <if test="stFlag != null and stFlag != ''">
        or ST_FLAG = #{stFlag}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.TimedTask.lgwgt.model.LgWgt">
    insert into jgweight_user.lg_wgt (SEQ, IN_TIME, WGT, 
      GX_NO, STATUS, UP_TIME, 
      GET_TIME, SMP_LOT, BC, 
      BZ, GG, GZ, LLZL, 
      ST_FLAG)
    values (#{seq,jdbcType=DECIMAL}, #{inTime,jdbcType=VARCHAR}, #{wgt,jdbcType=DECIMAL}, 
      #{gxNo,jdbcType=DECIMAL}, #{status,jdbcType=DECIMAL}, #{upTime,jdbcType=VARCHAR}, 
      #{getTime,jdbcType=TIMESTAMP}, #{smpLot,jdbcType=VARCHAR}, #{bc,jdbcType=VARCHAR}, 
      #{bz,jdbcType=VARCHAR}, #{gg,jdbcType=VARCHAR}, #{gz,jdbcType=VARCHAR}, #{llzl,jdbcType=DECIMAL}, 
      #{stFlag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.TimedTask.lgwgt.model.LgWgt">
    insert into jgweight_user.lg_wgt
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="seq != null">
        SEQ,
      </if>
      <if test="inTime != null">
        IN_TIME,
      </if>
      <if test="wgt != null">
        WGT,
      </if>
      <if test="gxNo != null">
        GX_NO,
      </if>
      <if test="status != null">
        STATUS,
      </if>
      <if test="upTime != null">
        UP_TIME,
      </if>
      <if test="getTime != null">
        GET_TIME,
      </if>
      <if test="smpLot != null">
        SMP_LOT,
      </if>
      <if test="bc != null">
        BC,
      </if>
      <if test="bz != null">
        BZ,
      </if>
      <if test="gg != null">
        GG,
      </if>
      <if test="gz != null">
        GZ,
      </if>
      <if test="llzl != null">
        LLZL,
      </if>
      <if test="stFlag != null">
        ST_FLAG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="seq != null">
        #{seq,jdbcType=DECIMAL},
      </if>
      <if test="inTime != null">
        #{inTime,jdbcType=VARCHAR},
      </if>
      <if test="wgt != null">
        #{wgt,jdbcType=DECIMAL},
      </if>
      <if test="gxNo != null">
        #{gxNo,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        #{status,jdbcType=DECIMAL},
      </if>
      <if test="upTime != null">
        #{upTime,jdbcType=VARCHAR},
      </if>
      <if test="getTime != null">
        #{getTime,jdbcType=TIMESTAMP},
      </if>
      <if test="smpLot != null">
        #{smpLot,jdbcType=VARCHAR},
      </if>
      <if test="bc != null">
        #{bc,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        #{bz,jdbcType=VARCHAR},
      </if>
      <if test="gg != null">
        #{gg,jdbcType=VARCHAR},
      </if>
      <if test="gz != null">
        #{gz,jdbcType=VARCHAR},
      </if>
      <if test="llzl != null">
        #{llzl,jdbcType=DECIMAL},
      </if>
      <if test="stFlag != null">
        #{stFlag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.TimedTask.lgwgt.model.LgWgt">
    update jgweight_user.lg_wgt
    set IN_TIME = #{inTime,jdbcType=VARCHAR},
      WGT = #{wgt,jdbcType=DECIMAL},
      GX_NO = #{gxNo,jdbcType=DECIMAL},
      STATUS = #{status,jdbcType=DECIMAL},
      UP_TIME = #{upTime,jdbcType=VARCHAR},
      GET_TIME = #{getTime,jdbcType=TIMESTAMP},
      SMP_LOT = #{smpLot,jdbcType=VARCHAR},
      BC = #{bc,jdbcType=VARCHAR},
      BZ = #{bz,jdbcType=VARCHAR},
      GG = #{gg,jdbcType=VARCHAR},
      GZ = #{gz,jdbcType=VARCHAR},
      LLZL = #{llzl,jdbcType=DECIMAL},
      ST_FLAG = #{stFlag,jdbcType=VARCHAR}
    where SEQ = #{seq,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.TimedTask.lgwgt.model.LgWgt">
    update jgweight_user.lg_wgt
    <set>
      <if test="inTime != null">
        IN_TIME = #{inTime,jdbcType=VARCHAR},
      </if>
      <if test="wgt != null">
        WGT = #{wgt,jdbcType=DECIMAL},
      </if>
      <if test="gxNo != null">
        GX_NO = #{gxNo,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        STATUS = #{status,jdbcType=DECIMAL},
      </if>
      <if test="upTime != null">
        UP_TIME = #{upTime,jdbcType=VARCHAR},
      </if>
      <if test="getTime != null">
        GET_TIME = #{getTime,jdbcType=TIMESTAMP},
      </if>
      <if test="smpLot != null">
        SMP_LOT = #{smpLot,jdbcType=VARCHAR},
      </if>
      <if test="bc != null">
        BC = #{bc,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        BZ = #{bz,jdbcType=VARCHAR},
      </if>
      <if test="gg != null">
        GG = #{gg,jdbcType=VARCHAR},
      </if>
      <if test="gz != null">
        GZ = #{gz,jdbcType=VARCHAR},
      </if>
      <if test="llzl != null">
        LLZL = #{llzl,jdbcType=DECIMAL},
      </if>
      <if test="stFlag != null">
        ST_FLAG = #{stFlag,jdbcType=VARCHAR},
      </if>
    </set>
    where SEQ = #{seq,jdbcType=DECIMAL}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <include refid="select" />
    where SEQ = #{seq,jdbcType=DECIMAL}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select" />
    <include refid="where" />
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select" />
    <include refid="whereLike" />
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into jgweight_user.lg_wgt 
      (SEQ, 
      IN_TIME, WGT, GX_NO, 
      STATUS, UP_TIME, GET_TIME, 
      SMP_LOT, BC, BZ, 
      GG, GZ, LLZL, 
      ST_FLAG)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.seq,jdbcType=DECIMAL}, 
      #{item.inTime,jdbcType=VARCHAR}, #{item.wgt,jdbcType=DECIMAL}, #{item.gxNo,jdbcType=DECIMAL}, 
      #{item.status,jdbcType=DECIMAL}, #{item.upTime,jdbcType=VARCHAR}, #{item.getTime,jdbcType=TIMESTAMP}, 
      #{item.smpLot,jdbcType=VARCHAR}, #{item.bc,jdbcType=VARCHAR}, #{item.bz,jdbcType=VARCHAR}, 
      #{item.gg,jdbcType=VARCHAR}, #{item.gz,jdbcType=VARCHAR}, #{item.llzl,jdbcType=DECIMAL}, 
      #{item.stFlag,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update jgweight_user.lg_wgt
     set
       SEQ=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.seq,jdbcType=DECIMAL}
       </foreach>
       ,IN_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.inTime,jdbcType=VARCHAR}
       </foreach>
       ,WGT=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.wgt,jdbcType=DECIMAL}
       </foreach>
       ,GX_NO=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.gxNo,jdbcType=DECIMAL}
       </foreach>
       ,STATUS=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
       </foreach>
       ,UP_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.upTime,jdbcType=VARCHAR}
       </foreach>
       ,GET_TIME=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.getTime,jdbcType=TIMESTAMP}
       </foreach>
       ,SMP_LOT=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.smpLot,jdbcType=VARCHAR}
       </foreach>
       ,BC=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.bc,jdbcType=VARCHAR}
       </foreach>
       ,BZ=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.bz,jdbcType=VARCHAR}
       </foreach>
       ,GG=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.gg,jdbcType=VARCHAR}
       </foreach>
       ,GZ=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.gz,jdbcType=VARCHAR}
       </foreach>
       ,LLZL=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.llzl,jdbcType=DECIMAL}
       </foreach>
       ,ST_FLAG=
       <foreach close="end" collection="list" index="index" item="item" open="case SEQ" separator=" ">
          when #{item.seq,jdbcType=DECIMAL} then #{item.stFlag,jdbcType=VARCHAR}
       </foreach>
     where SEQ in 
     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
    #{item.seq,jdbcType=DECIMAL}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from jgweight_user.lg_wgt
    where SEQ in 
    <foreach close=")" collection="list" item="id" open="(" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->

  <!--获取最大的ID+1，用作主键-->
  <select id="queryMaxId" parameterType="java.lang.String" resultType="java.lang.String">
    SELECT NVL(MAX(SEQ),0)+1   FROM jgweight_user.lg_wgt
  </select>
</mapper>