|
|
<?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.shxy.i2.dao.Data_YspDao">
|
|
|
<resultMap id="BaseResultMap" type="com.shxy.i2.entity.Data_Ysp">
|
|
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
|
|
<result column="maxid" jdbcType="BIGINT" property="maxid"/>
|
|
|
<result column="minid" jdbcType="BIGINT" property="minid"/>
|
|
|
<result column="eqmid" jdbcType="INTEGER" property="eqmid"/>
|
|
|
<result column="acquisitionTime" jdbcType="TIMESTAMP" property="acquisitiontime"/>
|
|
|
<result column="H2" jdbcType="REAL" property="h2"/>
|
|
|
<result column="CH4" jdbcType="REAL" property="ch4"/>
|
|
|
<result column="C2H6" jdbcType="REAL" property="c2h6"/>
|
|
|
<result column="C2H4" jdbcType="REAL" property="c2h4"/>
|
|
|
<result column="C2H2" jdbcType="REAL" property="c2h2"/>
|
|
|
<result column="CO" jdbcType="REAL" property="co"/>
|
|
|
<result column="CO2" jdbcType="REAL" property="co2"/>
|
|
|
<result column="O2" jdbcType="REAL" property="o2"/>
|
|
|
<result column="N2" jdbcType="REAL" property="n2"/>
|
|
|
<result column="TotalHydrocarbon" jdbcType="REAL" property="totalhydrocarbon"/>
|
|
|
<result column="isupload" jdbcType="INTEGER" property="isupload"/>
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, eqmid, acquisitionTime, H2, CH4, C2H6, C2H4, C2H2, CO, CO2, O2, N2, TotalHydrocarbon,
|
|
|
isupload, create_time, update_time
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
<select id="selectMaxId" resultMap="BaseResultMap">
|
|
|
SELECT MAX( id ) AS maxid FROM data_ysp
|
|
|
</select>
|
|
|
|
|
|
<select id="selectNowId" resultMap="BaseResultMap">
|
|
|
SELECT MAX( id ) AS maxid,MIN( id ) AS minid FROM data_ysp where acquisitionTime >= #{date}
|
|
|
</select>
|
|
|
|
|
|
<!--//每组只查最大的-->
|
|
|
<select id="selectUploadById" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
t1.id, t1.eqmid, t1.acquisitionTime, t1.H2, t1.CH4, t1.C2H6, t1.C2H4, t1.C2H2,t1.CO, t1.CO2, t1.O2, t1.N2,
|
|
|
t1.TotalHydrocarbon,t1.isupload, t1.create_time, t1.update_time
|
|
|
FROM
|
|
|
data_ysp t1 where t1.id <![CDATA[>]]> #{maxid} limit 10000
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectUpload" resultMap="BaseResultMap">
|
|
|
<!-- select-->
|
|
|
<!-- <include refid="Base_Column_List"/>-->
|
|
|
<!-- from data_ysp-->
|
|
|
<!-- where isupload is null or isupload = #{isupload} order by id desc limit 1-->
|
|
|
|
|
|
SELECT
|
|
|
t1.id, t1.eqmid, t1.acquisitionTime, t1.H2, t1.CH4, t1.C2H6, t1.C2H4, t1.C2H2,t1.CO, t1.CO2, t1.O2, t1.N2,
|
|
|
t1.TotalHydrocarbon,
|
|
|
t1.isupload, t1.create_time, t1.update_time
|
|
|
FROM
|
|
|
data_ysp t1
|
|
|
INNER JOIN ( SELECT MAX( id ) AS id FROM data_ysp where isupload is null or isupload = #{isupload} GROUP BY
|
|
|
eqmid ) t2 ON t1.id = t2.id
|
|
|
</select>
|
|
|
|
|
|
<update id="updateByPrimaryKey" parameterType="com.shxy.i2.entity.Data_Ysp">
|
|
|
update data_ysp
|
|
|
<set>
|
|
|
<if test="isupload != null">
|
|
|
isupload = #{isupload,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null">
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
</set>
|
|
|
where
|
|
|
id <![CDATA[<=]]> #{maxid}
|
|
|
<if test="idlist != null and idlist.size > 0">
|
|
|
and id not in
|
|
|
<foreach collection="idlist" item="id" index="index" separator="," open="(" close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
|
|
</update>
|
|
|
|
|
|
<update id="updateList">
|
|
|
update data_ysp
|
|
|
<set>
|
|
|
<if test="isupload != null">
|
|
|
isupload = #{isupload,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null">
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
</set>
|
|
|
where
|
|
|
id in
|
|
|
<foreach collection="idlist" item="id" index="index" separator="," open="(" close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
|
|
|
<update id="updateDataList">
|
|
|
update data_ysp
|
|
|
<set>
|
|
|
<if test="isupload != null">
|
|
|
isupload = #{isupload,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null">
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
</set>
|
|
|
where isupload is null
|
|
|
<if test="idlist != null and idlist.size > 0">
|
|
|
and (
|
|
|
<foreach collection="idlist" item="item" index="index" separator="or">
|
|
|
(
|
|
|
<if test="item.eqmid != null">
|
|
|
eqmid = #{item.eqmid}
|
|
|
</if>
|
|
|
<if test="item.maxid != null">
|
|
|
and id <![CDATA[<=]]> #{item.maxid}
|
|
|
</if>
|
|
|
)
|
|
|
</foreach>
|
|
|
)
|
|
|
</if>
|
|
|
|
|
|
</update>
|
|
|
<update id="updateDataList2">
|
|
|
update data_ysp
|
|
|
<set>
|
|
|
<if test="isupload != null">
|
|
|
isupload = #{isupload,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null">
|
|
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
</set>
|
|
|
where isupload is null
|
|
|
and id <![CDATA[<=]]> #{maxid}
|
|
|
<if test="idlist != null and idlist.size > 0">
|
|
|
and eqmid in
|
|
|
<foreach collection="idlist" item="id" index="index" separator="," open="(" close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteData" >
|
|
|
delete
|
|
|
from data_ysp
|
|
|
where acquisitionTime <![CDATA[<]]> #{time}
|
|
|
</delete>
|
|
|
|
|
|
</mapper> |