WatchFamilyUserMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.watch.mapper.WatchFamilyUserMapper">
  6. <resultMap type="WatchFamilyUser" id="WatchFamilyUserResult">
  7. <result property="id" column="id" />
  8. <result property="watchUserId" column="watch_user_id" />
  9. <result property="phone" column="phone" />
  10. <result property="sex" column="sex" />
  11. <result property="birthday" column="birthday" />
  12. <result property="height" column="height" />
  13. <result property="weight" column="weight" />
  14. <result property="targetStep" column="target_step" />
  15. <result property="targetCalorie" column="target_calorie" />
  16. <result property="targetActivity" column="target_activity" />
  17. <result property="targetSport" column="target_sport" />
  18. <result property="deviceId" column="device_id" />
  19. <result property="monitorDataTypeOrder" column="monitor_data_type_order" />
  20. <result property="createTime" column="create_time" />
  21. <result property="updateTime" column="update_time" />
  22. <result property="isDel" column="is_del" />
  23. </resultMap>
  24. <sql id="selectWatchFamilyUserVo">
  25. select id, watch_user_id,phone, sex, birthday, height, weight, target_step, target_calorie, target_activity, target_sport, device_id, monitor_data_type_order, create_time, update_time, is_del from watch_family_user
  26. </sql>
  27. <select id="selectWatchFamilyUserList" parameterType="WatchFamilyUser" resultMap="WatchFamilyUserResult">
  28. <include refid="selectWatchFamilyUserVo"/>
  29. <where>
  30. <if test="watchUserId != null "> and watch_user_id = #{watchUserId}</if>
  31. <if test="phone != null "> and phone = #{phone}</if>
  32. <if test="sex != null "> and sex = #{sex}</if>
  33. <if test="birthday != null "> and birthday = #{birthday}</if>
  34. <if test="height != null "> and height = #{height}</if>
  35. <if test="weight != null "> and weight = #{weight}</if>
  36. <if test="targetStep != null and targetStep != ''"> and target_step = #{targetStep}</if>
  37. <if test="targetCalorie != null and targetCalorie != ''"> and target_calorie = #{targetCalorie}</if>
  38. <if test="targetActivity != null and targetActivity != ''"> and target_activity = #{targetActivity}</if>
  39. <if test="targetSport != null and targetSport != ''"> and target_sport = #{targetSport}</if>
  40. <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
  41. <if test="monitorDataTypeOrder != null and monitorDataTypeOrder != ''"> and monitor_data_type_order = #{monitorDataTypeOrder}</if>
  42. <if test="isDel != null "> and is_del = #{isDel}</if>
  43. </where>
  44. </select>
  45. <select id="selectWatchFamilyUserById" parameterType="Long" resultMap="WatchFamilyUserResult">
  46. <include refid="selectWatchFamilyUserVo"/>
  47. where id = #{id}
  48. </select>
  49. <select id="selectWatchFamilyUserByDeviceId" resultMap="WatchFamilyUserResult">
  50. select id, watch_user_id,phone, sex, birthday, height, weight, target_step, target_calorie, target_activity, target_sport, device_id, monitor_data_type_order, create_time, update_time, is_del
  51. from watch_family_user
  52. where device_id = #{deviceId}
  53. </select>
  54. <insert id="insertWatchFamilyUser" parameterType="WatchFamilyUser" useGeneratedKeys="true" keyProperty="id">
  55. insert into watch_family_user
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="watchUserId != null">watch_user_id,</if>
  58. <if test="phone != null">phone,</if>
  59. <if test="sex != null">sex,</if>
  60. <if test="birthday != null">birthday,</if>
  61. <if test="height != null">height,</if>
  62. <if test="weight != null">weight,</if>
  63. <if test="targetStep != null">target_step,</if>
  64. <if test="targetCalorie != null">target_calorie,</if>
  65. <if test="targetActivity != null">target_activity,</if>
  66. <if test="targetSport != null">target_sport,</if>
  67. <if test="deviceId != null">device_id,</if>
  68. <if test="monitorDataTypeOrder != null">monitor_data_type_order,</if>
  69. <if test="createTime != null">create_time,</if>
  70. <if test="updateTime != null">update_time,</if>
  71. <if test="isDel != null">is_del,</if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="watchUserId != null">#{watchUserId},</if>
  75. <if test="phone != null">#{phone},</if>
  76. <if test="sex != null">#{sex},</if>
  77. <if test="birthday != null">#{birthday},</if>
  78. <if test="height != null">#{height},</if>
  79. <if test="weight != null">#{weight},</if>
  80. <if test="targetStep != null">#{targetStep},</if>
  81. <if test="targetCalorie != null">#{targetCalorie},</if>
  82. <if test="targetActivity != null">#{targetActivity},</if>
  83. <if test="targetSport != null">#{targetSport},</if>
  84. <if test="deviceId != null">#{deviceId},</if>
  85. <if test="monitorDataTypeOrder != null">#{monitorDataTypeOrder},</if>
  86. <if test="createTime != null">#{createTime},</if>
  87. <if test="updateTime != null">#{updateTime},</if>
  88. <if test="isDel != null">#{isDel},</if>
  89. </trim>
  90. </insert>
  91. <update id="updateWatchFamilyUser" parameterType="WatchFamilyUser">
  92. update watch_family_user
  93. <trim prefix="SET" suffixOverrides=",">
  94. <if test="watchUserId != null">watch_user_id = #{watchUserId},</if>
  95. <if test="phone != null">phone = #{phone},</if>
  96. <if test="sex != null">sex = #{sex},</if>
  97. <if test="birthday != null">birthday = #{birthday},</if>
  98. <if test="height != null">height = #{height},</if>
  99. <if test="weight != null">weight = #{weight},</if>
  100. <if test="targetStep != null">target_step = #{targetStep},</if>
  101. <if test="targetCalorie != null">target_calorie = #{targetCalorie},</if>
  102. <if test="targetActivity != null">target_activity = #{targetActivity},</if>
  103. <if test="targetSport != null">target_sport = #{targetSport},</if>
  104. <if test="deviceId != null">device_id = #{deviceId},</if>
  105. <if test="monitorDataTypeOrder != null">monitor_data_type_order = #{monitorDataTypeOrder},</if>
  106. <if test="createTime != null">create_time = #{createTime},</if>
  107. <if test="updateTime != null">update_time = #{updateTime},</if>
  108. <if test="isDel != null">is_del = #{isDel},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <update id="updateWatchFamilyUserByDeviceId">
  113. update watch_family_user
  114. <trim prefix="SET" suffixOverrides=",">
  115. <if test="watchUserId != null">watch_user_id = #{watchUserId},</if>
  116. <if test="phone != null">phone = #{phone},</if>
  117. <if test="sex != null">sex = #{sex},</if>
  118. <if test="birthday != null">birthday = #{birthday},</if>
  119. <if test="height != null">height = #{height},</if>
  120. <if test="weight != null">weight = #{weight},</if>
  121. <if test="targetStep != null">target_step = #{targetStep},</if>
  122. <if test="targetCalorie != null">target_calorie = #{targetCalorie},</if>
  123. <if test="targetActivity != null">target_activity = #{targetActivity},</if>
  124. <if test="targetSport != null">target_sport = #{targetSport},</if>
  125. <if test="monitorDataTypeOrder != null">monitor_data_type_order = #{monitorDataTypeOrder},</if>
  126. <if test="createTime != null">create_time = #{createTime},</if>
  127. <if test="updateTime != null">update_time = #{updateTime},</if>
  128. <if test="isDel != null">is_del = #{isDel},</if>
  129. </trim>
  130. where device_id = #{deviceId}
  131. </update>
  132. <delete id="deleteWatchFamilyUserById" parameterType="Long">
  133. delete from watch_family_user where id = #{id}
  134. </delete>
  135. <delete id="deleteWatchFamilyUserByIds" parameterType="String">
  136. delete from watch_family_user where id in
  137. <foreach item="id" collection="array" open="(" separator="," close=")">
  138. #{id}
  139. </foreach>
  140. </delete>
  141. </mapper>