移风店镇项目初始化
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.
 
 
 
 
 

132 lines
3.8 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.epmet.modules.topic.dao.ResiTopicAttachmentDao">
<insert id="insertOne" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.modules.topic.entity.ResiTopicAttachmentEntity">
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE">
select replace(uuid(),'-','') AS ID
</selectKey>
INSERT INTO resi_topic_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test ='null != topicId'>
topic_id,
</if>
<if test ='null != attachmentName'>
attachment_name,
</if>
<if test ='null != attachmentFormat'>
attachment_format,
</if>
<if test ='null != attachmentType'>
attachment_type,
</if>
<if test ='null != attachmentUrl'>
attachment_url,
</if>
<if test='null != sort'>
sort,
</if>
<if test ='null != createdBy'>
created_by,
</if>
del_flag,
revision,
created_time,
updated_by,
updated_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id},
<if test ='null != topicId'>
#{topicId},
</if>
<if test ='null != attachmentName'>
#{attachmentName},
</if>
<if test ='null != attachmentFormat'>
#{attachmentFormat},
</if>
<if test ='null != attachmentType'>
#{attachmentType},
</if>
<if test ='null != attachmentUrl'>
#{attachmentUrl},
</if>
<if test='null != sort'>
#{sort},
</if>
<if test ='null != createdBy'>
#{createdBy},
</if>
'0',
'0',
now(),
'APP_USER',
now()
</trim>
</insert>
<!-- 批量插入 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into resi_topic_attachment
(
id,
topic_id,
attachment_name,
attachment_format,
attachment_type,
attachment_url,
del_flag,
revision,
sort,
duration,
created_by,
created_time,
updated_by,
updated_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.topicId},
#{item.attachmentName},
#{item.attachmentFormat},
#{item.attachmentType},
#{item.attachmentUrl},
#{item.delFlag},
#{item.revision},
#{item.sort},
#{item.duration},
#{item.createdBy},
now(),
#{item.updatedBy},
#{item.updatedTime}
)
</foreach>
</insert>
<select id="selectTopicAttachmentList" resultType="com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO">
SELECT
topic_id,
attachment_name,
attachment_format,
attachment_type,
attachment_url,
sort,
duration
FROM
resi_topic_attachment
WHERE
del_flag = '0'
AND topic_id = #{topicId}
ORDER BY
attachment_type ASC, sort ASC
</select>
</mapper>