50 lines
2.2 KiB
XML
50 lines
2.2 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.sercurityControl.decision.mapper.AttachMapper">
|
|
<select id="queryAttachByMd5" resultType="com.sercurityControl.decision.domain.Attachment">
|
|
select MD5,ID,FILE_NAME
|
|
from decision_attachment
|
|
where MD5 = #{md5} limit 1
|
|
</select>
|
|
|
|
<select id="getFileList" resultType="com.sercurityControl.decision.domain.Attachment">
|
|
select ID, FILE_NAME, MD5, UP_DATE
|
|
from decision_attachment
|
|
<where>
|
|
<if test="pkVal != null and pkVal != ''">and PK_VAL = #{pkVal}</if>
|
|
<if test="colName != null and colName != ''">and COL_NAME = #{colName}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getFile" resultType="com.sercurityControl.decision.domain.Attachment">
|
|
select ID, FILE_NAME, MD5, UP_DATE
|
|
from decision_attachment
|
|
<where>
|
|
<if test="pkVal != null and pkVal != ''">and PK_VAL = #{pkVal}</if>
|
|
<if test="colName != null and colName != ''">and COL_NAME = #{colName}</if>
|
|
</where>
|
|
limit 1
|
|
</select>
|
|
|
|
<delete id="deleteFileByPkValOrId">
|
|
delete from decision_attachment
|
|
<where>
|
|
<if test="pkVal != null and pkVal != ''">and PK_VAL = #{pkVal}</if>
|
|
<if test="id != null and id != ''">and ID = #{id}</if>
|
|
<if test="colName != null and colName != ''">and COL_NAME = #{colName}</if>
|
|
</where>
|
|
</delete>
|
|
|
|
<insert id="insertFileList" parameterType="com.sercurityControl.decision.domain.Attachment">
|
|
insert into decision_attachment (ID, `TABLE_NAME`, FILE_NAME, PK_VAL, MD5, COL_NAME, UP_DATE)
|
|
values
|
|
<foreach collection ="list" item="file" separator =",">
|
|
(#{file.id},#{file.tableName},#{file.fileName},#{file.pkVal},#{file.md5},#{file.colName},now())
|
|
</foreach >
|
|
</insert>
|
|
|
|
<insert id="insertFile">
|
|
insert into decision_attachment (ID, `TABLE_NAME`, FILE_NAME, PK_VAL, MD5, COL_NAME, UP_DATE)
|
|
values (#{id},#{tableName},#{fileName},#{pkVal},#{md5},#{colName},now())
|
|
</insert>
|
|
</mapper> |