| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.ruoyi.interfaces.mapper.PtServiceLogMapper">
- <resultMap type="com.ruoyi.interfaces.domain.PtServiceLog" id="PtServiceLogResult">
- <result property="logId" column="log_id"/>
- <result property="serId" column="ser_id"/>
- <result property="mdId" column="md_id"/>
- <result property="tm" column="tm"/>
- <result property="senText" column="sen_text"/>
- <result property="returnText" column="return_text"/>
- <result property="execTm" column="exec_tm"/>
- <result property="statusCode" column="status_code"/>
- <result property="clientIp" column="client_ip"/>
- <result property="userId" column="user_id"/>
- <result property="geoCity" column="geo_city"/>
- <result property="serviceName" column="service_name"/>
- <result property="appId" column="app_id"/>
- <result property="appName" column="app_name"/>
- <result property="modelName" column="modelName"/>
- <result property="userName" column="userName"/>
- </resultMap>
- <sql id="selectPtServiceLogVo">
- select *
- from pt_service_log
- </sql>
- <select id="selectPtServiceLogList" parameterType="com.ruoyi.interfaces.domain.PtServiceLog"
- resultMap="PtServiceLogResult">
- SELECT
- a.*,b."NAME" as modelName, c.nick_name as userName
- FROM
- pt_service_log a
- LEFT JOIN md_model_info b on a.md_id = b.MDID
- LEFT JOIN SH_PROJECT.sys_user c on a.user_id = c.user_id
- <where>
- <if test="logId != null ">and log_id = #{logId}</if>
- <if test="serId != null and serId != ''">and ser_id = #{serId}</if>
- <if test="mdId != null and mdId != ''">and md_id = #{mdId}</if>
- <if test="tm != null ">and tm = #{tm}</if>
- <if test="senText != null and senText != ''">and sen_text = #{senText}</if>
- <if test="returnText != null and returnText != ''">and return_text = #{returnText}</if>
- <if test="execTm != null ">and exec_tm = #{execTm}</if>
- </where>
- ORDER BY tm DESC
- </select>
- <select id="selectPtServiceLogByLogId" parameterType="Long" resultMap="PtServiceLogResult">
- <include refid="selectPtServiceLogVo"/>
- where log_id = #{logId}
- </select>
- <select id="selectServiceLogStatis" resultMap="com.ruoyi.interfaces.mapper.PtServiceLogStatisMapper.PtServiceLogStatisMap">
- select
- l.STATIS_TM,
- l.MD_ID,
- l.SER_ID,
- l.STATUS_CODE,
- l.STATIS_NUM,
- l.EXEC_TM,
- m.name as MD_NAME,
- s.name as SER_NAME
- from (
- SELECT tm as statis_Tm, MD_ID, SER_ID, STATUS_CODE, count(1) STATIS_NUM,SUM(EXEC_TM) EXEC_TM
- FROM (SELECT MD_ID, SER_ID, STATUS_CODE, to_char(tm, 'yyyy-mm-dd') tm,EXEC_TM from pt_Service_Log
- <where>
- tm >= to_date(#{params.beginTime},'yyyy-mm-dd')
- and tm < to_date(#{params.endTime},'yyyy-mm-dd')
- </where>
- )
- GROUP BY tm, MD_ID, SER_ID, STATUS_CODE
- ) l
- left join md_model_info m on l.MD_ID = m.MDID
- left join pt_service s on l.MD_ID = s.SRV_ID
- </select>
- <insert id="insertPtServiceLog" parameterType="com.ruoyi.interfaces.domain.PtServiceLog" useGeneratedKeys="true"
- keyProperty="logId">
- insert into pt_service_log
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="serId != null">ser_id,</if>
- <if test="mdId != null">md_id,</if>
- <if test="tm != null">tm,</if>
- <if test="senText != null">sen_text,</if>
- <if test="returnText != null">return_text,</if>
- <if test="execTm != null">exec_tm,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="serId != null">#{serId},</if>
- <if test="mdId != null">#{mdId},</if>
- <if test="tm != null">#{tm},</if>
- <if test="senText != null">#{senText},</if>
- <if test="returnText != null">#{returnText},</if>
- <if test="execTm != null">#{execTm},</if>
- </trim>
- </insert>
- <update id="updatePtServiceLog" parameterType="com.ruoyi.interfaces.domain.PtServiceLog">
- update pt_service_log
- <trim prefix="SET" suffixOverrides=",">
- <if test="serId != null">ser_id = #{serId},</if>
- <if test="mdId != null">md_id = #{mdId},</if>
- <if test="tm != null">tm = #{tm},</if>
- <if test="senText != null">sen_text = #{senText},</if>
- <if test="returnText != null">return_text = #{returnText},</if>
- <if test="execTm != null">exec_tm = #{execTm},</if>
- </trim>
- where log_id = #{logId}
- </update>
- <select id="count" resultType="Long">
- select count(log_id)
- from pt_service_log
- </select>
- <delete id="deletePtServiceLogByLogId" parameterType="Long">
- delete
- from pt_service_log
- where log_id = #{logId}
- </delete>
- <delete id="deletePtServiceLogByLogIds" parameterType="String">
- delete from pt_service_log where log_id in
- <foreach item="logId" collection="array" open="(" separator="," close=")">
- #{logId}
- </foreach>
- </delete>
- </mapper>
|