2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?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.res.dao.Res_ProblemFeedbackMapper">
    <resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        <id column="OBJECTID" property="objectid" jdbcType="INTEGER"/>
        <result column="RESOURCEID" property="resourceid" jdbcType="INTEGER"/>
        <result column="ADDTIME" property="addtime" jdbcType="TIMESTAMP"/>
        <result column="REMARK" property="remark" jdbcType="VARCHAR"/>
        <result column="CREATEUSERID" property="createuserid" jdbcType="INTEGER"/>
        <result column="FEEDBACKTYPE" property="feedbacktype" jdbcType="VARCHAR"/>
        <result column="FEEDBACKSTATUS" property="feedbackstatus" jdbcType="VARCHAR"/>
        <result column="SERVERSTATUS" property="serverstatus" jdbcType="TINYINT"/>
    </resultMap>
    <sql id="Base_Column_List">
        OBJECTID
        , RESOURCEID, ADDTIME, REMARK, CREATEUSERID, FEEDBACKTYPE, FEEDBACKSTATUS,
    SERVERSTATUS
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from RES_PROBLEMFEEDBACK
        where OBJECTID = #{objectid,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete
        from RES_PROBLEMFEEDBACK
        where OBJECTID = #{objectid,jdbcType=INTEGER}
    </delete>
    <insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        insert into RES_PROBLEMFEEDBACK (OBJECTID, RESOURCEID, ADDTIME,
                                         REMARK, CREATEUSERID, FEEDBACKTYPE,
                                         FEEDBACKSTATUS, SERVERSTATUS)
        values (#{objectid,jdbcType=INTEGER}, #{resourceid,jdbcType=INTEGER}, #{addtime,jdbcType=TIMESTAMP},
                #{remark,jdbcType=VARCHAR}, #{createuserid,jdbcType=INTEGER}, #{feedbacktype,jdbcType=VARCHAR},
                #{feedbackstatus,jdbcType=VARCHAR}, #{serverstatus,jdbcType=TINYINT})
    </insert>
    <insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        insert into RES_PROBLEMFEEDBACK
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objectid != null">
                OBJECTID,
            </if>
            <if test="resourceid != null">
                RESOURCEID,
            </if>
            <if test="addtime != null">
                ADDTIME,
            </if>
            <if test="remark != null">
                REMARK,
            </if>
            <if test="createuserid != null">
                CREATEUSERID,
            </if>
            <if test="feedbacktype != null">
                FEEDBACKTYPE,
            </if>
            <if test="feedbackstatus != null">
                FEEDBACKSTATUS,
            </if>
            <if test="serverstatus != null">
                SERVERSTATUS,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="objectid != null">
                #{objectid,jdbcType=INTEGER},
            </if>
            <if test="resourceid != null">
                #{resourceid,jdbcType=INTEGER},
            </if>
            <if test="addtime != null">
                #{addtime,jdbcType=TIMESTAMP},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="createuserid != null">
                #{createuserid,jdbcType=INTEGER},
            </if>
            <if test="feedbacktype != null">
                #{feedbacktype,jdbcType=VARCHAR},
            </if>
            <if test="feedbackstatus != null">
                #{feedbackstatus,jdbcType=VARCHAR},
            </if>
            <if test="serverstatus != null">
                #{serverstatus,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective"
            parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        update RES_PROBLEMFEEDBACK
        <set>
            <if test="resourceid != null">
                RESOURCEID = #{resourceid,jdbcType=INTEGER},
            </if>
            <if test="addtime != null">
                ADDTIME = #{addtime,jdbcType=TIMESTAMP},
            </if>
            <if test="remark != null">
                REMARK = #{remark,jdbcType=VARCHAR},
            </if>
            <if test="createuserid != null">
                CREATEUSERID = #{createuserid,jdbcType=INTEGER},
            </if>
            <if test="feedbacktype != null">
                FEEDBACKTYPE = #{feedbacktype,jdbcType=VARCHAR},
            </if>
            <if test="feedbackstatus != null">
                FEEDBACKSTATUS = #{feedbackstatus,jdbcType=VARCHAR},
            </if>
            <if test="serverstatus != null">
                SERVERSTATUS = #{serverstatus,jdbcType=TINYINT},
            </if>
        </set>
        where OBJECTID = #{objectid,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        update RES_PROBLEMFEEDBACK
        set RESOURCEID     = #{resourceid,jdbcType=INTEGER},
            ADDTIME        = #{addtime,jdbcType=TIMESTAMP},
            REMARK         = #{remark,jdbcType=VARCHAR},
            CREATEUSERID   = #{createuserid,jdbcType=INTEGER},
            FEEDBACKTYPE   = #{feedbacktype,jdbcType=VARCHAR},
            FEEDBACKSTATUS = #{feedbackstatus,jdbcType=VARCHAR},
            SERVERSTATUS   = #{serverstatus,jdbcType=TINYINT}
        where OBJECTID = #{objectid,jdbcType=INTEGER}
    </update>
 
    <select id="selectByResourceid" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select *
        from RES_PROBLEMFEEDBACK
        where RESOURCEID = #{resourceid}
        order by ADDTIME desc
    </select>
 
    <select id="checkShowNormalBtn" resultMap="BaseResultMap">
 
        WITH tab as(
        select row_number() over(order by ADDTIME desc) rn,
        a.* from RES_PROBLEMFEEDBACK a
        <where>
            <if test="resourceid != null">
                and RESOURCEID = #{resourceid}
            </if>
        </where>
        )
 
        SELECT * from tab WHERE rn = 1
    </select>
 
    <select id="selectResProblemfeedback" parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback"
            resultType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        select a.*,b.title from RES_PROBLEMFEEDBACK a left join RES_MAININFO b on a.RESOURCEID = b.RESOURCEID
        <where>
            b.title is not null
            <if test="title!=null and title != '' ">
                and (b.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
            </if>
            <if test="feedbackstatus != null and feedbackstatus != ''">
                and a.feedbackstatus = #{feedbackstatus}
            </if>
            <if test="feedbacktype != null and feedbacktype != ''">
                and a.feedbacktype = #{feedbacktype}
            </if>
            <if test="addtimeBeg != null and addtimeBeg != ''">
                <![CDATA[ and a.addtime >= to_timestamp(#{addtimeBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
            <if test="addtimeEnd != null and addtimeEnd != '' ">
                <![CDATA[ and a.addtime <= to_timestamp(#{addtimeEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
            </if>
            <if test="existpermission !=null">
                and b.CREATEUSERID=#{existpermission}
            </if>
            <if test="serverstatus != null">
                and a.SERVERSTATUS = #{serverstatus}
            </if>
        </where>
        order by a.addtime desc
    </select>
 
    <select id="selectTopByResourceid" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        WITH tab as (
            select row_number() over(order by ADDTIME desc) rn, a.*
            from RES_PROBLEMFEEDBACK a
            where a.RESOURCEID = #{resourceid,jdbcType=INTEGER}
        )
        SELECT *
        from tab
        where rn = 1
 
    </select>
 
    <select id="getlatestalarm" resultType="map">
        Select d.RESOURCEID,d.TIME ,H.TITLE,'异常' as SERVERSTATUS from (SELECT a.RESOURCEID, MAX(a.ADDTIME) as time from
        RES_PROBLEMFEEDBACK a where a.SERVERSTATUS=1 group by a.RESOURCEID ) d INNER join RES_MAININFO H ON
        H.RESOURCEID=D.RESOURCEID and H.RESOURCESTATUS=1 ORDER BY D.time desc
    </select>
 
    <update id="updateByResourceId" parameterType="com.landtool.lanbase.modules.res.entity.Res_ProblemFeedback">
        update RES_PROBLEMFEEDBACK
        set
        ADDTIME = #{addtime,jdbcType=TIMESTAMP}
        <if test="serverstatus!=null and serverstatus!=''">
            ,SERVERSTATUS=#{serverstatus}
        </if>
        where OBJECTID = ( select tmp.* from (select b.*,row_number() over() as rownumber from (select OBJECTID from RES_PROBLEMFEEDBACK where RESOURCEID=#{resourceid,jdbcType=INTEGER} order by ADDTIME desc) b) tmp where rownumber=1)
    </update>
</mapper>