<?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.LogActionDao">
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
<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="queryObject" resultType="com.landtool.lanbase.modules.log.entity.LogAction">
|
select * from LOG_ACTION where ACTIONID = #{value}
|
</select>
|
|
|
<select id="queryList" resultType="com.landtool.lanbase.modules.log.entity.LogAction">
|
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 1= 1
|
<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!=''">
|
/** modified by qufangxu **/
|
AND concat(la.appid) LIKE concat('%',#{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>
|
) B
|
) A
|
WHERE rownumber > #{lowerOffset} AND <![CDATA[ rownumber <= ${upperOffset} ]]>
|
)a order by
|
<choose>
|
<when test="sidx != null and sidx != ''">
|
${sidx} ${order}
|
</when>
|
<otherwise>
|
dodate DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
<select id="queryTotal" resultType="int">
|
select count(*) 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="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 concat(la.appid) LIKE concat('%',#{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>
|
</select>
|
|
<insert id="save" parameterType="com.landtool.lanbase.modules.log.entity.LogAction">
|
insert into LOG_ACTION
|
(
|
USERID,
|
APPID,
|
DODATE,
|
LARGEMODEL,
|
SMALLMODEL,
|
REQUESTURL,
|
REQUESTIP,
|
REMARK,
|
ACTIONTYPE,
|
RESOURCEID,
|
TITLE
|
)
|
values
|
(
|
#{userid,jdbcType=BIGINT},
|
#{appid,jdbcType=BIGINT},
|
now(),
|
#{largemodel,jdbcType=VARCHAR},
|
#{smallmodel,jdbcType=VARCHAR},
|
#{requesturl,jdbcType=VARCHAR},
|
#{requestip,jdbcType=VARCHAR},
|
#{remark,jdbcType=VARCHAR},
|
#{actiontype,jdbcType=VARCHAR},
|
#{resourceid,jdbcType=BIGINT},
|
#{title,jdbcType=VARCHAR}
|
)
|
</insert>
|
|
<update id="update" parameterType="com.landtool.lanbase.modules.log.entity.LogAction">
|
update LOG_ACTION
|
<set>
|
<if test="userid != null">USERID = #{userid}, </if>
|
<if test="appid != null">APPID = #{appid}, </if>
|
<if test="dodate != null">DODATE = #{dodate}, </if>
|
<if test="largemodel != null">LARGEMODEL = #{largemodel}, </if>
|
<if test="smallmodel != null">SMALLMODEL = #{smallmodel}, </if>
|
<if test="requesturl != null">REQUESTURL = #{requesturl}, </if>
|
<if test="requestip != null">REQUESTIP = #{requestip}, </if>
|
<if test="remark != null">REMARK = #{remark},</if>
|
<if test="resourceid != null">RESOURCEID = #{resourceid},</if>
|
<if test="title != null">TITLE = #{title}</if>
|
</set>
|
where ACTIONID = #{actionid}
|
</update>
|
|
<delete id="delete">
|
delete from LOG_ACTION where ACTIqueryListONID = #{value}
|
</delete>
|
|
<delete id="deleteBatch">
|
delete from LOG_ACTION where ACTIONID in
|
<foreach item="actionid" collection="array" open="(" separator="," close=")">
|
#{actionid}
|
</foreach>
|
</delete>
|
|
<select id="queryUserId" resultType="long">
|
select userid from ORG_USER where loginname=#{UserName}
|
</select>
|
|
<select id="queryActionType" resultType="String">
|
select actiontype from LOG_ACTION where actiontype is not null group by actiontype
|
</select>
|
|
|
<select id="queryAnalyseResourceAction" resultType="map" >
|
SELECT * from (
|
select count(1) as count,title,l.USERID,CHINESENAME from LOG_ACTION l
|
left JOIN ORG_USER o on l.USERID=o.USERID
|
where RESOURCEID is not null AND TITLE IS NOT NULL GROUP BY RESOURCEid,title,l.USERID,o.CHINESENAME
|
) tmp
|
where count>=#{count}
|
</select>
|
</mapper>
|