PtServiceLogMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.interfaces.mapper.PtServiceLogMapper">
  6. <resultMap type="com.ruoyi.interfaces.domain.PtServiceLog" id="PtServiceLogResult">
  7. <result property="logId" column="log_id"/>
  8. <result property="serId" column="ser_id"/>
  9. <result property="mdId" column="md_id"/>
  10. <result property="tm" column="tm"/>
  11. <result property="senText" column="sen_text"/>
  12. <result property="returnText" column="return_text"/>
  13. <result property="execTm" column="exec_tm"/>
  14. <result property="statusCode" column="status_code"/>
  15. <result property="clientIp" column="client_ip"/>
  16. <result property="userId" column="user_id"/>
  17. <result property="geoCity" column="geo_city"/>
  18. <result property="serviceName" column="service_name"/>
  19. <result property="appId" column="app_id"/>
  20. <result property="appName" column="app_name"/>
  21. <result property="modelName" column="modelName"/>
  22. <result property="userName" column="userName"/>
  23. </resultMap>
  24. <sql id="selectPtServiceLogVo">
  25. select *
  26. from pt_service_log
  27. </sql>
  28. <select id="selectPtServiceLogList" parameterType="com.ruoyi.interfaces.domain.PtServiceLog"
  29. resultMap="PtServiceLogResult">
  30. SELECT
  31. a.*,b."NAME" as modelName, c.nick_name as userName
  32. FROM
  33. pt_service_log a
  34. LEFT JOIN md_model_info b on a.md_id = b.MDID
  35. LEFT JOIN SH_PROJECT.sys_user c on a.user_id = c.user_id
  36. <where>
  37. <if test="logId != null ">and log_id = #{logId}</if>
  38. <if test="serId != null and serId != ''">and ser_id = #{serId}</if>
  39. <if test="mdId != null and mdId != ''">and md_id = #{mdId}</if>
  40. <if test="tm != null ">and tm = #{tm}</if>
  41. <if test="senText != null and senText != ''">and sen_text = #{senText}</if>
  42. <if test="returnText != null and returnText != ''">and return_text = #{returnText}</if>
  43. <if test="execTm != null ">and exec_tm = #{execTm}</if>
  44. </where>
  45. ORDER BY tm DESC
  46. </select>
  47. <select id="selectPtServiceLogByLogId" parameterType="Long" resultMap="PtServiceLogResult">
  48. <include refid="selectPtServiceLogVo"/>
  49. where log_id = #{logId}
  50. </select>
  51. <select id="selectServiceLogStatis" resultMap="com.ruoyi.interfaces.mapper.PtServiceLogStatisMapper.PtServiceLogStatisMap">
  52. select
  53. l.STATIS_TM,
  54. l.MD_ID,
  55. l.SER_ID,
  56. l.STATUS_CODE,
  57. l.STATIS_NUM,
  58. l.EXEC_TM,
  59. m.name as MD_NAME,
  60. s.name as SER_NAME
  61. from (
  62. SELECT tm as statis_Tm, MD_ID, SER_ID, STATUS_CODE, count(1) STATIS_NUM,SUM(EXEC_TM) EXEC_TM
  63. FROM (SELECT MD_ID, SER_ID, STATUS_CODE, to_char(tm, 'yyyy-mm-dd') tm,EXEC_TM from pt_Service_Log
  64. <where>
  65. tm &gt;= to_date(#{params.beginTime},'yyyy-mm-dd')
  66. and tm &lt; to_date(#{params.endTime},'yyyy-mm-dd')
  67. </where>
  68. )
  69. GROUP BY tm, MD_ID, SER_ID, STATUS_CODE
  70. ) l
  71. left join md_model_info m on l.MD_ID = m.MDID
  72. left join pt_service s on l.MD_ID = s.SRV_ID
  73. </select>
  74. <insert id="insertPtServiceLog" parameterType="com.ruoyi.interfaces.domain.PtServiceLog" useGeneratedKeys="true"
  75. keyProperty="logId">
  76. insert into pt_service_log
  77. <trim prefix="(" suffix=")" suffixOverrides=",">
  78. <if test="serId != null">ser_id,</if>
  79. <if test="mdId != null">md_id,</if>
  80. <if test="tm != null">tm,</if>
  81. <if test="senText != null">sen_text,</if>
  82. <if test="returnText != null">return_text,</if>
  83. <if test="execTm != null">exec_tm,</if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="serId != null">#{serId},</if>
  87. <if test="mdId != null">#{mdId},</if>
  88. <if test="tm != null">#{tm},</if>
  89. <if test="senText != null">#{senText},</if>
  90. <if test="returnText != null">#{returnText},</if>
  91. <if test="execTm != null">#{execTm},</if>
  92. </trim>
  93. </insert>
  94. <update id="updatePtServiceLog" parameterType="com.ruoyi.interfaces.domain.PtServiceLog">
  95. update pt_service_log
  96. <trim prefix="SET" suffixOverrides=",">
  97. <if test="serId != null">ser_id = #{serId},</if>
  98. <if test="mdId != null">md_id = #{mdId},</if>
  99. <if test="tm != null">tm = #{tm},</if>
  100. <if test="senText != null">sen_text = #{senText},</if>
  101. <if test="returnText != null">return_text = #{returnText},</if>
  102. <if test="execTm != null">exec_tm = #{execTm},</if>
  103. </trim>
  104. where log_id = #{logId}
  105. </update>
  106. <select id="count" resultType="Long">
  107. select count(log_id)
  108. from pt_service_log
  109. </select>
  110. <delete id="deletePtServiceLogByLogId" parameterType="Long">
  111. delete
  112. from pt_service_log
  113. where log_id = #{logId}
  114. </delete>
  115. <delete id="deletePtServiceLogByLogIds" parameterType="String">
  116. delete from pt_service_log where log_id in
  117. <foreach item="logId" collection="array" open="(" separator="," close=")">
  118. #{logId}
  119. </foreach>
  120. </delete>
  121. </mapper>