NoticeMapper.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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="com.finikes.oc.base.dao.NoticeDao">
  4. <insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id"
  5. parameterType="com.finikes.oc.base.entity.Notice">
  6. INSERT INTO t_notice (type, title ,
  7. second_title, content,
  8. publish_time, create_time, update_time, cid, uid)
  9. VALUES (#{type}, #{title} ,
  10. #{secondTitle}, #{content},
  11. #{publishTime}, #{createTime}, #{updateTime}, #{cid}, #{uid})
  12. </insert>
  13. <update id="update" parameterType="com.finikes.oc.base.entity.Notice">
  14. UPDATE t_notice SET type = #{type}, title = #{title},
  15. second_title = #{secondTitle}, content = #{content}, publish_time = #{publishTime},
  16. create_time = #{createTime}, update_time = #{updateTime}, cid = #{cid}, uid = #{uid}
  17. WHERE id = #{id}
  18. </update>
  19. <update id="updateSelective">
  20. UPDATE t_notice
  21. <set>
  22. <if test="type != null">
  23. type = #{type},
  24. </if>
  25. <if test="title != null">
  26. title = #{title},
  27. </if>
  28. <if test="secondTitle != null">
  29. second_title = #{secondTitle},
  30. </if>
  31. <if test="content != null">
  32. content = #{content},
  33. </if>
  34. <if test="publishTime != null">
  35. publish_time = #{publishTime},
  36. </if>
  37. <if test="createTime != null">
  38. create_time = #{createTime},
  39. </if>
  40. <if test="updateTime != null">
  41. update_time = #{updateTime},
  42. </if>
  43. <if test="cid">
  44. cid = #{cid},
  45. </if>
  46. <if test="uid">
  47. uid = #{uid}
  48. </if>
  49. </set>
  50. WHERE id = #{id}
  51. </update>
  52. <select id="selectByPrimaryKey" parameterType="integer" resultType="com.finikes.oc.base.entity.Notice">
  53. SELECT id, type, title , second_title, content, publish_time, create_time, update_time, cid, uid
  54. FROM t_notice
  55. WHERE id = #{primaryKey}
  56. </select>
  57. <select id="selectByType" resultType="com.finikes.oc.base.entity.Notice">
  58. SELECT id, type, title , second_title, content, publish_time, create_time, update_time, cid, uid
  59. FROM t_notice
  60. <where>
  61. <if test="type != null">
  62. type = #{type}
  63. </if>
  64. </where>
  65. ORDER BY id DESC
  66. </select>
  67. <delete id="deleteByPrimaryKey" parameterType="integer">
  68. DELETE
  69. FROM t_notice
  70. WHERE id = #{primaryKey}
  71. </delete>
  72. </mapper>