UserPhotoStorageMapper.xml 2.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
<?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.mapper.UserPhotoStorageMapper">

    <resultMap type="com.ruoyi.domain.UserPhotoStorage" id="UserPhotoStorageResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="username"    column="username"    />
        <result property="path"    column="path"    />
        <result property="createTime"    column="create_time"    />
        <result property="deleted"    column="deleted"    />
    </resultMap>

    <sql id="selectUserPhotoStorageVo">
        select id, user_id, username, path, create_time, deleted from t_user_photo_storage
    </sql>

    <select id="selectUserPhotoStorageList" parameterType="com.ruoyi.domain.UserPhotoStorage" resultMap="UserPhotoStorageResult">
        <include refid="selectUserPhotoStorageVo"/>
        <where>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
        </where>
    </select>

    <insert id="insertUserPhotoStorage" parameterType="com.ruoyi.domain.UserPhotoStorage">
        insert into t_user_photo_storage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="userId != null">user_id,</if>
            <if test="username != null">username,</if>
            <if test="path != null">path,</if>
            <if test="createTime != null">create_time,</if>
            <if test="deleted != null">deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="userId != null">#{userId},</if>
            <if test="username != null">#{username},</if>
            <if test="path != null">#{path},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="deleted != null">#{deleted},</if>
         </trim>
    </insert>

    <update id="updateUserPhotoStorage" parameterType="com.ruoyi.domain.UserPhotoStorage">
        update t_user_photo_storage
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="username != null">username = #{username},</if>
            <if test="path != null">path = #{path},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="deleted != null">deleted = #{deleted},</if>
        </trim>
        where id = #{id}
    </update>
</mapper>