43 lines
1.6 KiB
XML
43 lines
1.6 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.imyeyu.server.modules.git.mapper.ReleaseMapper">
|
|
<sql id="table">git_release</sql>
|
|
<select id="listByRepositoryId" resultMap="listByRepositoryIdResult">
|
|
SELECT
|
|
release.*,
|
|
attachment.id AS attachmentId,
|
|
attachment.biz_type,
|
|
attachment.biz_id,
|
|
attachment.lid_title,
|
|
attachment.name,
|
|
attachment.size
|
|
FROM
|
|
<include refid="table" /> AS release
|
|
LEFT JOIN
|
|
attachment
|
|
ON
|
|
attachment.biz_type = '${@com.imyeyu.timiserver.modules.common.entity.Attachment$BizType@GIT}'
|
|
AND attachment.biz_id = release.id
|
|
AND attachment.attach_type = '${@com.imyeyu.timiserver.modules.git.bean.AttachType@RELEASE}'
|
|
AND attachment.deleted_at IS NULL
|
|
WHERE
|
|
release.repository_id = #{repositoryId}
|
|
AND release.deleted_at IS NULL
|
|
ORDER BY
|
|
COALESCE(release.updated_at, release.created_at) DESC
|
|
LIMIT
|
|
#{offset}, #{limit}
|
|
</select>
|
|
<resultMap id="listByRepositoryIdResult" type="com.imyeyu.server.modules.git.vo.release.ReleaseView" autoMapping="true">
|
|
<id property="id" column="id" />
|
|
<!-- 关联附件 -->
|
|
<collection property="attachmentList" ofType="com.imyeyu.server.modules.common.vo.attachment.AttachmentView">
|
|
<id property="id" column="attachmentId" />
|
|
<result property="bizType" column="biz_type" />
|
|
<result property="bizId" column="biz_id" />
|
|
<result property="lidTitle" column="lid_title" />
|
|
<result property="name" column="name" />
|
|
<result property="size" column="size" />
|
|
</collection>
|
|
</resultMap>
|
|
</mapper> |