| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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.WatchDeviceAccountMapper">
- <resultMap type="WatchDeviceAccount" id="WatchDeviceAccountResult">
- <result property="id" column="id" />
- <result property="deviceId" column="device_id" />
- <result property="account" column="account" />
- <result property="password" column="password" />
- </resultMap>
- <sql id="selectWatchDeviceAccountVo">
- select id, device_id, account, password from watch_device_account
- </sql>
- <select id="selectWatchDeviceAccountList" parameterType="WatchDeviceAccount" resultMap="WatchDeviceAccountResult">
- <include refid="selectWatchDeviceAccountVo"/>
- <where>
- <if test="deviceId != null "> and device_id = #{deviceId}</if>
- <if test="account != null and account != ''"> and account = #{account}</if>
- <if test="password != null and password != ''"> and password = #{password}</if>
- </where>
- </select>
- <select id="selectWatchDeviceAccountById" parameterType="Long" resultMap="WatchDeviceAccountResult">
- <include refid="selectWatchDeviceAccountVo"/>
- where id = #{id}
- </select>
- <select id="selectWatchDeviceAccountByDeviceId" resultType="com.fs.watch.domain.WatchDeviceAccount">
- <include refid="selectWatchDeviceAccountVo"/>
- where device_id like #{deviceId}
- </select>
- <insert id="insertWatchDeviceAccount" parameterType="WatchDeviceAccount" useGeneratedKeys="true" keyProperty="id">
- insert into watch_device_account
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="deviceId != null">device_id,</if>
- <if test="account != null">account,</if>
- <if test="password != null">password,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="deviceId != null">#{deviceId},</if>
- <if test="account != null">#{account},</if>
- <if test="password != null">#{password},</if>
- </trim>
- </insert>
- <update id="updateWatchDeviceAccount" parameterType="WatchDeviceAccount">
- update watch_device_account
- <trim prefix="SET" suffixOverrides=",">
- <if test="deviceId != null">device_id = #{deviceId},</if>
- <if test="account != null">account = #{account},</if>
- <if test="password != null">password = #{password},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteWatchDeviceAccountById" parameterType="Long">
- delete from watch_device_account where id = #{id}
- </delete>
- <delete id="deleteWatchDeviceAccountByIds" parameterType="String">
- delete from watch_device_account where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|