|
|
@@ -0,0 +1,128 @@
|
|
|
+<?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.usoftchina.smartschool.wechat.mapper.BrokerMessageLogMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="msgId" property="msgId" jdbcType="VARCHAR" />
|
|
|
+ <result column="message" property="message" jdbcType="LONGVARCHAR" />
|
|
|
+ <result column="status" property="status" jdbcType="VARCHAR" />
|
|
|
+ <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="reason" property="reason" jdbcType="VARCHAR" />
|
|
|
+ <result column="retry" property="retry" jdbcType="INTEGER" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ id, msgId, message, status, createTime, reason, retry
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from brokermessagelog
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
+ delete from brokermessagelog
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ insert into brokermessagelog (msgId, message,
|
|
|
+ status, createTime, reason
|
|
|
+ )
|
|
|
+ values ( #{msgId,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR},
|
|
|
+ #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{reason,jdbcType=VARCHAR}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ insert into brokermessagelog
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="msgId != null" >
|
|
|
+ msgId,
|
|
|
+ </if>
|
|
|
+ <if test="message != null" >
|
|
|
+ message,
|
|
|
+ </if>
|
|
|
+ <if test="status != null" >
|
|
|
+ status,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ createTime,
|
|
|
+ </if>
|
|
|
+ <if test="reason != null" >
|
|
|
+ reason,
|
|
|
+ </if>
|
|
|
+ <if test="retry != null" >
|
|
|
+ retry,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="msgId != null" >
|
|
|
+ #{msgId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="message != null" >
|
|
|
+ #{message,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null" >
|
|
|
+ #{status,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="reason != null" >
|
|
|
+ #{reason,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="retry != null" >
|
|
|
+ #{retry},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ update brokermessagelog
|
|
|
+ <set >
|
|
|
+ <if test="message != null" >
|
|
|
+ message = #{message,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="status != null" >
|
|
|
+ status = #{status,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="reason != null" >
|
|
|
+ reason = #{reason,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where msgId = #{msgId,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateMessageLogandAddRetry" parameterType="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ update brokermessagelog
|
|
|
+ set status = #{status}, reason = #{reason}, retry = retry + 1
|
|
|
+ where msgId = #{msgId,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.usoftchina.smartschool.wechat.po.BrokerMessagelog" >
|
|
|
+ update brokermessagelog
|
|
|
+ set msgId = #{msgId,jdbcType=VARCHAR},
|
|
|
+ message = #{message,jdbcType=VARCHAR},
|
|
|
+ status = #{status,jdbcType=VARCHAR},
|
|
|
+ createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ reason = #{reason,jdbcType=VARCHAR}
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getMessage" parameterType="string" resultMap="BaseResultMap">
|
|
|
+ select * from BrokerMessagelog where msgId = #{msgId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLiveMessage" parameterType="string" resultMap="BaseResultMap">
|
|
|
+ select * from BrokerMessagelog where msgId = #{msgId} and retry < 3
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeadMessage" parameterType="string" resultMap="BaseResultMap">
|
|
|
+ select * from BrokerMessagelog where msgId = #{msgId} and retry > 3
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateSuccess" parameterType="string">
|
|
|
+ update BrokerMessagelog set status='投递成功',reason='' where msgid = #{msgId}
|
|
|
+ </update>
|
|
|
+</mapper>
|