<?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.sys.dao.MonitorDao">
|
<!-- 可根据自己的需求,是否要使用 -->
|
<resultMap type="com.landtool.lanbase.modules.sys.entity.SysSysteminfo" id="systeminfoMap">
|
<result property="appid" column="APPID"/>
|
<result property="appfullname" column="APPFULLNAME"/>
|
<result property="appname" column="APPNAME"/>
|
<result property="appcode" column="APPCODE"/>
|
<result property="systype" column="SYSTYPE"/>
|
<result property="version" column="VERSION"/>
|
<result property="sysaddress" column="SYSADDRESS"/>
|
<result property="sysimgurl" column="SYSIMGURL"/>
|
<result property="sysdescription" column="SYSDESCRIPTION"/>
|
<result property="sysstatus" column="SYSSTATUS"/>
|
<result property="logintimes" column="LOGINTIMES"/>
|
<result property="magunitname" column="MAGUNITNAME"/>
|
<result property="maguser" column="MAGUSER"/>
|
<result property="magtechuser" column="MAGTECHUSER"/>
|
<result property="techusertel" column="TECHUSERTEL"/>
|
<result property="rcreateuser" column="RCREATEUSER"/>
|
<result property="rcreatedate" column="RCREATEDATE"/>
|
<result property="rlasteditdate" column="RLASTEDITDATE"/>
|
<result property="remark" column="REMARK"/>
|
<result property="iscaslogin" column="ISCASLOGIN"/>
|
<result property="isnavigationshow" column="ISNAVIGATIONSHOW"/>
|
<result property="orderid" column="ORDERID"/>
|
<result property="referenceurl" column="REFERENCEURL"/>
|
<result property="browser" column="BROWSER"/>
|
</resultMap>
|
|
<resultMap type="com.landtool.lanbase.modules.log.entity.LogAction" id="actionMap">
|
<result property="actionid" column="ACTIONID"/>
|
<result property="userid" column="USERID"/>
|
<result property="appid" column="APPID"/>
|
<result property="dodate" column="DODATE"/>
|
<result property="largemodel" column="LARGEMODEL"/>
|
<result property="smallmodel" column="SMALLMODEL"/>
|
<result property="requesturl" column="REQUESTURL"/>
|
<result property="requestip" column="REQUESTIP"/>
|
<result property="remark" column="REMARK"/>
|
<result property="actiontype" column="ACTIONTYPE"/>
|
<result property="resourceid" column="RESOURCEID"/>
|
<result property="title" column="TITLE"/>
|
</resultMap>
|
|
<select id="queryUsers" resultType="map" parameterType="list">
|
select USERID,CHINESENAME,JOBTITLE,JOBLEVEL,LOGINNAME from ORG_USER
|
where LOGINNAME in
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
#{item}
|
</foreach>
|
</select>
|
|
|
<select id="queryUserops" resultType="map" parameterType="map">
|
SELECT C.REMARK, C.ACTIONTYPE,count(*) as count from (
|
SELECT
|
ROW_NUMBER () OVER ( ORDER BY B.dodate DESC ) AS rownumber,
|
B.*
|
FROM
|
(
|
SELECT
|
la.*,
|
ssi.APPFULLNAME,
|
os.CHINESENAME
|
FROM
|
LOG_ACTION la
|
LEFT JOIN SYS_SYSTEMINFO ssi ON la.appid = ssi.appid
|
LEFT JOIN ORG_USER os ON os.USERID = la.USERID
|
WHERE 1=1
|
<if test="userid!=null and userid!=''">
|
and la.USERID = #{userid}
|
</if>
|
<if test="username!=null and username!=''">
|
and os.CHINESENAME = #{username}
|
</if>
|
<if test="months!=null and months!='' ">
|
AND la.DODATE> now() + interval '${month} month'
|
</if>
|
<if test="day!=null and day!=''">
|
AND la.DODATE> now() - interval '${day} day'
|
</if>
|
<if test="startdate!=null and startdate!='' and enddate!=null and enddate!=''">
|
la.DODATE BETWEEN to_timestamp(#{startdate}, 'yyyy-MM-DD:HH24:mi:ss') AND to_timestamp( #{enddate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
</if>
|
) B) C group by (C.REMARK, C.ACTIONTYPE)
|
</select>
|
|
|
<select id="queryTotal" resultType="map" parameterType="map">
|
SELECT C.ACTIONTYPE, count(*) from (
|
SELECT
|
ROW_NUMBER () OVER ( ORDER BY B.dodate DESC ) AS rownumber,
|
B.*
|
FROM
|
(
|
SELECT
|
la.*,
|
ssi.APPFULLNAME,
|
os.CHINESENAME
|
FROM
|
LOG_ACTION la
|
LEFT JOIN SYS_SYSTEMINFO ssi ON la.appid = ssi.appid
|
LEFT JOIN ORG_USER os ON os.USERID = la.USERID
|
WHERE 1=1
|
<if test="userid!=null and userid!='' ">
|
and la.USERID = #{userid}
|
</if>
|
<if test="months !=null and months!='' ">
|
AND la.DODATE> now() + interval '${month} month'
|
</if>
|
<if test="day!=null and day !=''">
|
AND la.DODATE> now() - interval '${day} day'
|
</if>
|
<if test="startdate!=null and startdate!='' and enddate!=null and enddate !=''">
|
la.DODATE BETWEEN to_timestamp( #{startdate}, 'yyyy-MM-DD:HH24:mi:ss' ) AND to_timestamp( #{enddate}, 'yyyy-MM-DD:HH24:mi:ss' )
|
</if>
|
) B) C GROUP BY C.ACTIONTYPE
|
</select>
|
|
<select id="queryUserActionLine" resultType="map" parameterType="map">
|
SELECT
|
t.USERID userid,
|
t.REQUESTIP requestip,
|
t.ACTIONTYPE actiontype,
|
t.REMARK remark,
|
t.DODATE time,
|
c.CHINESENAME chinesename
|
FROM
|
LOG_ACTION t LEFT JOIN ORG_USER c ON t.USERID = c.USERID
|
WHERE
|
t.USERID = 4
|
</select>
|
|
<select id="querySysSystemInfo" resultMap="systeminfoMap" parameterType="map">
|
SELECT
|
*
|
FROM
|
SYS_SYSTEMINFO
|
</select>
|
|
<insert id="insertSystemProblem" parameterType="com.landtool.lanbase.modules.sys.entity.SysSystemProblemTrack">
|
<selectKey keyProperty="id" resultType="java.lang.Integer" order="BEFORE">
|
select NEXTVAL('SYS_SYSTEMPROBLEMTRACK_INS_SEQ') from dual
|
</selectKey>
|
INSERT INTO SYSSYSTEMPROBLEMTRACK (
|
ID,
|
APPID,
|
STATUS,
|
ADDRESS,
|
CREATETIME,
|
PROBLEMREASON
|
)
|
VALUES
|
(
|
#{id,jdbcType=DECIMAL},
|
#{appid,jdbcType=DECIMAL},
|
#{status,jdbcType=VARCHAR},
|
#{address,jdbcType=VARCHAR},
|
#{createtime,jdbcType=TIMESTAMP},
|
#{problemreason,jdbcType=VARCHAR}
|
)
|
</insert>
|
|
<select id="queryProblemSystem" resultType="map" parameterType="map">
|
select e.* from (
|
SELECT
|
row_number() over() as num,
|
c.*,
|
b.APPNAME
|
FROM
|
(
|
SELECT
|
ROW_NUMBER () OVER ( PARTITION BY APPID ORDER BY CREATETIME DESC ) rn,
|
APPID,
|
STATUS,
|
ADDRESS,
|
CREATETIME,
|
PROBLEMREASON
|
FROM
|
SYSSYSTEMPROBLEMTRACK t
|
) c left join SYS_SYSTEMINFO b on c.APPID=b.APPID
|
WHERE
|
rn = 1 and createtime > now()- interval '0.25 h'
|
order by c.APPID
|
) e
|
WHERE 1=1
|
<if test="page!=null and page!='' and limit!=null and limit!=''">
|
<![CDATA[ and num >=#{page}*#{limit} and num<#{page}*#{limit}+#{limit} ]]>
|
</if>
|
</select>
|
|
|
<select id="queryUserTrace" resultType="com.landtool.lanbase.modules.log.entity.LogAction" parameterType="map">
|
select * from (
|
SELECT *
|
FROM(
|
SELECT ROW_NUMBER() OVER(
|
ORDER BY B.dodate DESC) AS rownumber,B.*
|
FROM (
|
SELECT la.*,ssi.APPFULLNAME,os.CHINESENAME FROM LOG_ACTION la
|
LEFT JOIN SYS_SYSTEMINFO ssi ON la.appid=ssi.appid
|
LEFT JOIN ORG_USER os ON os.USERID=la.USERID
|
<where>
|
<if test="UserName != null and UserName!=''">
|
AND (os.CHINESENAME LIKE ('%' || #{UserName} || '%') or loginname like ('%' || #{UserName} || '%') or
|
LOWER(os.spellfirst) like ('%' || LOWER(#{UserName}) || '%'))
|
</if>
|
<if test="appid != null and appid!=''">
|
AND la.appid LIKE ('%' || #{appid} || '%')
|
</if>
|
<if test="actiontype != null and actiontype!=''">
|
AND la.actiontype = #{actiontype}
|
</if>
|
<if test="beginDate != null and beginDate !=''">
|
and DODATE >=
|
to_timestamp(#{beginDate,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
|
</if>
|
<if test="endDate != null and endDate !=''">
|
<![CDATA[ AND DODATE <=to_timestamp(#{endDate,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss') ]]>
|
|
</if>
|
<if test="requestip != null and requestip != ''">
|
AND la.REQUESTIP LIKE ('%' || #{requestip} || '%')
|
</if>
|
</where>
|
) B
|
) A
|
WHERE <![CDATA[ rownumber >=#{page}*#{limit} and rownumber<#{page}*#{limit}+#{limit} ]]>
|
)a order by
|
<choose>
|
<when test="sidx != null and sidx != ''">
|
${sidx} ${order}
|
</when>
|
<otherwise>
|
dodate DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
</mapper>
|