Message.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.picc.modules.base.dao.MessageDAO">
  6. <resultMap id="MessageMap" type="com.jpsoft.picc.modules.base.entity.Message">
  7. <id property="id" column="id_" />
  8. <result property="title" column="title_" />
  9. <result property="content" column="content_" />
  10. <result property="senderId" column="sender_id" />
  11. <result property="recipientId" column="recipient_id" />
  12. <result property="status" column="status_" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. <result property="delFlag" column="del_flag" />
  18. </resultMap>
  19. <insert id="insert" parameterType="com.jpsoft.picc.modules.base.entity.Message">
  20. <!--
  21. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  22. select sys_guid() from dual
  23. </selectKey>
  24. -->
  25. <![CDATA[
  26. insert into base_message
  27. (id_,title_,content_,sender_id,recipient_id,status_,create_by,create_time,update_by,update_time,del_flag)
  28. values
  29. (
  30. #{id,jdbcType=VARCHAR}
  31. ,#{title,jdbcType=VARCHAR}
  32. ,#{content,jdbcType=VARCHAR}
  33. ,#{senderId,jdbcType=VARCHAR}
  34. ,#{recipientId,jdbcType=VARCHAR}
  35. ,#{status,jdbcType= NUMERIC }
  36. ,#{createBy,jdbcType=VARCHAR}
  37. ,#{createTime,jdbcType= TIMESTAMP }
  38. ,#{updateBy,jdbcType=VARCHAR}
  39. ,#{updateTime,jdbcType= TIMESTAMP }
  40. ,#{delFlag,jdbcType= NUMERIC }
  41. )
  42. ]]>
  43. </insert>
  44. <delete id="delete" parameterType="string">
  45. delete from base_message where id_=#{id,jdbcType=VARCHAR}
  46. </delete>
  47. <update id="update" parameterType="com.jpsoft.picc.modules.base.entity.Message">
  48. update base_message
  49. <set>
  50. <if test="title!=null">
  51. title_=#{title,jdbcType=VARCHAR},
  52. </if>
  53. <if test="content!=null">
  54. content_=#{content,jdbcType=VARCHAR},
  55. </if>
  56. <if test="senderId!=null">
  57. sender_id=#{senderId,jdbcType=VARCHAR},
  58. </if>
  59. <if test="recipientId!=null">
  60. recipient_id=#{recipientId,jdbcType=VARCHAR},
  61. </if>
  62. <if test="status!=null">
  63. status_=#{status,jdbcType= NUMERIC },
  64. </if>
  65. <if test="createBy!=null">
  66. create_by=#{createBy,jdbcType=VARCHAR},
  67. </if>
  68. <if test="createTime!=null">
  69. create_time=#{createTime,jdbcType= TIMESTAMP },
  70. </if>
  71. <if test="updateBy!=null">
  72. update_by=#{updateBy,jdbcType=VARCHAR},
  73. </if>
  74. <if test="updateTime!=null">
  75. update_time=#{updateTime,jdbcType= TIMESTAMP },
  76. </if>
  77. <if test="delFlag!=null">
  78. del_flag=#{delFlag,jdbcType= NUMERIC },
  79. </if>
  80. </set>
  81. where id_=#{id}
  82. </update>
  83. <select id="get" parameterType="string" resultMap="MessageMap">
  84. select
  85. id_,title_,content_,sender_id,recipient_id,status_,create_by,create_time,update_by,update_time,del_flag from base_message where id_=#{0}
  86. </select>
  87. <select id="exist" parameterType="string" resultType="int">
  88. select count(*) from base_message where id_=#{0}
  89. </select>
  90. <select id="list" resultMap="MessageMap">
  91. select * from base_message
  92. </select>
  93. <select id="search" parameterType="hashmap" resultMap="MessageMap">
  94. <![CDATA[
  95. select * from base_message
  96. ]]>
  97. <where>
  98. <if test="searchParams.id != null">
  99. and ID_ like #{searchParams.id}
  100. </if>
  101. <if test="searchParams.senderId != null">
  102. and sender_id like #{searchParams.senderId}
  103. </if>
  104. <if test="searchParams.recipientId != null">
  105. and recipient_id like #{searchParams.recipientId}
  106. </if>
  107. <if test="searchParams.status != null">
  108. and status_ like #{searchParams.status}
  109. </if>
  110. </where>
  111. <foreach item="sort" collection="sortList" open="order by" separator=",">
  112. ${sort.name} ${sort.order}
  113. </foreach>
  114. </select>
  115. </mapper>