<?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.yssh.mapper.FeedbackMapper">
|
<resultMap id="FeedbackDetailResult" type="com.yssh.entity.FeedbackDetail">
|
<id property="id" column="id" />
|
<result property="tableName" column="table_name" />
|
<result property="locationName" column="location_name" />
|
<result property="detectionId" column="detection_id" />
|
<result property="detectionVocsName" column="detection_vocs_name" />
|
<result property="detectionValue" column="detection_value" />
|
<result property="practicalId" column="practical_id" />
|
<result property="practicalVocsName" column="practical_vocs_name" />
|
<result property="practicalValue" column="practical_value" />
|
<result property="createTime" column="create_time" />
|
</resultMap>
|
|
<sql id="feedbackDetailSql">
|
SELECT id, table_name, location_name, detection_id, detection_vocs_name, format(detection_value, 2) detection_value,
|
practical_id, practical_vocs_name, format(practical_value, 2) practical_value, create_time
|
FROM feedback
|
</sql>
|
|
<select id="selectById" parameterType="java.lang.Long" resultMap="FeedbackDetailResult">
|
<include refid="feedbackDetailSql"></include>
|
WHERE id = #{id}
|
</select>
|
|
<select id="selectSevenDayAccuracyAvg" parameterType="java.lang.Long" resultType="java.lang.Double">
|
SELECT COUNT(id)/(SELECT COUNT(id) FROM feedback
|
WHERE CONVERT(date_format(create_time, '%Y%m%d%H%'), SIGNED) >= #{beginTime}) FROM feedback
|
WHERE CONVERT(date_format(create_time, '%Y%m%d%H%'), SIGNED) >= #{beginTime}
|
AND practical_id IS NULL
|
</select>
|
|
<insert id="insert" parameterType="com.yssh.entity.FeedbackDetail" useGeneratedKeys="true" keyProperty="id">
|
INSERT INTO feedback
|
(table_name, location_name, detection_id,
|
detection_vocs_name, detection_value, practical_id,
|
practical_vocs_name, practical_value, create_time)
|
VALUES
|
(#{tableName}, #{locationName}, #{detectionId},
|
#{detectionVocsName}, #{detectionValue}, #{practicalId},
|
#{practicalVocsName}, #{practicalValue}, #{createTime})
|
</insert>
|
|
<update id="update" parameterType="com.yssh.entity.FeedbackDetail">
|
UPDATE feedback SET
|
practical_id = #{practicalId}, practical_vocs_name = #{practicalVocsName}, practical_value = #{practicalValue}
|
WHERE id = #{id}
|
</update>
|
</mapper>
|