JNBusinessTest/ruoyi-system/target/classes/mapper/expenses/ExpensesFileMapper.xml

64 lines
2.8 KiB
XML
Raw Normal View History

2024-08-13 11:26:46 +08:00
<?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.expenses.mapper.ExpensesFileMapper">
<resultMap type="ExpensesFile" id="ExpensesFileResult">
<result property="fileId" column="file_id" />
<result property="fileName" column="file_name" />
<result property="fileBucketName" column="file_bucket_name" />
<result property="fileUrl" column="file_url" />
<result property="fileSize" column="file_size" />
<result property="fileTime" column="file_time" />
<result property="fileType" column="file_type" />
<result property="relationId" column="relation_id" />
</resultMap>
<sql id="selectExpensesFileVo">
select file_id, file_name, file_bucket_name, file_url, file_size, file_time, file_type, relation_id from expenses_file
</sql>
<select id="selectExpensesFileList" parameterType="ExpensesFile" resultMap="ExpensesFileResult">
<include refid="selectExpensesFileVo"/>
<where>
and relation_id = #{relationId}
and file_type = #{fileType}
</where>
order by file_time desc
</select>
<select id="selectExpensesFileByFileId" parameterType="String" resultMap="ExpensesFileResult">
<include refid="selectExpensesFileVo"/>
where file_id = #{fileId}
</select>
<insert id="insertExpensesFile" parameterType="ExpensesFile">
insert into expenses_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fileId != null">file_id,</if>
<if test="fileName != null">file_name,</if>
<if test="fileBucketName != null">file_bucket_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="fileSize != null">file_size,</if>
<if test="fileTime != null">file_time,</if>
<if test="fileType != null">file_type,</if>
<if test="relationId != null">relation_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fileId != null">#{fileId},</if>
<if test="fileName != null">#{fileName},</if>
<if test="fileBucketName != null">#{fileBucketName},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="fileTime != null">#{fileTime},</if>
<if test="fileType != null">#{fileType},</if>
<if test="relationId != null">#{relationId},</if>
</trim>
</insert>
<delete id="deleteExpensesFileByFileId" parameterType="String">
delete from expenses_file where file_id = #{fileId}
</delete>
</mapper>