You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.7 KiB
XML

2 years ago
<?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_Dlq_JbfdDao">
<resultMap id="BaseResultMap" type="com.shxy.i2.entity.Data_Dlq_Jbfd">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="eqmid" jdbcType="INTEGER" property="eqmid"/>
<result column="acquisitionTime" jdbcType="TIMESTAMP" property="acquisitiontime"/>
<result column="phase" jdbcType="VARCHAR" property="phase"/>
<result column="dischargeCapacity" jdbcType="REAL" property="dischargecapacity"/>
<result column="dischargePosition" jdbcType="REAL" property="dischargeposition"/>
<result column="pulseCount" jdbcType="REAL" property="pulsecount"/>
<result column="isupload" jdbcType="INTEGER" property="isupload"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="dischargeWaveform" jdbcType="LONGVARBINARY" property="dischargewaveform"/>
</resultMap>
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, phase, dischargeCapacity, dischargePosition, pulseCount, dischargeWaveform,
isupload, create_time, update_time
</sql>
<select id="selectUpload" resultMap="BaseResultMap">
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->
<!-- from data_dlq_jbfd-->
<!-- where isupload is null or isupload = #{isupload}-->
SELECT
t1.id, t1.eqmid, t1.acquisitionTime,t1.phase, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount,
t1.isupload,
t1.dischargeWaveform,
t1.create_time, t1.update_time
FROM
data_dlq_jbfd t1
INNER JOIN ( SELECT MAX( id ) AS id FROM data_dlq_jbfd 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_Dlq_Jbfd">
update data_dlq_jbfd
<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_dlq_jbfd
<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_dlq_jbfd
<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_dlq_jbfd
<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>
</mapper>