SmartUserDeviceMapper.xml 2.03 KB
<?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.glsx.smart.dao.mapper.SmartUserDeviceMapper">
    <resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartUserDevice">
        <!--@mbg.generated generated on Fri Apr 23 15:24:29 CST 2021.-->
        <!--@Table smart_user_device-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="user_id" jdbcType="BIGINT" property="userId"/>
        <result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
        <result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
        <result column="channel" jdbcType="TINYINT" property="channel"/>
        <result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
        <result column="platform_product_id" jdbcType="VARCHAR" property="platformProductId"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated generated on Fri Apr 23 15:24:29 CST 2021.-->
        id, user_id, device_id, device_name, channel, parent_id, platform_product_id, create_time,
        update_time
    </sql>

    <select id="getList" resultMap="BaseResultMap">
        select id, user_id, device_id, device_name, channel, parent_id, platform_product_id,
            create_time, update_time
        from smart_user_device
        <where>
            <if test="userId != null">
                and user_id = #{userId,jdbcType=BIGINT}
            </if>
        </where>
    </select>

    <delete id="deleteDevice">
        delete from smart_user_device
        <where>
            <if test="id != null">
                and id = #{id,jdbcType=BIGINT}
            </if>
            <if test="userId != null">
                and user_id = #{userId,jdbcType=BIGINT}
            </if>
        </where>
    </delete>
</mapper>