ReplyMessage.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.weixin.dao.ReplyMessageDAO">
  6. <resultMap id="ReplyMessageMap" type="com.jpsoft.weixin.entity.ReplyMessage">
  7. <id property="id" column="id_" />
  8. <result property="event" column="event_" />
  9. <result property="message" column="message_" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateTime" column="update_time" />
  12. </resultMap>
  13. <insert id="insert" parameterType="com.jpsoft.weixin.entity.ReplyMessage">
  14. <!--
  15. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  16. select sys_guid() from dual
  17. </selectKey>
  18. -->
  19. <![CDATA[
  20. insert into wechat_reply_message
  21. (id_,event_,message_,create_time,update_time)
  22. values
  23. (
  24. #{id,jdbcType=VARCHAR}
  25. ,#{event,jdbcType=VARCHAR}
  26. ,#{message,jdbcType=VARCHAR}
  27. ,#{createTime,jdbcType= TIMESTAMP }
  28. ,#{updateTime,jdbcType= TIMESTAMP }
  29. )
  30. ]]>
  31. </insert>
  32. <delete id="delete" parameterType="string">
  33. delete from wechat_reply_message where id_=#{id,jdbcType=VARCHAR}
  34. </delete>
  35. <update id="update" parameterType="com.jpsoft.weixin.entity.ReplyMessage">
  36. update wechat_reply_message
  37. <set>
  38. <if test="event!=null">
  39. event_=#{event,jdbcType=VARCHAR},
  40. </if>
  41. <if test="message!=null">
  42. message_=#{message,jdbcType=VARCHAR},
  43. </if>
  44. <if test="createTime!=null">
  45. create_time=#{createTime,jdbcType= TIMESTAMP },
  46. </if>
  47. <if test="updateTime!=null">
  48. update_time=#{updateTime,jdbcType= TIMESTAMP },
  49. </if>
  50. </set>
  51. where id_=#{id}
  52. </update>
  53. <select id="get" parameterType="string" resultMap="ReplyMessageMap">
  54. select * from wechat_reply_message where id_=#{0}
  55. </select>
  56. <select id="exist" parameterType="string" resultType="int">
  57. select count(*) from wechat_reply_message where id_=#{0}
  58. </select>
  59. <select id="list" resultMap="ReplyMessageMap">
  60. select * from wechat_reply_message
  61. </select>
  62. <select id="search" parameterType="hashmap" resultMap="ReplyMessageMap">
  63. <![CDATA[
  64. select * from wechat_reply_message
  65. ]]>
  66. <where>
  67. <if test="searchParams.id != null">
  68. and ID_ like #{searchParams.id}
  69. </if>
  70. </where>
  71. <foreach item="sort" collection="sortList" open="order by" separator=",">
  72. ${sort.name} ${sort.order}
  73. </foreach>
  74. </select>
  75. <select id="findByEvent" resultMap="ReplyMessageMap">
  76. select * from wechat_reply_message where id_=#{id} and event_=#{event} limit 1
  77. </select>
  78. </mapper>