SysMessageMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.system.mapper.SysMessageMapper">
  6. <resultMap type="SysMessage" id="SysMessageResult">
  7. <result property="id" column="id" />
  8. <result property="msgTitle" column="msg_title" />
  9. <result property="msgType" column="msg_type" />
  10. <result property="msgContent" column="msg_content" />
  11. <result property="status" column="status" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="userId" column="user_id" />
  15. <result property="isRead" column="is_read" />
  16. <result property="remark" column="remark" />
  17. <result property="delFlag" column="del_flag" />
  18. </resultMap>
  19. <sql id="selectSysMessageVo">
  20. select d.id, d.msg_title, d.msg_type, d.msg_content, d.status, d.create_by, d.create_time, d.user_id, d.is_read, d.remark from sys_message d
  21. </sql>
  22. <select id="selectSysMessageList" parameterType="SysMessage" resultMap="SysMessageResult">
  23. <include refid="selectSysMessageVo"/>
  24. <where>
  25. <if test="msgTitle != null and msgTitle != ''"> and msg_title = #{msgTitle}</if>
  26. <if test="msgType != null and msgType != ''"> and msg_type = #{msgType}</if>
  27. <if test="msgContent != null and msgContent != ''"> and msg_content = #{msgContent}</if>
  28. <if test="status != null and status != ''"> and status = #{status}</if>
  29. <if test="userId != null "> and user_id = #{userId}</if>
  30. <if test="isRead != null "> and is_read = #{isRead}</if>
  31. and d.del_flag = 0
  32. </where>
  33. order by d.create_time desc
  34. </select>
  35. <select id="selectSysMessageById" parameterType="Long" resultMap="SysMessageResult">
  36. <include refid="selectSysMessageVo"/>
  37. where id = #{id}
  38. </select>
  39. <insert id="insertSysMessage" parameterType="SysMessage">
  40. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  41. SELECT seq_sys_message.NEXTVAL as id FROM DUAL
  42. </selectKey>
  43. insert into sys_message
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="id != null">id,</if>
  46. <if test="msgTitle != null and msgTitle != ''">msg_title,</if>
  47. <if test="msgType != null and msgType != ''">msg_type,</if>
  48. <if test="msgContent != null">msg_content,</if>
  49. <if test="status != null">status,</if>
  50. <if test="createBy != null">create_by,</if>
  51. <if test="createTime != null">create_time,</if>
  52. <if test="userId != null">user_id,</if>
  53. <if test="isRead != null">is_read,</if>
  54. <if test="remark != null">remark,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="id != null">#{id},</if>
  58. <if test="msgTitle != null and msgTitle != ''">#{msgTitle},</if>
  59. <if test="msgType != null and msgType != ''">#{msgType},</if>
  60. <if test="msgContent != null">#{msgContent},</if>
  61. <if test="status != null">#{status},</if>
  62. <if test="createBy != null">#{createBy},</if>
  63. <if test="createTime != null">#{createTime},</if>
  64. <if test="userId != null">#{userId},</if>
  65. <if test="isRead != null">#{isRead},</if>
  66. <if test="remark != null">#{remark},</if>
  67. </trim>
  68. </insert>
  69. <update id="updateSysMessage" parameterType="SysMessage">
  70. update sys_message
  71. <trim prefix="SET" suffixOverrides=",">
  72. <if test="msgTitle != null and msgTitle != ''">msg_title = #{msgTitle},</if>
  73. <if test="msgType != null and msgType != ''">msg_type = #{msgType},</if>
  74. <if test="msgContent != null">msg_content = #{msgContent},</if>
  75. <if test="status != null">status = #{status},</if>
  76. <if test="createBy != null">create_by = #{createBy},</if>
  77. <if test="createTime != null">create_time = #{createTime},</if>
  78. <if test="userId != null">user_id = #{userId},</if>
  79. <if test="isRead != null">is_read = #{isRead},</if>
  80. <if test="remark != null">remark = #{remark},</if>
  81. </trim>
  82. where id = #{id}
  83. </update>
  84. <update id="deleteSysMessageById" parameterType="Long">
  85. update sys_message set del_flag = 2 where id = #{id}
  86. </update>
  87. <update id="deleteSysMessageByIds" parameterType="String">
  88. update sys_message set del_flag = 2 where id in
  89. <foreach item="id" collection="array" open="(" separator="," close=")">
  90. #{id}
  91. </foreach>
  92. </update>
  93. </mapper>