RemoteReminderMapper.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE mapper
  2. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.bosshand.virgo.api.dao.RemoteReminderDao">
  5. <resultMap type="com.bosshand.virgo.api.model.RemoteReminder" id="result">
  6. <id column="id" property="id"/>
  7. <result column="code" property="code"/>
  8. <result column="organizationId" property="organizationId"/>
  9. <result column="projectId" property="projectId"/>
  10. <result column="type" property="type"/>
  11. <result column="date" property="date"/>
  12. <result column="userList" property="userList"/>
  13. <result column="deviceIds" property="deviceIds"/>
  14. <result column="data" property="data"/>
  15. </resultMap>
  16. <select id="get" resultMap="result">
  17. SELECT * FROM remote_reminder where id = #{id}
  18. </select>
  19. <select id="getList" resultMap="result">
  20. select * from remote_reminder
  21. <where>
  22. <if test="id != 0">
  23. and id = #{id}
  24. </if>
  25. <if test="organizationId != 0">
  26. and organizationId = #{organizationId}
  27. </if>
  28. <if test="projectId != 0">
  29. and projectId = #{projectId}
  30. </if>
  31. <if test="type != null">
  32. and type = #{type}
  33. </if>
  34. <if test="date != null">
  35. and date = #{date}
  36. </if>
  37. <if test="deviceIds != null">
  38. and deviceIds = #{deviceIds}
  39. </if>
  40. </where>
  41. </select>
  42. <insert id="insert" useGeneratedKeys="true" keyProperty="id">
  43. INSERT INTO remote_reminder (`code`, `organizationId`, `projectId`, `type`, `date`, `userList`, `deviceIds`, `data`)
  44. VALUES (#{code}, #{organizationId}, #{projectId}, #{type}, #{date}, #{userList}, #{deviceIds}, #{data})
  45. </insert>
  46. <update id="delete">
  47. DELETE FROM remote_reminder WHERE id = #{id}
  48. </update>
  49. <update id="update" parameterType="com.bosshand.virgo.api.model.RemoteReminder">
  50. UPDATE remote_reminder
  51. <trim prefix="set" suffixOverrides=",">
  52. <if test="organizationId!=0">organizationId=#{organizationId},</if>
  53. <if test="projectId!=0">projectId=#{projectId},</if>
  54. <if test="type!=null">type=#{type},</if>
  55. <if test="date!=null">date=#{date},</if>
  56. <if test="userList!=null">userList=#{userList},</if>
  57. <if test="deviceIds!=null">deviceIds=#{deviceIds},</if>
  58. <if test="data!=null">data=#{data},</if>
  59. </trim>
  60. WHERE id=#{id}
  61. </update>
  62. <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.RemoteReminder" resultType="Integer">
  63. SELECT count(*) FROM remote_reminder
  64. <where>
  65. <if test="id != 0">
  66. and id = #{id}
  67. </if>
  68. <if test="organizationId != 0">
  69. and organizationId = #{organizationId}
  70. </if>
  71. <if test="projectId != 0">
  72. and projectId = #{projectId}
  73. </if>
  74. <if test="type != null">
  75. and type = #{type}
  76. </if>
  77. <if test="date != null">
  78. and date = #{date}
  79. </if>
  80. </where>
  81. </select>
  82. <select id="getLimit" resultMap="result">
  83. SELECT a.* FROM remote_reminder a
  84. <where>
  85. <if test="p.id != 0">
  86. and a.id = #{p.id}
  87. </if>
  88. <if test="p.organizationId != 0">
  89. and a.organizationId = #{p.organizationId}
  90. </if>
  91. <if test="p.projectId != 0">
  92. and a.projectId = #{p.projectId}
  93. </if>
  94. <if test="p.type != null">
  95. and a.type = #{p.type}
  96. </if>
  97. <if test="p.date != null">
  98. and a.date = #{p.date}
  99. </if>
  100. </where>
  101. limit #{currIndex} , #{pageSize}
  102. </select>
  103. <select id="projectCount" parameterType="com.bosshand.virgo.api.model.RemoteReminder" resultType="Integer">
  104. SELECT count(*) FROM remote_reminder where projectId = #{projectId}
  105. </select>
  106. </mapper>