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.

86 lines
3.4 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">
<!--MyBatis的映射文件 编写sql-->
<!--一个数据表对应一个实体类一个实体类对应一个mapper映射文件-->
<mapper namespace="com.xydl.mapper.EpaMapper">
<!-- <resultMap id="EiaResultMap" type="com.xydl.model.Eia">-->
<!-- <result column="SubDeviceID" property="subDeviceID"/>-->
<!-- <result column="sensorid" property="sensorId"/>-->
<!-- <result column="capturetime" property="captureTime"/>-->
<!-- <result column="maxtemp" property="maxTemp"/>-->
<!-- <result column="mintemp" property="minTemp"/>-->
<!-- <result column="avgtemp" property="avgTemp"/>-->
<!-- <result column="Phase" property="phase"/>-->
<!-- </resultMap>-->
<!-- <select id="getEia" resultType="com.xydl.model.Eia">-->
<!-- SELECT t2.equipmentid AS SubDeviceID, t2.sensorid,t1.capturetime,t1.maxtemp,t1.mintemp,t1.avgtemp,t2.`Phase`-->
<!-- FROM `data_eaif_h` AS t1 JOIN i2relation AS t2 ON t1.eqmid=t2.eqmid-->
<!-- WHERE t1.eqmid=394 AND t1.capturetime>'2019-12-19 04:55:31' ORDER BY t1.capturetime LIMIT 1000-->
<!-- </select>-->
<select id="getEpa" resultType="com.xydl.model.Epa">
SELECT t2.equipmentid AS SubDeviceID, t2.sensorid,t1.d_time,t1.h2ppm,t1.ch4ppm,t1.c2h6ppm,t1.c2h4ppm,t1.c2h2ppm,t1.coppm,t1.co2ppm,t1.o2ppm,t1.n2ppm,t1.totalhydrocarbon,t1.gaspress,t1.h2oppm,t2.`Phase`
FROM `data_epa_h` AS t1 JOIN i2relation AS t2 ON t1.eqmid=t2.eqmid
WHERE t1.eqmid=#{devid} AND t1.d_time>(select DISTINCT syrec.field_val2 from sync_records as syrec, sync_tables_info as sytab, data_epa_h as epa
where sytab.client_id = 10 and syrec.client_id = sytab.client_id and syrec.table_name = sytab.table_name and epa.eqmid = syrec.devid_val and epa.eqmid = #{devid})
ORDER BY t1.d_time LIMIT 1000
</select>
<select id="getData" resultType="com.xydl.model.SuperModel">
${value}
</select>
<select id="getEqmidsByTableName" resultType="java.lang.Integer">
select DISTINCT tableName.eqmid from ${tableName} as tableName
</select>
<select id="getTableNamesBySyncTable" resultType="java.lang.String">
select DISTINCT syncTableName.table_name from ${sycTableName} as syncTableName
</select>
<select id="getSqlBySyncTable" resultType="java.lang.String">
select syncTable.sql from ${syncTable} as syncTable where table_name=#{tableName}
</select>
<!--int insertEmp(Employee employee);-->
<insert id="insertEmp">
insert into employee values (#{id},#{lastName},#{email},#{gender},#{department.id})
</insert>
<update id="update">
update employee
<set>
<if test="employee.lastName!=null">
last_name=#{employee.lastName},
</if>
<if test="employee.email!=null">
email=#{employee.email},
</if>
<if test="employee.gender!=null">
gender=#{employee.gender},
</if>
<if test="employee.department!=null">
d_id=#{employee.department.id}
</if>
</set>
where id = #{id}
</update>
<!--int deleteEmpById(Integer id);-->
<delete id="deleteEmpById">
delete from employee where id=#{id}
</delete>
</mapper>