Initial project
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?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.blog.mapper.ArticleMapper">
|
||||
<sql id="table">article</sql>
|
||||
|
||||
<!-- 查询列表的文章字段 -->
|
||||
<sql id="listColumn">
|
||||
article.id,
|
||||
article.type,
|
||||
article.title,
|
||||
article.digest,
|
||||
article.likes,
|
||||
article.reads,
|
||||
article.created_at,
|
||||
article.updated_at
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 主页列表 -->
|
||||
<sql id="normalCondition">
|
||||
FROM
|
||||
article
|
||||
WHERE
|
||||
1 < article.id
|
||||
AND article.deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="count" resultType="long">
|
||||
SELECT COUNT(1) <include refid="normalCondition" />
|
||||
</select>
|
||||
<select id="list" resultType="com.imyeyu.server.modules.blog.entity.Article">
|
||||
SELECT
|
||||
<include refid="listColumn" />
|
||||
<include refid="normalCondition" />
|
||||
ORDER BY
|
||||
COALESCE(article.updated_at, article.created_at) DESC
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据关键字获取列表 -->
|
||||
<sql id="byKeywordCondition">
|
||||
FROM
|
||||
article
|
||||
WHERE
|
||||
1 < article.id
|
||||
AND (
|
||||
article.title LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR article.digest LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
AND article.deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="countByKeyword" resultType="long">
|
||||
SELECT COUNT(1) <include refid="byKeywordCondition" />
|
||||
</select>
|
||||
<select id="selectByKeyword" resultType="com.imyeyu.server.modules.blog.entity.Article">
|
||||
SELECT
|
||||
<include refid="listColumn" />
|
||||
<include refid="byKeywordCondition" />
|
||||
ORDER BY
|
||||
COALESCE(article.updated_at, article.created_at) DESC
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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.common.mapper.AttachmentMapper">
|
||||
<sql id="table">attachment</sql>
|
||||
<select id="listByAttachType" resultType="com.imyeyu.server.modules.common.entity.Attachment">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
biz_type = #{bizType}
|
||||
AND biz_id = #{bizId}
|
||||
<if test="attachTypes != null and 0 < attachTypes.length">
|
||||
AND attach_type IN
|
||||
<foreach collection="attachTypes" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
AND deleted_at IS NULL
|
||||
AND destroy_at IS NULL
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,143 @@
|
||||
<?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.common.mapper.CommentMapper">
|
||||
<sql id="table">comment</sql>
|
||||
<!-- 主评论 -->
|
||||
<select id="list" resultMap="listResult">
|
||||
SELECT
|
||||
-- 主评论
|
||||
comment.id,
|
||||
comment.biz_type,
|
||||
comment.biz_id,
|
||||
comment.user_id,
|
||||
comment.nick,
|
||||
comment.content,
|
||||
comment.created_at,
|
||||
|
||||
-- 回复数量
|
||||
reply_count.reply_length,
|
||||
|
||||
-- 回复
|
||||
reply.id AS reply_id,
|
||||
reply.comment_id,
|
||||
reply.sender_id,
|
||||
reply.sender_nick,
|
||||
reply.receiver_id,
|
||||
reply.receiver_nick,
|
||||
reply.content AS reply_content,
|
||||
reply.created_at AS reply_created_at
|
||||
FROM (
|
||||
-- 查询主评论
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
biz_type = #{bizType}
|
||||
AND biz_id = #{bizId}
|
||||
AND deleted_at IS NULL
|
||||
ORDER BY
|
||||
created_at ${orderMap.createdAt}
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
) AS comment
|
||||
LEFT JOIN (
|
||||
-- 查询前 6 条回复(时间升序)
|
||||
SELECT
|
||||
*
|
||||
FROM (
|
||||
SELECT
|
||||
comment_reply.*,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY comment_id
|
||||
ORDER BY created_at ASC
|
||||
) AS seq
|
||||
FROM
|
||||
comment_reply
|
||||
WHERE
|
||||
deleted_at IS NULL
|
||||
) AS reply
|
||||
WHERE
|
||||
seq < 7
|
||||
) AS reply
|
||||
ON
|
||||
reply.comment_id = comment.id
|
||||
LEFT JOIN(
|
||||
-- 统计回复总数
|
||||
SELECT
|
||||
comment_id AS id,
|
||||
COUNT(*) AS reply_length
|
||||
FROM
|
||||
comment_reply
|
||||
WHERE
|
||||
deleted_at IS NULL
|
||||
GROUP BY
|
||||
comment_id
|
||||
) AS reply_count
|
||||
ON
|
||||
reply_count.id = comment.id
|
||||
</select>
|
||||
<resultMap id="listResult" type="com.imyeyu.server.modules.common.vo.comment.CommentView">
|
||||
<id property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="nick" column="nick" />
|
||||
<result property="content" column="content" />
|
||||
<result property="repliesLength" column="reply_length" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<!-- 关联回复 -->
|
||||
<collection property="replies" ofType="com.imyeyu.server.modules.common.vo.comment.CommentReplyView">
|
||||
<id property="id" column="reply_id" />
|
||||
<result property="commentId" column="comment_id" />
|
||||
<result property="senderId" column="sender_id" />
|
||||
<result property="senderNick" column="sender_nick" />
|
||||
<result property="receiverId" column="receiver_id" />
|
||||
<result property="receiverNick" column="receiver_nick" />
|
||||
<result property="content" column="reply_content" />
|
||||
<result property="createdAt" column="reply_created_at" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="countAll" resultType="long">
|
||||
SELECT
|
||||
SUM(result.total_comment + result.total_reply)
|
||||
FROM (
|
||||
SELECT
|
||||
COUNT(DISTINCT comment.id) AS total_comment,
|
||||
COUNT(comment_reply.comment_id) AS total_reply
|
||||
FROM
|
||||
comment
|
||||
LEFT JOIN
|
||||
comment_reply
|
||||
ON
|
||||
comment_reply.comment_id = comment.id
|
||||
WHERE
|
||||
comment.biz_type = #{bizType}
|
||||
AND comment.biz_id = #{bizId}
|
||||
AND comment.deleted_at IS NULL
|
||||
AND comment_reply.deleted_at IS NULL
|
||||
) AS result
|
||||
</select>
|
||||
|
||||
<sql id="byUserIdCondition">
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
AND deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="countByUserId" resultType="long">
|
||||
SELECT COUNT(1) <include refid="byUserIdCondition" />
|
||||
</select>
|
||||
<select id="listByUserId" resultType="com.imyeyu.server.modules.common.vo.comment.CommentView">
|
||||
SELECT
|
||||
id,
|
||||
biz_type,
|
||||
biz_id,
|
||||
content,
|
||||
created_at
|
||||
<include refid="byUserIdCondition" />
|
||||
ORDER BY
|
||||
created_at ${orderMap.createdAt}
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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.common.mapper.IconMapper">
|
||||
<sql id="table">icon</sql>
|
||||
<!-- 根据标签获取部分 -->
|
||||
<sql id="byLabel">
|
||||
FROM (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
icon_labels
|
||||
WHERE
|
||||
${lang} LIKE CONCAT('%', #{label}, '%')
|
||||
AND icon_labels.deleted_at IS NULL
|
||||
) AS labels
|
||||
LEFT JOIN
|
||||
icon_label
|
||||
ON
|
||||
icon_label.icon_label_id = labels.id
|
||||
AND labels.id IS NOT NULL
|
||||
LEFT JOIN
|
||||
<include refid="table" />
|
||||
ON
|
||||
icon.id = icon_label.icon_id
|
||||
WHERE
|
||||
icon.id IS NOT NULL
|
||||
AND icon.deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="countByLabel" resultType="long">
|
||||
SELECT COUNT(1) <include refid="byLabel" />
|
||||
</select>
|
||||
<select id="listByLabel" resultType="com.imyeyu.server.modules.common.entity.Icon">
|
||||
SELECT icon.* <include refid="byLabel" /> LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?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.common.mapper.MultilingualMapper">
|
||||
<select id="selectByKeyList" resultType="com.imyeyu.server.modules.common.entity.Multilingual">
|
||||
SELECT * FROM multilingual WHERE key IN
|
||||
<foreach collection='keys' item='item' open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
AND deleted_at IS NULL
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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.common.mapper.SettingMapper">
|
||||
<sql id="table">setting</sql>
|
||||
<select id="listByKeys">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
key IN
|
||||
<foreach collection="keys" item="key" open="(" separator="," close=")">
|
||||
#{key}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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.common.mapper.TaskMapper">
|
||||
<!-- 所有公开任务 -->
|
||||
<select id="listAll4Public" resultMap="findAll4PublicResult">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
digest,
|
||||
status,
|
||||
td.*
|
||||
FROM
|
||||
task
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
*
|
||||
FROM (
|
||||
-- 任务详情
|
||||
SELECT
|
||||
id AS detial_id,
|
||||
task_id,
|
||||
bizType,
|
||||
status AS tdStatus,
|
||||
digest AS tdDigest,
|
||||
created_at,
|
||||
ROW_NUMBER() OVER (PARTITION BY task_id ORDER BY created_at DESC) AS seq
|
||||
FROM
|
||||
task_detail
|
||||
WHERE
|
||||
deleted_at IS NULL
|
||||
) AS cr
|
||||
WHERE
|
||||
seq < 7
|
||||
) AS td
|
||||
ON
|
||||
td.task_id = task.id
|
||||
WHERE
|
||||
is_public = 1
|
||||
AND deleted_at IS NULL
|
||||
</select>
|
||||
<resultMap id="findAll4PublicResult" type="com.imyeyu.server.modules.common.entity.Task">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="digest" column="digest"/>
|
||||
<result property="status" column="status"/>
|
||||
<!-- 关联任务 -->
|
||||
<collection property="details" ofType="com.imyeyu.server.modules.common.entity.TaskDetail">
|
||||
<id property="id" column="detial_id"/>
|
||||
<result property="bizType" column="bizType"/>
|
||||
<result property="status" column="tdStatus"/>
|
||||
<result property="digest" column="tdDigest"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.common.mapper.UserConfigMapper">
|
||||
<sql id="table">user_config</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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.common.mapper.UserPrivacyMapper">
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.common.mapper.UserProfileMapper">
|
||||
<sql id="table">user_profile</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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.IssueMapper">
|
||||
<sql id="table">git_issue</sql>
|
||||
<sql id="pageCondition">
|
||||
repository_id = #{issuePage.repositoryId}
|
||||
<if test="issuePage.type != null">
|
||||
AND type = #{issuePage.type}
|
||||
</if>
|
||||
<if test="issuePage.status != null">
|
||||
AND status = #{issuePage.status}
|
||||
</if>
|
||||
<if test="issuePage.keyword != null and issuePage.keyword != ''">
|
||||
AND (
|
||||
title LIKE CONCAT('%', #{issuePage.keyword}, '%')
|
||||
OR description LIKE CONCAT('%', #{issuePage.keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
AND deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="countByIssuePage" resultType="long">
|
||||
SELECT COUNT(1) FROM <include refid="table" /> WHERE <include refid="pageCondition" />
|
||||
</select>
|
||||
<select id="listByIssuePage" resultType="com.imyeyu.server.modules.git.entity.Issue">
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
type,
|
||||
status,
|
||||
created_at
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
<include refid="pageCondition" />
|
||||
ORDER BY
|
||||
COALESCE(updated_at, created_at) DESC
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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.MergeMapper">
|
||||
<sql id="table">git_merge</sql>
|
||||
<sql id="pageCondition">
|
||||
repository_id = #{mergePage.repositoryId}
|
||||
<if test="mergePage.type != null">
|
||||
AND type = #{mergePage.type}
|
||||
</if>
|
||||
<if test="mergePage.status != null">
|
||||
AND status = #{mergePage.status}
|
||||
</if>
|
||||
<if test="mergePage.keyword != null and mergePage.keyword != ''">
|
||||
AND (
|
||||
title LIKE CONCAT('%', #{mergePage.keyword}, '%')
|
||||
OR description LIKE CONCAT('%', #{mergePage.keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
AND deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="countByMergePage" resultType="long">
|
||||
SELECT COUNT(1) FROM <include refid="table" /> WHERE <include refid="pageCondition" />
|
||||
</select>
|
||||
<select id="listByMergePage" resultType="com.imyeyu.server.modules.git.entity.Merge">
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
type,
|
||||
status,
|
||||
created_at
|
||||
FROM
|
||||
<include refid="table" />
|
||||
WHERE
|
||||
<include refid="pageCondition" />
|
||||
ORDER BY
|
||||
COALESCE(updated_at, created_at) DESC
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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.gitea.mapper.ActionMapper">
|
||||
<select id="count" resultType="long">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
action
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="repoId != null">
|
||||
AND action.repo_id = #{repoId}
|
||||
</if>
|
||||
<if test="branch != null">
|
||||
AND action.ref_name LIKE CONCAT('%', #{branch})
|
||||
</if>
|
||||
<if test="operation != null">
|
||||
AND action.op_type = #{operation.value}
|
||||
</if>
|
||||
</select>
|
||||
<select id="list" resultType="com.imyeyu.server.modules.gitea.bean.ActionLogDTO">
|
||||
SELECT
|
||||
repository.id AS repo_id,
|
||||
repository.name AS repo_name,
|
||||
operator.id AS operator_id,
|
||||
action.ref_name,
|
||||
action.content,
|
||||
action.created_unix * 1000 AS operatedAt
|
||||
FROM
|
||||
action
|
||||
INNER JOIN
|
||||
repository ON action.repo_id = repository.id
|
||||
INNER JOIN
|
||||
user AS operator ON action.act_user_id = operator.id
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="repoId != null">
|
||||
AND action.repo_id = #{repoId}
|
||||
</if>
|
||||
<if test="branch != null">
|
||||
AND action.ref_name LIKE CONCAT('%', #{branch})
|
||||
</if>
|
||||
<if test="operation != null">
|
||||
AND action.op_type = #{operation.value}
|
||||
</if>
|
||||
ORDER BY
|
||||
action.created_unix DESC,
|
||||
action.id DESC
|
||||
LIMIT
|
||||
#{offset}, #{limit}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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.minecraft.mapper.PackMapper">
|
||||
<!-- 获取 -->
|
||||
<select id="listPacks" resultMap="listPacksResult">
|
||||
SELECT
|
||||
pack.*,
|
||||
source.name AS sourceName,
|
||||
source.type AS sourceType,
|
||||
source.data AS sourceData,
|
||||
source.is_default
|
||||
FROM
|
||||
minecraft_pack AS pack
|
||||
LEFT JOIN
|
||||
minecraft_pack_source AS source
|
||||
ON
|
||||
source.pack_id = pack.id
|
||||
WHERE
|
||||
pack.deleted_at IS NULL
|
||||
AND source.deleted_at IS NULL
|
||||
ORDER BY
|
||||
pack.is_deprecated, pack.created_at DESC, source.order ASC
|
||||
</select>
|
||||
<resultMap id="listPacksResult" type="com.imyeyu.server.modules.minecraft.entity.MinecraftPack" autoMapping="true">
|
||||
<id property="id" column="id" />
|
||||
<collection property="sourceList" ofType="com.imyeyu.server.modules.minecraft.entity.MinecraftPackSource" autoMapping="false">
|
||||
<result property="name" column="sourceName" />
|
||||
<result property="type" column="sourceType" />
|
||||
<result property="data" column="sourceData" />
|
||||
<result property="isDefault" column="is_default" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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.minecraft.mapper.PlayerMapper">
|
||||
</mapper>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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.system.mapper.AsyncTaskMapper">
|
||||
<sql id="table">async_task</sql>
|
||||
<insert id="insert">
|
||||
INSERT INTO <include refid="table" /> (
|
||||
uuid,
|
||||
name,
|
||||
type,
|
||||
message,
|
||||
status,
|
||||
progress,
|
||||
can_pause,
|
||||
can_interrupt,
|
||||
is_periodical,
|
||||
cron,
|
||||
start_at,
|
||||
interrupt_at,
|
||||
error_at,
|
||||
died_at,
|
||||
created_at
|
||||
) VALUES (
|
||||
#{uuid},
|
||||
#{name},
|
||||
#{type},
|
||||
#{message},
|
||||
#{status},
|
||||
#{progress},
|
||||
#{canPause},
|
||||
#{canInterrupt},
|
||||
#{isPeriodical},
|
||||
#{cron},
|
||||
#{startAt},
|
||||
#{interruptAt},
|
||||
#{errorAt},
|
||||
#{diedAt},
|
||||
#{createdAt}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.imyeyu.server.modules.system.entity.AsyncTask">
|
||||
UPDATE
|
||||
<include refid="table" />
|
||||
SET
|
||||
name = #{name},
|
||||
type = #{type},
|
||||
message = #{message},
|
||||
status = #{status},
|
||||
progress = #{progress},
|
||||
start_at = #{startAt},
|
||||
interrupt_at = #{interruptAt},
|
||||
error_at = #{errorAt},
|
||||
died_at = #{diedAt}
|
||||
WHERE
|
||||
uuid = #{uuid}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user