SendMessageMapper.xml 2.31 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.sincere.xiaoanSearch.mapper.SendMessageMapper">
    <resultMap id="BaseResultMap" type="com.sincere.xiaoanSearch.model.SendMessage">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="device_id" property="deviceId" jdbcType="VARCHAR"/>
        <result column="card_no" property="cardNo" jdbcType="VARCHAR"/>
        <result column="serial_number" property="index" jdbcType="BIGINT"/>
        <result column="send" property="send" jdbcType="VARCHAR"/>
        <result column="result" property="result" jdbcType="VARCHAR"/>
        <result column="correct" property="correct" jdbcType="INTEGER"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="function_id" property="functionId" jdbcType="VARCHAR"/>
    </resultMap>

    <insert id="insert" parameterType="com.sincere.xiaoanSearch.model.SendMessage" useGeneratedKeys="true"
            keyColumn="id" keyProperty="id">
        insert into WG_send_message (device_id,card_no,serial_number,send,result,correct,create_time,function_id)
        values (#{deviceId},#{cardNo},#{index},#{send},#{result},#{correct},#{createTime},#{functionId})
    </insert>

    <select id="selectMessage" parameterType="com.sincere.xiaoanSearch.model.SendMessage" resultMap="BaseResultMap">
        select * from WG_send_message
        <where>
            <if test="deviceId != 0">
                and device_id =#{deviceId}
            </if>
            <if test="cardNo != null">
                and card_no = #{cardNo}
            </if>
            <if test="index != 0">
                and serial_number = #{index}
            </if>
            <if test="functionId != null">
                and function_id = #{functionId}
            </if>
        </where>
        order by create_time desc
    </select>

    <select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select * from WG_send_message where id =#{id}
    </select>

    <update id="update" parameterType="com.sincere.xiaoanSearch.model.SendMessage">
        update WG_send_message set result = #{result} , correct =#{correct}
        where id = #{id}
    </update>
</mapper>