<?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.JitMonitorMapper">
|
<select id="CountServerStatus" resultType="map" parameterType="map">
|
SELECT
|
COUNT( * ),
|
a.RESOURCESTATUS,
|
a.RESOURCECLASS
|
FROM
|
RES_MAININFO a
|
WHERE
|
1 = 1
|
GROUP BY
|
( a.RESOURCESTATUS, a.RESOURCECLASS )
|
ORDER BY
|
count( * )
|
</select>
|
|
<select id="CountServerStatusAudited" resultType="map"
|
parameterType="map">
|
SELECT
|
COUNT( * ),
|
a.RESOURCESTATUS,
|
a.RESOURCECLASS
|
FROM
|
RES_MAININFO a
|
WHERE
|
1 = 1 and a.AUDITSTATUS=1
|
GROUP BY
|
( a.RESOURCESTATUS, a.RESOURCECLASS )
|
ORDER BY
|
count( * )
|
</select>
|
|
<select id="calTop10UserForInvokingResource" resultType="map"
|
parameterType="map">
|
SELECT tmp.* from (
|
SELECT
|
row_number() over () as rownumber,
|
b.*
|
FROM
|
(
|
SELECT
|
t.USERID,
|
count( * ) AS count
|
FROM
|
RES_ACTIONRECORD t LEFT JOIN RES_MAININFO d on t.RESOURCEID=d.RESOURCEID
|
WHERE
|
d.RESOURCESTATUS=0 and d.AUDITSTATUS=2
|
<if test="actionType!=null and actionType!=''">
|
and t.ACTIONTYPE = #{actionType}
|
</if>
|
GROUP BY t.USERID ORDER BY count DESC
|
) b
|
) tmp
|
WHERE rownumber <![CDATA[<=]]> 10
|
</select>
|
|
|
<select id="calTop10SysForInvokingResource" resultType="map"
|
parameterType="map">
|
SELECT tmp.* from (
|
SELECT
|
row_number() over () as rownumber,
|
b.*
|
FROM
|
(
|
SELECT
|
t.APPID,
|
count( * ) as count
|
FROM
|
RES_ACTIONRECORD t LEFT JOIN RES_MAININFO d on t.RESOURCEID=d.RESOURCEID
|
WHERE
|
d.RESOURCESTATUS=0 and d.AUDITSTATUS=2
|
<if test="actionType!=null and actionType!=''">
|
and t.ACTIONTYPE = #{actionType}
|
</if>
|
GROUP BY t.APPID ORDER BY count DESC
|
) b
|
) tmp
|
WHERE rownumber <![CDATA[<=]]> 10
|
</select>
|
|
|
<select id="getTop10ResourceByActionType" resultType="map" parameterType="map">
|
SELECT tmp.* from (
|
SELECT
|
b.*,
|
row_number() over () as rownumber
|
FROM
|
(
|
SELECT
|
t.RESOURCEID,
|
d.TITLE,
|
count( * ) AS count
|
FROM
|
RES_ACTIONRECORD t LEFT JOIN RES_MAININFO d on t.RESOURCEID=d.RESOURCEID
|
WHERE
|
d.RESOURCESTATUS=0 and d.AUDITSTATUS=2
|
<if test="actionType!=null and actionType!=''">and t.ACTIONTYPE = #{actionType}</if>
|
GROUP BY t.RESOURCEID, d.TITLE ORDER BY count DESC
|
) b
|
) tmp
|
WHERE rownumber <![CDATA[<=]]> 10
|
</select>
|
|
|
|
<select id="getGisResNumByResStatus" resultType="map"
|
parameterType="map">
|
SELECT
|
t.RESOURCESTATUS,
|
count( * ) AS count
|
FROM
|
RES_MAININFO t
|
WHERE
|
t.AUDITSTATUS=2
|
GROUP BY
|
t.RESOURCESTATUS
|
ORDER BY
|
count DESC
|
</select>
|
|
<select id="getActiveResource" resultType="map" parameterType="map">
|
SELECT
|
a.RESOURCEID,
|
t.TITLE,
|
count(*) as count
|
FROM
|
RES_ACTIONRECORD a LEFT JOIN RES_MAININFO t on a.RESOURCEID=t.RESOURCEID
|
where 1=1
|
<if test="actionType!=null and actionType!=''">and a.ACTIONTYPE = #{actionType}</if>
|
<if test="day!=null and day!=''">AND a.ACTIONTIME > CURRENT_DATE-day </if>
|
group by a.RESOURCEID,t.TITLE
|
order by a.RESOURCEID DESC
|
</select>
|
|
|
<select id="getResourceAssignTimesCount" resultType="map" parameterType="map">
|
SELECT
|
t.ACTIONTIME as time,
|
count(*) as count
|
FROM
|
RES_ACTIONRECORD t
|
WHERE t.IP IS NOT NULL AND 1 =1
|
<if test="actionType!=null and actionType!=''">and t.ACTIONTYPE = #{actionType}</if>
|
<if test="userid!=null and userid!='' ">
|
AND t.USERID=#{userid}
|
</if>
|
<if test="appid!=null and appid!='' ">
|
AND t.APPID=#{appid}
|
</if>
|
<if test="resourceid!=null and resourceid!='' ">
|
AND t.RESOURCEID=#{resourceid}
|
</if>
|
<if test="months!=null and months!='' ">
|
AND t.ACTIONTIME> now() + interval '${month} month'
|
</if>
|
<if test="day!=null and day !=''">
|
AND t.ACTIONTIME> now() - interval '${day} day'
|
</if>
|
<if test="startdate!=null and startdate!='' and enddate!=null and enddate !=''">
|
t.ACTIONTIME BETWEEN to_timestamp( #{startdate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
AND to_timestamp( #{enddate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
</if>
|
group by t.ACTIONTIME
|
ORDER BY t.ACTIONTIME asc
|
</select>
|
|
|
|
<select id="queryResourceLog" resultType="map" parameterType="map">
|
select
|
b.RESOURCEID as resourceid,
|
b.USERID as userid,
|
b.ACTIONTIME as time,
|
b.IP as ip,
|
b.APPID as appid,
|
a.count
|
from (
|
SELECT
|
count(*) as count,
|
t.ACTIONTIME,
|
t.USERID
|
FROM
|
RES_ACTIONRECORD t
|
WHERE t.IP IS NOT NULL AND 1 =1
|
<if test="actionType!=null and actionType!=''">and t.ACTIONTYPE = #{actionType}</if>
|
<if test="userid!=null and userid!='' ">
|
AND t.USERID= #{userid}
|
</if>
|
<if test="appid!=null and appid!='' ">
|
AND t.APPID=#{appid}
|
</if>
|
<if test="resourceid!=null and resourceid!='' ">
|
AND t.RESOURCEID=#{resourceid}
|
</if>
|
<if test="months!=null and months!='' ">
|
AND t.ACTIONTIME> now() + interval '${month} month'
|
</if>
|
<if test="day!=null and day!=''">
|
AND t.ACTIONTIME> now() - interval '${day} day'
|
</if>
|
<if test="startdate!=null and startdate!='' and enddate!=null and enddate !=''">
|
t.ACTIONTIME BETWEEN to_timestamp( #{startdate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
AND to_timestamp( #{enddate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
</if>
|
GROUP BY t.ACTIONTIME,t.USERID
|
) a
|
LEFT JOIN RES_ACTIONRECORD b on a.ACTIONTIME=b.ACTIONTIME
|
ORDER BY a.ACTIONTIME desc
|
</select>
|
|
|
<resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_ActionRecord" >
|
<id column="ACTIONID" property="actionid" jdbcType="DECIMAL" />
|
<result column="RESOURCEID" property="resourceid" jdbcType="DECIMAL" />
|
<result column="USERID" property="userid" jdbcType="DECIMAL" />
|
<result column="APPID" property="appid" jdbcType="DECIMAL" />
|
<result column="ACTIONTIME" property="actiontime" jdbcType="TIMESTAMP" />
|
<result column="ACTIONTYPE" property="actiontype" jdbcType="OTHER" />
|
<result column="IP" property="ip" jdbcType="OTHER"/>
|
</resultMap>
|
<sql id="Base_Column_List" >
|
ACTIONID, RESOURCEID, USERID, APPID, ACTIONTIME, ACTIONTYPE,IP
|
</sql>
|
<select id="selectResActionRecordByResourceId" resultMap="BaseResultMap" parameterType="map" >
|
select e.* from (
|
select
|
row_number() over() as rownumber,
|
<include refid="Base_Column_List" />
|
from RES_ACTIONRECORD
|
where RESOURCEID = #{resourceid,jdbcType=DECIMAL}
|
) e
|
WHERE 1=1
|
<if test="page!=null and page!='' and limit!=null and limit!=''">
|
<![CDATA[ and rownumber >= #{page}*#{limit} and rownumber < #{page}*#{limit}+#{limit} ]]>
|
</if>
|
</select>
|
</mapper>
|