From c03e1d823eb86c856ecbe40d8d2180ffce7c7b0f Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 14 十一月 2025 17:45:39 +0800
Subject: [PATCH] 2025.11.14 新增值域的增删改接口
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
index 9baf7f1..a560f0b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
@@ -1,6 +1,8 @@
package cn.flightfeather.supervision.lightshare.service.impl
+import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
import cn.flightfeather.supervision.domain.ds1.mapper.DomainitemMapper
import cn.flightfeather.supervision.lightshare.service.DomainitemService
@@ -45,7 +47,7 @@
val domainitemVoList = mutableListOf<DomainitemVo>()
val domainitem = Domainitem()
domainitem.dcguid = guid
- val domainitemList = domainitemMapper.select(domainitem)
+ val domainitemList = domainitemMapper.select(domainitem).also { it.sortBy { it1 -> it1.index } }
domainitemList.forEach {
val domainitemVo = DomainitemVo()
BeanUtils.copyProperties(it, domainitemVo)
@@ -74,9 +76,29 @@
return domainitemVoList
}
- override fun save(domainitem: Domainitem): Int = domainitemMapper.insert(domainitem)
+ override fun save(domainitem: Domainitem): Domainitem{
+ if (domainitem.guid == null) {
+ domainitem.guid = UUIDGenerator.generate16ShortUUID()
+ }
+ return if (domainitemMapper.insert(domainitem) == 1) {
+ domainitem
+ } else {
+ throw BizException("鍊煎煙椤规柊澧炲け璐�")
+ }
+ }
- override fun update(domainitem: Domainitem): Int = domainitemMapper.updateByPrimaryKey(domainitem)
+ override fun update(domainitem: Domainitem): Domainitem {
+ // 2025.11.11 鏂板鐗堟湰鍙峰姣旈�昏緫锛岃嫢鏇存柊鐨勯厤缃俊鎭増鏈彿绛変簬鏁版嵁鍘嗗彶鐗堟湰鍙凤紝鎵嶈兘鏇存柊
+ val oldOne = domainitemMapper.selectByPrimaryKey(domainitem.guid)
+ if ((domainitem.remark == oldOne.remark)) {
+ // 鏇存柊鏃讹紝鐗堟湰鍙烽�掑
+ domainitem.remark = domainitem.remark?.toInt()?.plus(1)?.toString() ?: "1"
+ domainitemMapper.updateByPrimaryKey(domainitem)
+ } else {
+ throw BizException("鍊煎煙椤规洿鏂板け璐ワ紝鐗堟湰鍙蜂笉涓�鑷�")
+ }
+ return domainitem
+ }
override fun delete(id: String): Int = domainitemMapper.deleteByPrimaryKey(id)
--
Gitblit v1.9.3