Skip to content

Commit

Permalink
feat: 流水线页面 按名称A-Z 支持中文按拼音排序 TencentBlueKing#5100 补充创建编辑时保存拼音数据逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
hingbong committed Oct 18, 2021
1 parent 8551295 commit 70e5417
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ class PipelineInfoDao {
CREATOR,
LAST_MODIFY_USER,
MANUAL_STARTUP,
ELEMENT_SKIP, TASK_COUNT
ELEMENT_SKIP,
TASK_COUNT,
PIPELINE_NAME_PINYIN
)
.values(
pipelineId,
Expand All @@ -89,7 +91,8 @@ class PipelineInfoDao {
channelCode.name, userId, userId,
if (manualStartup) 1 else 0,
if (canElementSkip) 1 else 0,
taskCount
taskCount,
nameToPinyin(pipelineName)
)
.execute()
}
Expand Down Expand Up @@ -120,6 +123,7 @@ class PipelineInfoDao {

if (!pipelineName.isNullOrBlank()) {
update.set(PIPELINE_NAME, pipelineName)
update.set(PIPELINE_NAME_PINYIN, nameToPinyin(pipelineName))
}
if (!pipelineDesc.isNullOrBlank()) {
update.set(PIPELINE_DESC, pipelineDesc)
Expand Down Expand Up @@ -604,7 +608,7 @@ class PipelineInfoDao {
}

private fun nameToPinyin(pipelineName: String): String {
// 数据库字段长度1300
return PinyinUtil.toPinyin(pipelineName).take(1300)
val fieldLength = T_PIPELINE_INFO.PIPELINE_NAME_PINYIN.dataType.length()
return PinyinUtil.toPinyin(pipelineName).take(fieldLength)
}
}

0 comments on commit 70e5417

Please sign in to comment.