IotUserMapper.xml 3.8 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.ruoyi.system.mapper.IotUserMapper">
    
    <resultMap type="IotUser" id="IotUserResult">
        <result property="create_time"    column="create_time"    />
        <result property="encryption_type"    column="encryption_type"    />
        <result property="id"    column="id"    />
        <result property="open_encryption"    column="open_encryption"    />
        <result property="password"    column="password"    />
        <result property="role_id"    column="role_id"    />
        <result property="salt"    column="salt"    />
        <result property="used"    column="used"    />
        <result property="username"    column="username"    />
    </resultMap>

    <sql id="selectIotUserVo">
        select create_time, encryption_type, id, open_encryption, password, role_id, salt, used, username from iot_user
    </sql>

    <select id="selectIotUserList" parameterType="IotUser" resultMap="IotUserResult">
        <include refid="selectIotUserVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectIotUserById" parameterType="Integer" resultMap="IotUserResult">
        <include refid="selectIotUserVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertIotUser" parameterType="IotUser" useGeneratedKeys="true" keyProperty="id">
        insert into iot_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="create_time != null">create_time,</if>
            <if test="encryption_type != null">encryption_type,</if>
            <if test="open_encryption != null">open_encryption,</if>
            <if test="password != null and password != ''">password,</if>
            <if test="role_id != null">role_id,</if>
            <if test="salt != null">salt,</if>
            <if test="used != null">used,</if>
            <if test="username != null and username != ''">username,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="create_time != null">#{create_time},</if>
            <if test="encryption_type != null">#{encryption_type},</if>
            <if test="open_encryption != null">#{open_encryption},</if>
            <if test="password != null and password != ''">#{password},</if>
            <if test="role_id != null">#{role_id},</if>
            <if test="salt != null">#{salt},</if>
            <if test="used != null">#{used},</if>
            <if test="username != null and username != ''">#{username},</if>
         </trim>
    </insert>

    <update id="updateIotUser" parameterType="IotUser">
        update iot_user
        <trim prefix="SET" suffixOverrides=",">
            <if test="create_time != null">create_time = #{create_time},</if>
            <if test="encryption_type != null">encryption_type = #{encryption_type},</if>
            <if test="open_encryption != null">open_encryption = #{open_encryption},</if>
            <if test="password != null and password != ''">password = #{password},</if>
            <if test="role_id != null">role_id = #{role_id},</if>
            <if test="salt != null">salt = #{salt},</if>
            <if test="used != null">used = #{used},</if>
            <if test="username != null and username != ''">username = #{username},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIotUserById" parameterType="Integer">
        delete from iot_user where id = #{id}
    </delete>

    <delete id="deleteIotUserByIds" parameterType="String">
        delete from iot_user where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>