|
@@ -17,7 +17,14 @@ import java.util.*
|
|
*/
|
|
*/
|
|
object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
|
|
object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建之前操作
|
|
|
|
+ *
|
|
|
|
+ * @param entity 图例对象
|
|
|
|
+ * @return 是否执行
|
|
|
|
+ */
|
|
override fun onCreateBefore(entity: MeiKu): Boolean {
|
|
override fun onCreateBefore(entity: MeiKu): Boolean {
|
|
|
|
+ /** id 为空,赋值 */
|
|
if (entity.id.isNullOrEmpty()) {
|
|
if (entity.id.isNullOrEmpty()) {
|
|
entity.id = UUID.randomUUID().toString().replace("-", "")
|
|
entity.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
@@ -26,79 +33,121 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 保存
|
|
* 保存
|
|
|
|
+ *
|
|
|
|
+ * @param meiKu 图例对象
|
|
|
|
+ * @return 返回结果
|
|
*/
|
|
*/
|
|
fun save(meiKu: MeiKu): SCreateResponse<MeiKu> {
|
|
fun save(meiKu: MeiKu): SCreateResponse<MeiKu> {
|
|
|
|
+ /** 返回对象 */
|
|
val sCreateResponse = SCreateResponse<MeiKu>()
|
|
val sCreateResponse = SCreateResponse<MeiKu>()
|
|
return try {
|
|
return try {
|
|
|
|
+ /** id 为空赋值 */
|
|
if (meiKu.id.isNullOrEmpty()) {
|
|
if (meiKu.id.isNullOrEmpty()) {
|
|
meiKu.id = UUID.randomUUID().toString().replace("-", "")
|
|
meiKu.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
|
|
+ /** 插入数据 */
|
|
val insert = insert(meiKu)
|
|
val insert = insert(meiKu)
|
|
|
|
+ /** 锚点列表不为空 */
|
|
if (!meiKu.anchorList.isNullOrEmpty()) {
|
|
if (!meiKu.anchorList.isNullOrEmpty()) {
|
|
|
|
+ /** 遍历列表 */
|
|
for (anchor in meiKu.anchorList!!) {
|
|
for (anchor in meiKu.anchorList!!) {
|
|
|
|
+ /** 图例 id */
|
|
anchor.meiKuId = meiKu.id
|
|
anchor.meiKuId = meiKu.id
|
|
|
|
+ /** 锚点 id 为空赋值 */
|
|
if (anchor.id.isNullOrEmpty()) {
|
|
if (anchor.id.isNullOrEmpty()) {
|
|
anchor.id = UUID.randomUUID().toString().replace("-", "")
|
|
anchor.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
|
|
+ /** 插入锚点数据 */
|
|
val insert1 = MeiKuAnchorService.insert(anchor)
|
|
val insert1 = MeiKuAnchorService.insert(anchor)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** 状态 */
|
|
if (!meiKu.state .isNullOrEmpty()) {
|
|
if (!meiKu.state .isNullOrEmpty()) {
|
|
val stateList = meiKu.state
|
|
val stateList = meiKu.state
|
|
|
|
+ /** 遍历状态 */
|
|
for (state in stateList!!){
|
|
for (state in stateList!!){
|
|
|
|
+ /** 图例 id */
|
|
state!!.meiKuId = meiKu.id
|
|
state!!.meiKuId = meiKu.id
|
|
|
|
+ /** 状态 id 为空赋值 */
|
|
if (state!!.id.isNullOrEmpty()) {
|
|
if (state!!.id.isNullOrEmpty()) {
|
|
state!!.id = UUID.randomUUID().toString().replace("-", "")
|
|
state!!.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** 插入数据 */
|
|
MeiKuStateService.insert(state)
|
|
MeiKuStateService.insert(state)
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ /** 对象列表 */
|
|
sCreateResponse.entityList = arrayListOf(meiKu)
|
|
sCreateResponse.entityList = arrayListOf(meiKu)
|
|
|
|
+ /** 标志 */
|
|
sCreateResponse.result = SResponseType.success
|
|
sCreateResponse.result = SResponseType.success
|
|
|
|
+ /** 对象 */
|
|
sCreateResponse
|
|
sCreateResponse
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
e.printStackTrace()
|
|
e.printStackTrace()
|
|
sCreateResponse.result = SResponseType.failure
|
|
sCreateResponse.result = SResponseType.failure
|
|
sCreateResponse
|
|
sCreateResponse
|
|
}
|
|
}
|
|
- } // Fun save()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 单个对象修改,包括下面节点
|
|
* 单个对象修改,包括下面节点
|
|
|
|
+ *
|
|
|
|
+ * @param meiKu 图例对象
|
|
|
|
+ * @return 返回结果
|
|
*/
|
|
*/
|
|
fun revise(meiKu: MeiKu): SBaseResponse {
|
|
fun revise(meiKu: MeiKu): SBaseResponse {
|
|
|
|
+ /** 返回对象 */
|
|
val sBaseResponse = SBaseResponse()
|
|
val sBaseResponse = SBaseResponse()
|
|
return try {
|
|
return try {
|
|
|
|
+ /** 图例id不为空 */
|
|
if (!meiKu.id.isNullOrEmpty()) {
|
|
if (!meiKu.id.isNullOrEmpty()) {
|
|
|
|
+ /** 删除图例 */
|
|
delete(SFilter.eq("id", meiKu.id!!))
|
|
delete(SFilter.eq("id", meiKu.id!!))
|
|
|
|
+ /** 删除锚点 */
|
|
MeiKuAnchorService.delete(SFilter.eq("id", meiKu.id!!))
|
|
MeiKuAnchorService.delete(SFilter.eq("id", meiKu.id!!))
|
|
|
|
+ /** 删除状态 */
|
|
MeiKuStateService.delete(SFilter.eq("id", meiKu.id!!))
|
|
MeiKuStateService.delete(SFilter.eq("id", meiKu.id!!))
|
|
|
|
+ /** 插入数据 */
|
|
val insert = insert(meiKu)
|
|
val insert = insert(meiKu)
|
|
|
|
+ /** 锚点列表不为空 */
|
|
if (!meiKu.anchorList.isNullOrEmpty()){
|
|
if (!meiKu.anchorList.isNullOrEmpty()){
|
|
|
|
+ /** 遍历 */
|
|
for (anchor in meiKu.anchorList!!) {
|
|
for (anchor in meiKu.anchorList!!) {
|
|
|
|
+ /** 图例 id */
|
|
anchor.meiKuId = meiKu.id
|
|
anchor.meiKuId = meiKu.id
|
|
|
|
+ /** 锚点 id 为空赋值 */
|
|
if (anchor.id.isNullOrEmpty()) {
|
|
if (anchor.id.isNullOrEmpty()) {
|
|
anchor.id = UUID.randomUUID().toString().replace("-", "")
|
|
anchor.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
|
|
+ /** 插入 */
|
|
val insert1 = MeiKuAnchorService.insert(anchor)
|
|
val insert1 = MeiKuAnchorService.insert(anchor)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ /** 标志不为空 */
|
|
if (!meiKu.state.isNullOrEmpty()) {
|
|
if (!meiKu.state.isNullOrEmpty()) {
|
|
val stateList = meiKu.state
|
|
val stateList = meiKu.state
|
|
|
|
+ /** 遍历列表 */
|
|
for (state in stateList!!){
|
|
for (state in stateList!!){
|
|
|
|
+
|
|
state!!.meiKuId = meiKu.id
|
|
state!!.meiKuId = meiKu.id
|
|
|
|
+ /** 标志 id 为空赋值 */
|
|
if (state!!.id.isNullOrEmpty()) {
|
|
if (state!!.id.isNullOrEmpty()) {
|
|
state!!.id = UUID.randomUUID().toString().replace("-", "")
|
|
state!!.id = UUID.randomUUID().toString().replace("-", "")
|
|
}
|
|
}
|
|
|
|
+ /** 插入数据 */
|
|
val insert1 = MeiKuStateService.insert(state)
|
|
val insert1 = MeiKuStateService.insert(state)
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ /** 状态 */
|
|
sBaseResponse.result = SResponseType.success
|
|
sBaseResponse.result = SResponseType.success
|
|
} else {
|
|
} else {
|
|
|
|
+ /** 状态 */
|
|
sBaseResponse.result = SResponseType.failure
|
|
sBaseResponse.result = SResponseType.failure
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** 对象 */
|
|
sBaseResponse
|
|
sBaseResponse
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
e.printStackTrace()
|
|
e.printStackTrace()
|
|
@@ -106,14 +155,17 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
|
|
sBaseResponse.message = e.message.toString()
|
|
sBaseResponse.message = e.message.toString()
|
|
sBaseResponse
|
|
sBaseResponse
|
|
}
|
|
}
|
|
- } // Fun revise()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 清除节点
|
|
* 清除节点
|
|
*/
|
|
*/
|
|
override fun onDeleteSuccess(entityList: ArrayList<MeiKu>) {
|
|
override fun onDeleteSuccess(entityList: ArrayList<MeiKu>) {
|
|
|
|
+ /** 遍历清除的图例 */
|
|
for (entity in entityList){
|
|
for (entity in entityList){
|
|
|
|
+ /** 清除图例下的锚点 */
|
|
MeiKuAnchorService.delete(SFilter.eq("id", entity.id!!))
|
|
MeiKuAnchorService.delete(SFilter.eq("id", entity.id!!))
|
|
|
|
+ /** 清除图例下的状态 */
|
|
MeiKuStateService.delete(SFilter.eq("id", entity.id!!))
|
|
MeiKuStateService.delete(SFilter.eq("id", entity.id!!))
|
|
}
|
|
}
|
|
super.onDeleteSuccess(entityList)
|
|
super.onDeleteSuccess(entityList)
|
|
@@ -121,37 +173,53 @@ object MeiKuService : SObjectService<MeiKu>(SMybatisDao(MeiKu::class.java)) {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 读取图下面所有节点
|
|
* 读取图下面所有节点
|
|
|
|
+ *
|
|
|
|
+ * @param meiKu 图例对象
|
|
|
|
+ * @return 返回结果
|
|
*/
|
|
*/
|
|
fun read(meiKu: MeiKu): SCommonResponse<MeiKu> {
|
|
fun read(meiKu: MeiKu): SCommonResponse<MeiKu> {
|
|
|
|
+ /** 返回对象 */
|
|
val sQueryResponse = SCommonResponse<MeiKu>()
|
|
val sQueryResponse = SCommonResponse<MeiKu>()
|
|
return try {
|
|
return try {
|
|
|
|
+ /** 图例 id 不可以为空 */
|
|
if (!meiKu.id.isNullOrEmpty()){
|
|
if (!meiKu.id.isNullOrEmpty()){
|
|
|
|
+ /** 查询图例 */
|
|
val entity = select(SFilter.eq("id", meiKu.id!!)).entity()
|
|
val entity = select(SFilter.eq("id", meiKu.id!!)).entity()
|
|
|
|
+ /** 图例对象不为空 */
|
|
if (entity!=null){
|
|
if (entity!=null){
|
|
|
|
+ /** 锚点查询 */
|
|
val meiKuAnchorList = MeiKuAnchorService.select(SFilter.eq("id", meiKu.id!!)).exec()
|
|
val meiKuAnchorList = MeiKuAnchorService.select(SFilter.eq("id", meiKu.id!!)).exec()
|
|
if (meiKuAnchorList.size>0){
|
|
if (meiKuAnchorList.size>0){
|
|
entity.anchorList = meiKuAnchorList
|
|
entity.anchorList = meiKuAnchorList
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** 状态查询 */
|
|
val meiKuState = MeiKuStateService.select(SFilter.eq("id", meiKu.id!!)).exec()
|
|
val meiKuState = MeiKuStateService.select(SFilter.eq("id", meiKu.id!!)).exec()
|
|
if (!meiKuState.isNullOrEmpty()){
|
|
if (!meiKuState.isNullOrEmpty()){
|
|
entity.state = meiKuState
|
|
entity.state = meiKuState
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** 对象赋值 */
|
|
sQueryResponse.content = entity
|
|
sQueryResponse.content = entity
|
|
|
|
+ /** 状态 */
|
|
sQueryResponse.result = SResponseType.success
|
|
sQueryResponse.result = SResponseType.success
|
|
}else{
|
|
}else{
|
|
|
|
+ /** 状态 */
|
|
sQueryResponse.result = SResponseType.failure
|
|
sQueryResponse.result = SResponseType.failure
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
|
|
+ /** 状态 */
|
|
sQueryResponse.result = SResponseType.failure
|
|
sQueryResponse.result = SResponseType.failure
|
|
}
|
|
}
|
|
- sQueryResponse
|
|
|
|
|
|
+
|
|
|
|
+ /** 返回的对象 */
|
|
|
|
+ sQueryResponse
|
|
} catch (e: Exception) {
|
|
} catch (e: Exception) {
|
|
e.printStackTrace()
|
|
e.printStackTrace()
|
|
sQueryResponse.result = SResponseType.failure
|
|
sQueryResponse.result = SResponseType.failure
|
|
sQueryResponse.message = e.message.toString()
|
|
sQueryResponse.message = e.message.toString()
|
|
sQueryResponse
|
|
sQueryResponse
|
|
}
|
|
}
|
|
- } // read()
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-} // Object MeiKuService
|
|
|
|
|
|
+}
|