<?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>