smart_archives_service/bonus-admin/src/main/resources/mapper/FileIndexMapper.xml

45 lines
1.7 KiB
XML

<?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.web.mapper.FileIndexMapper">
<insert id="add">
INSERT INTO da_ky_file_index
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="fileContent != null and fileContent != ''">file_content,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
<if test="saveDate != null">save_date,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="fileContent != null and fileContent != ''">#{fileContent},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="saveDate != null">#{saveDate},</if>
</trim>
</insert>
<update id="update">
UPDATE da_ky_file_index
<trim prefix="SET" suffixOverrides=",">
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="fileContent != null and fileContent != ''">file_content = #{fileContent},</if>
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
<if test="saveDate != null">save_date = #{saveDate},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="del">
DELETE FROM da_ky_file_index WHERE id = #{id}
</delete>
<select id="getList" resultType="com.bonus.web.domain.FileIndexDto">
select id,file_name,file_content,file_path,save_date from da_ky_file_index
<where>
<if test="fileName != null and fileName != ''">
and file_name like concat('%',#{fileName},'%')
</if>
</where>
</select>
</mapper>