1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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.landtool.lanbase.modules.log.dao.LogKettleStepcountDao">
 
    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.landtool.lanbase.modules.log.entity.LogKettleStepcount" id="logMap">
        <result property="idbatch" column="IDBATCH"/>
        <result property="channelid" column="CHANNELID"/>
        <result property="logdate" column="LOGDATE"/>
        <result property="transname" column="TRANSNAME"/>
        <result property="stepname" column="STEPNAME"/>
        <result property="stepcopy" column="STEPCOPY"/>
        <result property="linesread" column="LINESREAD"/>
        <result property="lineswritten" column="LINESWRITTEN"/>
        <result property="linesupdated" column="LINESUPDATED"/>
        <result property="linesinput" column="LINESINPUT"/>
        <result property="linesoutput" column="LINESOUTPUT"/>
        <result property="linesrejected" column="LINESREJECTED"/>
        <result property="errors" column="ERRORS"/>
        <result property="logfield" column="LOGFIELD"/>
    </resultMap>
 
    <select id="queryList" resultType="com.landtool.lanbase.modules.log.entity.LogKettleStepcount">
        select * from (
        SELECT *
        FROM(
        SELECT ROW_NUMBER() OVER(
        ORDER BY B.ID_BATCH DESC) AS rownumber,B.*
        FROM (
        SELECT * from LOG_KETTLE_STEPCOUNT
        <where>
            <if test="transname != null and transname!=''">
                AND transname LIKE ('%' || #{transname} || '%')
            </if>
            <if test="stepname != null and stepname!=''">
                AND stepname LIKE ('%' || #{stepname} || '%')
            </if>
            <if test="logdatebegin != null and logdatebegin !=''">
                <![CDATA[ AND log_date >= to_timestamp(#{logdatebegin,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
            <if test="logdatefinish != null and logdatefinish !=''">
                <![CDATA[ AND log_date <= to_timestamp(#{logdatefinish,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
        </where>
        ) B
        ) A
        WHERE rownumber > #{lowerOffset} AND  <![CDATA[ rownumber <= ${upperOffset} ]]>
        )a order by
        <choose>
            <when test="sidx != null and sidx != ''">
                ${sidx} ${order}
            </when>
            <otherwise>
                ID_BATCH DESC
            </otherwise>
        </choose>
    </select>
    <select id="queryTotal" resultType="int">
        select count(*) from LOG_KETTLE_STEPCOUNT
        <where>
            <if test="transname != null and transname!=''">
                AND transname LIKE ('%' || #{transname} || '%')
            </if>
            <if test="stepname != null and stepname!=''">
                AND stepname LIKE ('%' || #{stepname} || '%')
            </if>
            <if test="logdatebegin != null and logdatebegin !=''">
                <![CDATA[ AND log_date >= to_timestamp(#{logdatebegin,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
            <if test="logdatefinish != null and logdatefinish !=''">
                <![CDATA[ AND log_date <= to_timestamp(#{logdatefinish,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
        </where>
    </select>
 
    <select id="queryObject" resultType="com.landtool.lanbase.modules.log.entity.LogKettleStepcount">
        select * from LOG_KETTLE_STEPCOUNT where CHANNEL_ID = #{value}
    </select>
 
    <select id="queryLinesByYear" resultType="com.landtool.lanbase.modules.log.entity.LogKettleStepcountJoinYear">
        select to_char( LOG_DATE,'yyyy') as year,sum(LINES_INPUT) suminput,sum(LINES_OUTPUT) sumoutput from LOG_KETTLE_STEPCOUNT
        <where>
            <if test="logdatebegin != null and logdatebegin!=''">
                and to_char( LOG_DATE,'yyyy') >= #{logdatebegin}
            </if>
            <if test="logdatefinish != null and logdatefinish!=''">
                <![CDATA[ AND to_char( LOG_DATE,'yyyy') <= #{logdatefinish} ]]>
            </if>
            <if test="transname != null and transname!=''">
                AND transname LIKE ('%' || #{transname} || '%')
            </if>
            <if test="stepname != null and stepname!=''">
                AND stepname LIKE ('%' || #{stepname} || '%')
            </if>
        </where>
        group by to_char( LOG_DATE,'yyyy')
    </select>
</mapper>