FsHealthDataMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.fs.his.mapper.FsHealthDataMapper">
  6. <resultMap type="FsHealthData" id="FsHealthDataResult">
  7. <result property="id" column="id" />
  8. <result property="userId" column="user_id" />
  9. <result property="weight" column="weight" />
  10. <result property="heartRate" column="heart_rate" />
  11. <result property="temperature" column="temperature" />
  12. <result property="bloodPressure" column="blood_pressure" />
  13. <result property="bloodSugar" column="blood_sugar" />
  14. <result property="uric" column="uric" />
  15. <result property="sleep" column="sleep" />
  16. <result property="step" column="step" />
  17. <result property="shit" column="shit" />
  18. <result property="mood" column="mood" />
  19. <result property="createTime" column="create_time" />
  20. </resultMap>
  21. <sql id="selectFsHealthDataVo">
  22. select id, user_id, weight, heart_rate, temperature, blood_pressure, blood_sugar, uric, sleep, step, shit, mood, create_time from fs_health_data
  23. </sql>
  24. <select id="selectFsHealthDataList" parameterType="FsHealthData" resultMap="FsHealthDataResult">
  25. <include refid="selectFsHealthDataVo"/>
  26. <where>
  27. <if test="userId != null "> and user_id = #{userId}</if>
  28. <if test="weight != null "> and weight = #{weight}</if>
  29. <if test="heartRate != null and heartRate != ''"> and heart_rate = #{heartRate}</if>
  30. <if test="temperature != null and temperature != ''"> and temperature = #{temperature}</if>
  31. <if test="bloodPressure != null and bloodPressure != ''"> and blood_pressure = #{bloodPressure}</if>
  32. <if test="bloodSugar != null and bloodSugar != ''"> and blood_sugar = #{bloodSugar}</if>
  33. <if test="uric != null and uric != ''"> and uric = #{uric}</if>
  34. <if test="sleep != null and sleep != ''"> and sleep = #{sleep}</if>
  35. <if test="step != null and step != ''"> and step = #{step}</if>
  36. <if test="shit != null and shit != ''"> and shit = #{shit}</if>
  37. <if test="mood != null and mood != ''"> and mood = #{mood}</if>
  38. </where>
  39. </select>
  40. <select id="selectFsHealthDataById" parameterType="Long" resultMap="FsHealthDataResult">
  41. <include refid="selectFsHealthDataVo"/>
  42. where id = #{id}
  43. </select>
  44. <insert id="insertFsHealthData" parameterType="FsHealthData" useGeneratedKeys="true" keyProperty="id">
  45. insert into fs_health_data
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="userId != null">user_id,</if>
  48. <if test="weight != null">weight,</if>
  49. <if test="heartRate != null">heart_rate,</if>
  50. <if test="temperature != null">temperature,</if>
  51. <if test="bloodPressure != null">blood_pressure,</if>
  52. <if test="bloodSugar != null">blood_sugar,</if>
  53. <if test="uric != null">uric,</if>
  54. <if test="sleep != null">sleep,</if>
  55. <if test="step != null">step,</if>
  56. <if test="shit != null">shit,</if>
  57. <if test="mood != null">mood,</if>
  58. <if test="createTime != null">create_time,</if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="userId != null">#{userId},</if>
  62. <if test="weight != null">#{weight},</if>
  63. <if test="heartRate != null">#{heartRate},</if>
  64. <if test="temperature != null">#{temperature},</if>
  65. <if test="bloodPressure != null">#{bloodPressure},</if>
  66. <if test="bloodSugar != null">#{bloodSugar},</if>
  67. <if test="uric != null">#{uric},</if>
  68. <if test="sleep != null">#{sleep},</if>
  69. <if test="step != null">#{step},</if>
  70. <if test="shit != null">#{shit},</if>
  71. <if test="mood != null">#{mood},</if>
  72. <if test="createTime != null">#{createTime},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateFsHealthData" parameterType="FsHealthData">
  76. update fs_health_data
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="userId != null">user_id = #{userId},</if>
  79. <if test="weight != null">weight = #{weight},</if>
  80. <if test="heartRate != null">heart_rate = #{heartRate},</if>
  81. <if test="temperature != null">temperature = #{temperature},</if>
  82. <if test="bloodPressure != null">blood_pressure = #{bloodPressure},</if>
  83. <if test="bloodSugar != null">blood_sugar = #{bloodSugar},</if>
  84. <if test="uric != null">uric = #{uric},</if>
  85. <if test="sleep != null">sleep = #{sleep},</if>
  86. <if test="step != null">step = #{step},</if>
  87. <if test="shit != null">shit = #{shit},</if>
  88. <if test="mood != null">mood = #{mood},</if>
  89. <if test="createTime != null">create_time = #{createTime},</if>
  90. </trim>
  91. where id = #{id}
  92. </update>
  93. <delete id="deleteFsHealthDataById" parameterType="Long">
  94. delete from fs_health_data where id = #{id}
  95. </delete>
  96. <delete id="deleteFsHealthDataByIds" parameterType="String">
  97. delete from fs_health_data where id in
  98. <foreach item="id" collection="array" open="(" separator="," close=")">
  99. #{id}
  100. </foreach>
  101. </delete>
  102. </mapper>