|
|
|
@ -641,6 +641,30 @@ object AssociationService : AbstractService() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun toAssociationVo(it: Association):AssociationVo{ |
|
|
|
|
return AssociationVo(id=it.id.value,name=it.name,desc = it.desc, |
|
|
|
|
logo = it.logo.filepath,faculty = AssociationFaculty.valueOf(it.faculty), |
|
|
|
|
level = it.level?.let { AssociationLevel.valueOf(it) }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun load(vo:ShowAssociationVo): AssociationMainVo { |
|
|
|
|
return transaction { |
|
|
|
|
val associationVo= (Association.findById(vo.id)?:throw AssociationIdError(vo.id)).let { |
|
|
|
|
AssociationVo(id=it.id.value,name=it.name,desc = it.desc, |
|
|
|
|
logo = it.logo.filepath,faculty = AssociationFaculty.valueOf(it.faculty), |
|
|
|
|
level = it.level?.let { AssociationLevel.valueOf(it) })} |
|
|
|
|
val head=Users.innerJoin(AssociationMembers) |
|
|
|
|
.slice(Users.columns) |
|
|
|
|
.select { AssociationMembers.isHead eq true and (AssociationMembers.associationId eq vo.id) } |
|
|
|
|
.firstOrNull()?.let { |
|
|
|
|
UserInfoVo(name = it[Users.name],headImg = it[Users.imgId]?.let { ImageFile.findById(it)?:throw FileIdError(it.value) }?.filepath, |
|
|
|
|
desc = it[Users.desc]) |
|
|
|
|
|
|
|
|
|
}?:throw IllegalArgumentException("无法找到社团[${vo.id}]") |
|
|
|
|
AssociationMainVo(associationVo = associationVo,head = head) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|