MOrderCheckErrorMapper.xml 2.7 KB
<?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.monitor.mysql.mapper.MOrderCheckErrorMapper">

    <resultMap id="BaseResultMap" type="com.model.OrderInfoCheck">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="event" property="event" jdbcType="VARCHAR"/>
        <result column="context" property="context" jdbcType="VARCHAR"/>
        <result column="ip" property="ip" jdbcType="VARCHAR"/>
        <result column="order_code" property="orderCode" jdbcType="VARCHAR"/>
        <result column="response" property="response" jdbcType="VARCHAR"/>
        <result column="body" property="body" jdbcType="LONGVARCHAR"/>
        <result column="is_send" property="isSend" jdbcType="CHAR"/>
        <result column="influxdb" property="influxdb" jdbcType="VARCHAR"/>
        <result column="influx_time" property="influxTime" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="Base_Column_List">
   id, event, context, ip, order_code, response, influxdb, influx_time, is_send, body, DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') as create_time, DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%S') as update_time
  </sql>

    <select id="selectOrderCheck" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from order_info_check
        ORDER BY ID DESC
        LIMIT #{offsetCount},#{limitCount}
    </select>

    <select id="selectByid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from order_info_check
        where id = #{id}
    </select>

    <insert id="insert" parameterType="com.model.OrderInfoCheck">
    INSERT INTO order_info_check
    (event, context, ip, order_code, response,
    body, influxdb,influx_time, create_time, update_time)
    VALUES    (#{event,jdbcType=VARCHAR},#{context,jdbcType=VARCHAR},
    #{ip,jdbcType=VARCHAR},#{orderCode,jdbcType=VARCHAR},
    #{response,jdbcType=VARCHAR},#{body,jdbcType=LONGVARCHAR},
    #{influxdb,jdbcType=VARCHAR},#{influxTime,jdbcType=VARCHAR},NOW(),NOW())
</insert>

    <update id="updateSendStatus" >
    update order_info_check
    set is_send = 'Y',
     update_time = now()
    where id = #{id}
    </update>

    <select id="selectBodyByid" resultType="java.lang.String" parameterType="java.lang.Integer">
        select
        body
        from order_info_check
        where  id = #{id}
    </select>

    <select id="selectOrderCount" resultType="java.lang.Integer">
        SELECT COUNT(1) FROM order_info_check
    </select>
</mapper>