You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
reagent_manage/java/src/main/resources/mapper/RecAttachment.xml

45 lines
1.5 KiB

<?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.toesbieya.my.mapper.RecAttachmentMapper">
<select id="getByPid" resultType="com.toesbieya.my.model.entity.RecAttachment">
select *
from rec_attachment
where pid = #{pid}
order by sort desc
</select>
<select id="getUrlByPid" resultType="java.lang.String">
select url
from rec_attachment
where pid = #{pid}
</select>
<insert id="add" parameterType="com.toesbieya.my.model.entity.RecAttachment">
insert into rec_attachment (pid, name, time, sort, url,size)
VALUES
<foreach collection="list" item="i" separator=",">
(#{i.pid}, #{i.name}, #{i.time}, #{i.sort}, #{i.url},#{i.size})
</foreach>
</insert>
<delete id="del">
delete
from rec_attachment
where 0
<if test="id!=null">and id = #{id}</if>
<if test="pid!=null and pid!=''">and pid = #{pid}</if>
<if test="url!=null and url!=''">and url = #{url}</if>
</delete>
<delete id="delByUrls">
delete
from rec_attachment
where url in
<foreach collection="list" open="(" close=")" item="i" separator=",">
#{i}
</foreach>
</delete>
<delete id="delByPid">
delete
from rec_attachment
where pid = #{pid}
</delete>
</mapper>