search_tools_service/search-tool/src/main/resources/mapper/TbFileSourceMapper.xml

41 lines
2.1 KiB
XML
Raw Normal View History

<?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.bonus.tool.mapper.TbFileSourceMapper">
<insert id="addTbFileSource">
insert into tb_file_source
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableName != null and tableName != ''">table_name,</if>
<if test="tableId != null and tableId != ''">table_id,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
<if test="fileType != null and fileType != ''">file_type,</if>
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="fileSuffix != null and fileSuffix != ''">file_suffix,</if>
<if test="createTime != null ">create_time,</if>
<if test="uploadUser != null and uploadUser != ''">upload_user,</if>
del_flag
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableName != null and tableName != ''">#{tableName},</if>
<if test="tableId != null and tableId != ''">#{tableId},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="fileType != null and fileType != ''">#{fileType},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="fileSuffix != null and fileSuffix != ''">#{fileSuffix},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="uploadUser != null and uploadUser != ''">#{uploadUser},</if>
0
</trim>
</insert>
<delete id="delTbFileSource">
update tb_file_source set del_flag=1 where table_id = #{tableId} and table_name = #{tableName}
</delete>
<select id="getTbFileSourceList" resultType="com.bonus.tool.dto.TbFileSourceVo">
select id,table_name as tableName,table_id as tableId,file_path as filePath,file_type as fileType,
file_name as fileName,file_suffix as fileSuffix,create_time as createTime,upload_user as uploadUser
from tb_file_source where del_flag=0 and table_name = #{tableName} and table_id = #{tableId}
</select>
</mapper>