StandardMemoMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="lingtao.net.dao.StandardMemoMapper">
  4. <select id="getStandardMemos" parameterType="lingtao.net.bean.StandardMemo"
  5. resultType="lingtao.net.bean.StandardMemo">
  6. SELECT
  7. *
  8. FROM
  9. tbl_standard_memo
  10. <where>
  11. 1=1
  12. <if test="content != null and content != ''">
  13. and title like '%${content}%' or content like '%${content}%'
  14. </if>
  15. <if test="type != null and type != ''">
  16. and `type` = #{type}
  17. </if>
  18. </where>
  19. order by id desc
  20. </select>
  21. <insert id="addStandardMemo" parameterType="lingtao.net.bean.StandardMemo">
  22. insert into tbl_standard_memo
  23. (content, createBy, createDate, title, memo, type)
  24. values (#{content}, #{createBy}, now(), #{title}, #{memo}, #{type})
  25. </insert>
  26. <update id="updateStandardMemoById" parameterType="lingtao.net.bean.StandardMemo">
  27. update tbl_standard_memo
  28. <set>
  29. <if test="content != null">
  30. content = #{content,jdbcType=VARCHAR},
  31. </if>
  32. <if test="updateBy != null">
  33. updateBy = #{updateBy,jdbcType=VARCHAR},
  34. </if>
  35. <if test="updateDate != null">
  36. updateDate = now(),
  37. </if>
  38. <if test="title != null">
  39. title = #{title,jdbcType=VARCHAR},
  40. </if>
  41. <if test="memo != null">
  42. memo = #{memo,jdbcType=VARCHAR},
  43. </if>
  44. </set>
  45. where id = #{id,jdbcType=INTEGER}
  46. </update>
  47. <delete id="deleteStandardMemoById">
  48. delete
  49. from tbl_standard_memo
  50. where id = #{id}
  51. </delete>
  52. </mapper>