燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2024-11-29 9a8c8a90c7c01b6bc770d4be5baeff72c058468c
src/main/resources/mapper/XlsReportMapper.xml
@@ -1,6 +1,23 @@
<?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.QxshMapper">
<mapper namespace="com.yssh.mapper.XlsReportMapper">
    <select id="selectReportCount" resultType="java.lang.Integer">
        select count(*)
        from xls_report
        <where>
            1 = 1
            <if test="type != null">
                and type = #{type}
            </if>
            <if test="start != null">
                and create_time >= #{start}
            </if>
            <if test="end != null">
                and create_time &lt;= #{end}
            </if>
        </where>
    </select>
    <!-- 分页查询报告 -->
    <select id="selectReportByPage" resultType="com.yssh.entity.xls.XlsReport">
        select *
@@ -14,11 +31,18 @@
                and create_time >= #{start}
            </if>
            <if test="end != null">
                and end &lt;= #{end}
                and create_time &lt;= #{end}
            </if>
        </where>
        order by id desc
        order by create_time desc
        limit #{limit} offset #{offset}
    </select>
    <!-- 根据ID查询报告 -->
    <select id="selectById" resultType="com.yssh.entity.xls.XlsReport">
        select *
        from xls_report
        where id = #{id};
    </select>
    <!-- 报告是否存在 -->
@@ -38,28 +62,21 @@
    <!-- 查询日均值 -->
    <select id="selectDayAvg" resultType="java.lang.Double">
        select format(avg(value), 2)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>
    <!-- 查询日均值 -->
    <select id="selectDayAvg" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(round(avg(value), 2), 0)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>
    <!-- 查询累计值 -->
    <select id="selectAccumulate" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(round(avg(value), 2), 0)
        from yssh_qxsh
        where time between #{start} and #{end} and name = #{name};
    </select>
    <!-- 查询年累计值 -->
    <select id="selectYearAccumulate" resultType="java.lang.Double">
        select format(avg(value), 2)
        select ifnull(round(avg(value), 2), 0)
        from yssh_qxsh
        where time like #{time} and name = #{name};
    </select>
@@ -69,6 +86,17 @@
        select *
        from suyuan_46
        where su_yuan_id = #{id} and create_time between #{start} and #{end}
        order by time;
        order by create_time;
    </select>
    <!-- 根据时间段查询溯源 -->
    <select id="selectSuYuanByStartAndEnd" resultType="com.yssh.entity.SuYuan700">
        select *
        from suyuan_46
        where su_yuan_id = #{id} and date_format(create_time, '%Y%m%d%H') in (
            select time
            from yssh_qxsh
            where value > #{yjz} and name = #{name} and time between #{start} and #{end}
        );
    </select>
</mapper>