<?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.ems.tsubmitted.mapper.TSubmittedMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.tsubmitted.model.TSubmitted">
    <id column="CONSTRUID" jdbcType="VARCHAR" property="construid" />
    <result column="DEVICENAME" jdbcType="VARCHAR" property="devicename" />
    <result column="EQUIPMENT" jdbcType="VARCHAR" property="equipment" />
    <result column="CONSTRUCTIONUNITS" jdbcType="VARCHAR" property="constructionunits" />
    <result column="CONSTRUPEOPLE" jdbcType="VARCHAR" property="construpeople" />
    <result column="CONSTRUDATE" jdbcType="VARCHAR" property="construdate" />
    <result column="CONSTRUCONTENT" jdbcType="VARCHAR" property="construcontent" />
    <result column="CONSTRUFILE" jdbcType="VARCHAR" property="construfile" />
    <result column="SIGNTIME" jdbcType="VARCHAR" property="signtime" />
    <result column="BZ" jdbcType="VARCHAR" property="bz" />
    <result column="IMAGEURL" jdbcType="VARCHAR" property="imageurl" />
    <result column="IMAGENAME" jdbcType="VARCHAR" property="imagename" />
    <result column="MAXID" jdbcType="DECIMAL" property="maxid" />
    <result column="DECLAREID" jdbcType="VARCHAR" property="declareid" />
    <result column="STATE" jdbcType="VARCHAR" property="state" />
  </resultMap>
  <sql id="columns">
    CONSTRUID, DEVICENAME, EQUIPMENT, CONSTRUCTIONUNITS, CONSTRUPEOPLE, CONSTRUDATE, 
    CONSTRUCONTENT, CONSTRUFILE, SIGNTIME, BZ, IMAGEURL, IMAGENAME, MAXID, DECLAREID,STATE
  </sql>
  <sql id="columns_alias">
    t.CONSTRUID, t.DEVICENAME, t.EQUIPMENT, t.CONSTRUCTIONUNITS, t.CONSTRUPEOPLE, t.CONSTRUDATE, 
    t.CONSTRUCONTENT, t.CONSTRUFILE, t.SIGNTIME, t.BZ, t.IMAGEURL, t.IMAGENAME, t.MAXID,
    t.DECLAREID,t.state
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM T_SUBMITTED
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM T_SUBMITTED t
  </sql>
  <sql id="where">
    <where> 
      <if test="construid != null and construid != ''">
        and CONSTRUID = #{construid}
      </if>
      <if test="devicename != null and devicename != ''">
        and DEVICENAME = #{devicename}
      </if>
      <if test="equipment != null and equipment != ''">
        and EQUIPMENT = #{equipment}
      </if>
      <if test="constructionunits != null and constructionunits != ''">
        and CONSTRUCTIONUNITS = #{constructionunits}
      </if>
      <if test="construpeople != null and construpeople != ''">
        and CONSTRUPEOPLE = #{construpeople}
      </if>
      <if test="construdate != null and construdate != ''">
        and CONSTRUDATE = #{construdate}
      </if>
      <if test="construcontent != null and construcontent != ''">
        and CONSTRUCONTENT = #{construcontent}
      </if>
      <if test="construfile != null and construfile != ''">
        and CONSTRUFILE = #{construfile}
      </if>
      <if test="signtime != null and signtime != ''">
        and SIGNTIME = #{signtime}
      </if>
      <if test="bz != null and bz != ''">
        and BZ = #{bz}
      </if>
      <if test="imageurl != null and imageurl != ''">
        and IMAGEURL = #{imageurl}
      </if>
      <if test="imagename != null and imagename != ''">
        and IMAGENAME = #{imagename}
      </if>
      <if test="maxid != null">
        and MAXID = #{maxid}
      </if>
      <if test="declareid != null and declareid != ''">
        and DECLAREID = #{declareid}
      </if>
      <if test="state != null and state != ''">
        and STATE = #{state}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="construid != null and construid != ''">
        and CONSTRUID LIKE '%${construid}%'
      </if>
      <if test="devicename != null and devicename != ''">
        and DEVICENAME LIKE '%${devicename}%'
      </if>
      <if test="equipment != null and equipment != ''">
        and EQUIPMENT LIKE '%${equipment}%'
      </if>
      <if test="constructionunits != null and constructionunits != ''">
        and CONSTRUCTIONUNITS LIKE '%${constructionunits}%'
      </if>
      <if test="construpeople != null and construpeople != ''">
        and CONSTRUPEOPLE LIKE '%${construpeople}%'
      </if>
      <if test="construdate != null and construdate != ''">
        and CONSTRUDATE LIKE '%${construdate}%'
      </if>
      <if test="construcontent != null and construcontent != ''">
        and CONSTRUCONTENT LIKE '%${construcontent}%'
      </if>
      <if test="construfile != null and construfile != ''">
        and CONSTRUFILE LIKE '%${construfile}%'
      </if>
      <if test="signtime != null and signtime != ''">
        and SIGNTIME LIKE '%${signtime}%'
      </if>
      <if test="bz != null and bz != ''">
        and BZ LIKE '%${bz}%'
      </if>
      <if test="imageurl != null and imageurl != ''">
        and IMAGEURL LIKE '%${imageurl}%'
      </if>
      <if test="imagename != null and imagename != ''">
        and IMAGENAME LIKE '%${imagename}%'
      </if>
      <if test="maxid != null">
        and MAXID = #{maxid}
      </if>
      <if test="declareid != null and declareid != ''">
        and DECLAREID LIKE '%${declareid}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from T_SUBMITTED
    where CONSTRUID = #{construid,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from T_SUBMITTED
    where 1!=1 
      <if test="devicename != null and devicename != ''">
        or DEVICENAME = #{devicename}
      </if>
      <if test="equipment != null and equipment != ''">
        or EQUIPMENT = #{equipment}
      </if>
      <if test="constructionunits != null and constructionunits != ''">
        or CONSTRUCTIONUNITS = #{constructionunits}
      </if>
      <if test="construpeople != null and construpeople != ''">
        or CONSTRUPEOPLE = #{construpeople}
      </if>
      <if test="construdate != null and construdate != ''">
        or CONSTRUDATE = #{construdate}
      </if>
      <if test="construcontent != null and construcontent != ''">
        or CONSTRUCONTENT = #{construcontent}
      </if>
      <if test="construfile != null and construfile != ''">
        or CONSTRUFILE = #{construfile}
      </if>
      <if test="signtime != null and signtime != ''">
        or SIGNTIME = #{signtime}
      </if>
      <if test="bz != null and bz != ''">
        or BZ = #{bz}
      </if>
      <if test="imageurl != null and imageurl != ''">
        or IMAGEURL = #{imageurl}
      </if>
      <if test="imagename != null and imagename != ''">
        or IMAGENAME = #{imagename}
      </if>
      <if test="maxid != null">
        or MAXID = #{maxid}
      </if>
      <if test="declareid != null and declareid != ''">
        or DECLAREID = #{declareid}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.tsubmitted.model.TSubmitted">
    insert into T_SUBMITTED (CONSTRUID, DEVICENAME, EQUIPMENT, 
      CONSTRUCTIONUNITS, CONSTRUPEOPLE, CONSTRUDATE, 
      CONSTRUCONTENT, CONSTRUFILE, SIGNTIME,
      BZ, IMAGEURL, IMAGENAME, 
      MAXID, DECLAREID,STATE)
    values (#{construid,jdbcType=VARCHAR}, #{devicename,jdbcType=VARCHAR}, #{equipment,jdbcType=VARCHAR}, 
      #{constructionunits,jdbcType=VARCHAR}, #{construpeople,jdbcType=VARCHAR}, #{construdate,jdbcType=VARCHAR}, 
      #{construcontent,jdbcType=VARCHAR}, #{construfile,jdbcType=VARCHAR}, #{signtime,jdbcType=VARCHAR}, 
      #{bz,jdbcType=VARCHAR}, #{imageurl,jdbcType=VARCHAR}, #{imagename,jdbcType=VARCHAR}, 
      #{maxid,jdbcType=DECIMAL}, #{declareid,jdbcType=VARCHAR},#{state,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.tsubmitted.model.TSubmitted">
    insert into T_SUBMITTED
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="construid != null">
        CONSTRUID,
      </if>
      <if test="devicename != null">
        DEVICENAME,
      </if>
      <if test="equipment != null">
        EQUIPMENT,
      </if>
      <if test="constructionunits != null">
        CONSTRUCTIONUNITS,
      </if>
      <if test="construpeople != null">
        CONSTRUPEOPLE,
      </if>
      <if test="construdate != null">
        CONSTRUDATE,
      </if>
      <if test="construcontent != null">
        CONSTRUCONTENT,
      </if>
      <if test="construfile != null">
        CONSTRUFILE,
      </if>
      <if test="signtime != null">
        SIGNTIME,
      </if>
      <if test="bz != null">
        BZ,
      </if>
      <if test="imageurl != null">
        IMAGEURL,
      </if>
      <if test="imagename != null">
        IMAGENAME,
      </if>
      <if test="maxid != null">
        MAXID,
      </if>
      <if test="declareid != null">
        DECLAREID,
      </if>
      <if test="state != null">
        STATE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="construid != null">
        #{construid,jdbcType=VARCHAR},
      </if>
      <if test="devicename != null">
        #{devicename,jdbcType=VARCHAR},
      </if>
      <if test="equipment != null">
        #{equipment,jdbcType=VARCHAR},
      </if>
      <if test="constructionunits != null">
        #{constructionunits,jdbcType=VARCHAR},
      </if>
      <if test="construpeople != null">
        #{construpeople,jdbcType=VARCHAR},
      </if>
      <if test="construdate != null">
        #{construdate,jdbcType=VARCHAR},
      </if>
      <if test="construcontent != null">
        #{construcontent,jdbcType=VARCHAR},
      </if>
      <if test="construfile != null">
        #{construfile,jdbcType=VARCHAR},
      </if>
      <if test="signtime != null">
        #{signtime,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        #{bz,jdbcType=VARCHAR},
      </if>
      <if test="imageurl != null">
        #{imageurl,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="maxid != null">
        #{maxid,jdbcType=DECIMAL},
      </if>
      <if test="declareid != null">
        #{declareid,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        #{state,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.tsubmitted.model.TSubmitted">
    update T_SUBMITTED
    set DEVICENAME = #{devicename,jdbcType=VARCHAR},
      EQUIPMENT = #{equipment,jdbcType=VARCHAR},
      CONSTRUCTIONUNITS = #{constructionunits,jdbcType=VARCHAR},
      CONSTRUPEOPLE = #{construpeople,jdbcType=VARCHAR},
      CONSTRUDATE = #{construdate,jdbcType=VARCHAR},
      CONSTRUCONTENT = #{construcontent,jdbcType=VARCHAR},
      CONSTRUFILE = #{construfile,jdbcType=VARCHAR},
      SIGNTIME = #{signtime,jdbcType=VARCHAR},
      BZ = #{bz,jdbcType=VARCHAR},
      IMAGEURL = #{imageurl,jdbcType=VARCHAR},
      IMAGENAME = #{imagename,jdbcType=VARCHAR},
      MAXID = #{maxid,jdbcType=DECIMAL},
      DECLAREID = #{declareid,jdbcType=VARCHAR}
    where CONSTRUID = #{construid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.tsubmitted.model.TSubmitted">
    update T_SUBMITTED
    <set>
      <if test="devicename != null">
        DEVICENAME = #{devicename,jdbcType=VARCHAR},
      </if>
      <if test="equipment != null">
        EQUIPMENT = #{equipment,jdbcType=VARCHAR},
      </if>
      <if test="constructionunits != null">
        CONSTRUCTIONUNITS = #{constructionunits,jdbcType=VARCHAR},
      </if>
      <if test="construpeople != null">
        CONSTRUPEOPLE = #{construpeople,jdbcType=VARCHAR},
      </if>
      <if test="construdate != null">
        CONSTRUDATE = #{construdate,jdbcType=VARCHAR},
      </if>
      <if test="construcontent != null">
        CONSTRUCONTENT = #{construcontent,jdbcType=VARCHAR},
      </if>
      <if test="construfile != null">
        CONSTRUFILE = #{construfile,jdbcType=VARCHAR},
      </if>
      <if test="signtime != null">
        SIGNTIME = #{signtime,jdbcType=VARCHAR},
      </if>
      <if test="bz != null">
        BZ = #{bz,jdbcType=VARCHAR},
      </if>
      <if test="imageurl != null">
        IMAGEURL = #{imageurl,jdbcType=VARCHAR},
      </if>
      <if test="imagename != null">
        IMAGENAME = #{imagename,jdbcType=VARCHAR},
      </if>
      <if test="maxid != null">
        MAXID = #{maxid,jdbcType=DECIMAL},
      </if>
      <if test="declareid != null">
        DECLAREID = #{declareid,jdbcType=VARCHAR},
      </if>
    </set>
    where CONSTRUID = #{construid,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where CONSTRUID = #{construid,jdbcType=VARCHAR}
  </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 T_SUBMITTED 
      (CONSTRUID, 
      DEVICENAME, EQUIPMENT, CONSTRUCTIONUNITS, 
      CONSTRUPEOPLE, CONSTRUDATE, CONSTRUCONTENT, 
      CONSTRUFILE, SIGNTIME, BZ, 
      IMAGEURL, IMAGENAME, MAXID, 
      DECLAREID)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.construid,jdbcType=VARCHAR}, 
      #{item.devicename,jdbcType=VARCHAR}, #{item.equipment,jdbcType=VARCHAR}, #{item.constructionunits,jdbcType=VARCHAR}, 
      #{item.construpeople,jdbcType=VARCHAR}, #{item.construdate,jdbcType=VARCHAR}, #{item.construcontent,jdbcType=VARCHAR}, 
      #{item.construfile,jdbcType=VARCHAR}, #{item.signtime,jdbcType=VARCHAR}, #{item.bz,jdbcType=VARCHAR}, 
      #{item.imageurl,jdbcType=VARCHAR}, #{item.imagename,jdbcType=VARCHAR}, #{item.maxid,jdbcType=DECIMAL}, 
      #{item.declareid,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update T_SUBMITTED
     set
       CONSTRUID=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.construid,jdbcType=VARCHAR}
       </foreach>
       ,DEVICENAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.devicename,jdbcType=VARCHAR}
       </foreach>
       ,EQUIPMENT=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.equipment,jdbcType=VARCHAR}
       </foreach>
       ,CONSTRUCTIONUNITS=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.constructionunits,jdbcType=VARCHAR}
       </foreach>
       ,CONSTRUPEOPLE=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.construpeople,jdbcType=VARCHAR}
       </foreach>
       ,CONSTRUDATE=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.construdate,jdbcType=VARCHAR}
       </foreach>
       ,CONSTRUCONTENT=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.construcontent,jdbcType=VARCHAR}
       </foreach>
       ,CONSTRUFILE=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.construfile,jdbcType=VARCHAR}
       </foreach>
       ,SIGNTIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.signtime,jdbcType=VARCHAR}
       </foreach>
       ,BZ=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.bz,jdbcType=VARCHAR}
       </foreach>
       ,IMAGEURL=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.imageurl,jdbcType=VARCHAR}
       </foreach>
       ,IMAGENAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.imagename,jdbcType=VARCHAR}
       </foreach>
       ,MAXID=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.maxid,jdbcType=DECIMAL}
       </foreach>
       ,DECLAREID=
       <foreach collection="list" item="item" index="index" separator=" " open="case CONSTRUID" close="end">
          when #{item.construid,jdbcType=VARCHAR} then #{item.declareid,jdbcType=VARCHAR}
       </foreach>
     where CONSTRUID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.construid,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_SUBMITTED
    where CONSTRUID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  <select id="selectMaxId" resultType="java.lang.Integer" >
    SELECT MAX(MAXID) FROM T_SUBMITTED where SIGNTIME LIKE '%${signtime}%'
  </select>
</mapper>