| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fs.watch.mapper.WatchFamilyUserMapper">
- <resultMap type="WatchFamilyUser" id="WatchFamilyUserResult">
- <result property="id" column="id" />
- <result property="watchUserId" column="watch_user_id" />
- <result property="phone" column="phone" />
- <result property="sex" column="sex" />
- <result property="birthday" column="birthday" />
- <result property="height" column="height" />
- <result property="weight" column="weight" />
- <result property="targetStep" column="target_step" />
- <result property="targetCalorie" column="target_calorie" />
- <result property="targetActivity" column="target_activity" />
- <result property="targetSport" column="target_sport" />
- <result property="deviceId" column="device_id" />
- <result property="monitorDataTypeOrder" column="monitor_data_type_order" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="isDel" column="is_del" />
- </resultMap>
- <sql id="selectWatchFamilyUserVo">
- 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
- </sql>
- <select id="selectWatchFamilyUserList" parameterType="WatchFamilyUser" resultMap="WatchFamilyUserResult">
- <include refid="selectWatchFamilyUserVo"/>
- <where>
- <if test="watchUserId != null "> and watch_user_id = #{watchUserId}</if>
- <if test="phone != null "> and phone = #{phone}</if>
- <if test="sex != null "> and sex = #{sex}</if>
- <if test="birthday != null "> and birthday = #{birthday}</if>
- <if test="height != null "> and height = #{height}</if>
- <if test="weight != null "> and weight = #{weight}</if>
- <if test="targetStep != null and targetStep != ''"> and target_step = #{targetStep}</if>
- <if test="targetCalorie != null and targetCalorie != ''"> and target_calorie = #{targetCalorie}</if>
- <if test="targetActivity != null and targetActivity != ''"> and target_activity = #{targetActivity}</if>
- <if test="targetSport != null and targetSport != ''"> and target_sport = #{targetSport}</if>
- <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
- <if test="monitorDataTypeOrder != null and monitorDataTypeOrder != ''"> and monitor_data_type_order = #{monitorDataTypeOrder}</if>
- <if test="isDel != null "> and is_del = #{isDel}</if>
- </where>
- </select>
- <select id="selectWatchFamilyUserById" parameterType="Long" resultMap="WatchFamilyUserResult">
- <include refid="selectWatchFamilyUserVo"/>
- where id = #{id}
- </select>
- <select id="selectWatchFamilyUserByDeviceId" resultMap="WatchFamilyUserResult">
- 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
- where device_id = #{deviceId}
- </select>
- <insert id="insertWatchFamilyUser" parameterType="WatchFamilyUser" useGeneratedKeys="true" keyProperty="id">
- insert into watch_family_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="watchUserId != null">watch_user_id,</if>
- <if test="phone != null">phone,</if>
- <if test="sex != null">sex,</if>
- <if test="birthday != null">birthday,</if>
- <if test="height != null">height,</if>
- <if test="weight != null">weight,</if>
- <if test="targetStep != null">target_step,</if>
- <if test="targetCalorie != null">target_calorie,</if>
- <if test="targetActivity != null">target_activity,</if>
- <if test="targetSport != null">target_sport,</if>
- <if test="deviceId != null">device_id,</if>
- <if test="monitorDataTypeOrder != null">monitor_data_type_order,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="isDel != null">is_del,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="watchUserId != null">#{watchUserId},</if>
- <if test="phone != null">#{phone},</if>
- <if test="sex != null">#{sex},</if>
- <if test="birthday != null">#{birthday},</if>
- <if test="height != null">#{height},</if>
- <if test="weight != null">#{weight},</if>
- <if test="targetStep != null">#{targetStep},</if>
- <if test="targetCalorie != null">#{targetCalorie},</if>
- <if test="targetActivity != null">#{targetActivity},</if>
- <if test="targetSport != null">#{targetSport},</if>
- <if test="deviceId != null">#{deviceId},</if>
- <if test="monitorDataTypeOrder != null">#{monitorDataTypeOrder},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="isDel != null">#{isDel},</if>
- </trim>
- </insert>
- <update id="updateWatchFamilyUser" parameterType="WatchFamilyUser">
- update watch_family_user
- <trim prefix="SET" suffixOverrides=",">
- <if test="watchUserId != null">watch_user_id = #{watchUserId},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="sex != null">sex = #{sex},</if>
- <if test="birthday != null">birthday = #{birthday},</if>
- <if test="height != null">height = #{height},</if>
- <if test="weight != null">weight = #{weight},</if>
- <if test="targetStep != null">target_step = #{targetStep},</if>
- <if test="targetCalorie != null">target_calorie = #{targetCalorie},</if>
- <if test="targetActivity != null">target_activity = #{targetActivity},</if>
- <if test="targetSport != null">target_sport = #{targetSport},</if>
- <if test="deviceId != null">device_id = #{deviceId},</if>
- <if test="monitorDataTypeOrder != null">monitor_data_type_order = #{monitorDataTypeOrder},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateWatchFamilyUserByDeviceId">
- update watch_family_user
- <trim prefix="SET" suffixOverrides=",">
- <if test="watchUserId != null">watch_user_id = #{watchUserId},</if>
- <if test="phone != null">phone = #{phone},</if>
- <if test="sex != null">sex = #{sex},</if>
- <if test="birthday != null">birthday = #{birthday},</if>
- <if test="height != null">height = #{height},</if>
- <if test="weight != null">weight = #{weight},</if>
- <if test="targetStep != null">target_step = #{targetStep},</if>
- <if test="targetCalorie != null">target_calorie = #{targetCalorie},</if>
- <if test="targetActivity != null">target_activity = #{targetActivity},</if>
- <if test="targetSport != null">target_sport = #{targetSport},</if>
- <if test="monitorDataTypeOrder != null">monitor_data_type_order = #{monitorDataTypeOrder},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- </trim>
- where device_id = #{deviceId}
- </update>
- <delete id="deleteWatchFamilyUserById" parameterType="Long">
- delete from watch_family_user where id = #{id}
- </delete>
- <delete id="deleteWatchFamilyUserByIds" parameterType="String">
- delete from watch_family_user where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|