PmExceptionMapper.xml 20160712

weixin_34321977發表於2016-07-12
<?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="PmExceptionMapper">
    <sql id="PmExceptionColumns">EXCEPTION_RESULT_ID,TASK_ID,TAGS,LOG_LEVEL,TIMESTAMP,CLASS_NAME,LOG_PATH,CONTENT
    </sql>

    <resultMap type="PmException" id="PmExceptionMap">
        <id column="EXCEPTION_RESULT_ID" property="exception_id" />
        <result column="TASK_ID" property="taskId" />
        <result column="TAGS" property="tags" />
        <result column="LOG_LEVEL" property="logLevel" />
        <result column="TIMESTAMP" property="timeStamp" />
        <result column="CLASS_NAME" property="className" />
        <result column="LOG_PATH" property="logPath" />
        <result column="CONTENT" property="content" />
    </resultMap>

    <select id="pmExceptionlistPage" parameterType="page"
        resultType="pd">
        select
        EXCEPTION_RESULT_ID,TAGS,TIMESTAMP,e.LOG_PATH,LOG_LEVEL,CLASS_NAME
        from EXCEPTION_RESULT e
        where e.TASK_ID= #{pd.taskId} 
        order by e.TIMESTAMP DESC
    </select>

    <select id="pmExceptionDetail" parameterType="page" resultType="pd">
        select CONTENT from EXCEPTION_RESULT
        where
        EXCEPTION_RESULT_ID=#{pd.EXCEPTION_RESULT_ID}
    </select>

    <!-- 列表以分頁形式 -->
    <select id="chartsForDay" parameterType="page"
        resultType="pd">
        select TAGS,count(TAGS) as EXCEPTION_COUNT,TIMESTAMP 
        from EXCEPTION_RESULT e
        where e.TASK_ID
        =#{pd.taskId} and 
        date(TIMESTAMP)=CURDATE()
        group by TAGS,left(TIMESTAMP, 13)
        order by e.TIMESTAMP DESC
    </select>

    <select id="ListPmExceptionPageForWeek" parameterType="page"
        resultType="pd">
        select * from EXCEPTION_RESULT e
        where e.TASK_ID
        =#{pd.taskId} and
        DATE_SUB(CURDATE(), INTERVAL
        DAY)
         <![CDATA[ < ]]>=
        date(TIMESTAMP)
        group by TAGS,left(TIMESTAMP, 10)
        order by e.TIMESTAMP
        DESC
    </select>

    <select id="chartsForMonth" parameterType="page" resultType="pd">
        select TAGS,count(TAGS) as EXCEPTION_COUNT,TIMESTAMP
        from
        EXCEPTION_RESULT e
        where e.TASK_ID=#{pd.taskId} and
        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)
        group by TAGS,left(TIMESTAMP, 10)
        order by TIMESTAMP
        DESC
    </select>

</mapper>

 

相關文章